Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.57k | proof stringlengths 5 7.36k | hint bool 2 classes |
|---|---|---|---|---|---|---|
import Mathlib.Analysis.InnerProductSpace.Orthogonal
import Mathlib.Analysis.Normed.Group.AddTorsor
#align_import geometry.euclidean.basic from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Set
open scoped RealInnerProductSpace
variable {V P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V] [MetricSpace P]
variable [NormedAddTorsor V P]
noncomputable section
namespace AffineSubspace
variable {c c₁ c₂ p₁ p₂ : P}
def perpBisector (p₁ p₂ : P) : AffineSubspace ℝ P :=
.comap ((AffineEquiv.vaddConst ℝ (midpoint ℝ p₁ p₂)).symm : P →ᵃ[ℝ] V) <|
(LinearMap.ker (innerₛₗ ℝ (p₂ -ᵥ p₁))).toAffineSubspace
theorem mem_perpBisector_iff_inner_eq_zero' :
c ∈ perpBisector p₁ p₂ ↔ ⟪p₂ -ᵥ p₁, c -ᵥ midpoint ℝ p₁ p₂⟫ = 0 :=
Iff.rfl
theorem mem_perpBisector_iff_inner_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ midpoint ℝ p₁ p₂, p₂ -ᵥ p₁⟫ = 0 :=
inner_eq_zero_symm
theorem mem_perpBisector_iff_inner_pointReflection_vsub_eq_zero :
c ∈ perpBisector p₁ p₂ ↔ ⟪Equiv.pointReflection c p₁ -ᵥ p₂, p₂ -ᵥ p₁⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, Equiv.pointReflection_apply,
vsub_midpoint, invOf_eq_inv, ← smul_add, real_inner_smul_left, vadd_vsub_assoc]
simp
theorem mem_perpBisector_pointReflection_iff_inner_eq_zero :
c ∈ perpBisector p₁ (Equiv.pointReflection p₂ p₁) ↔ ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ = 0 := by
rw [mem_perpBisector_iff_inner_eq_zero, midpoint_pointReflection_right,
Equiv.pointReflection_apply, vadd_vsub_assoc, inner_add_right, add_self_eq_zero,
← neg_eq_zero, ← inner_neg_right, neg_vsub_eq_vsub_rev]
theorem midpoint_mem_perpBisector (p₁ p₂ : P) :
midpoint ℝ p₁ p₂ ∈ perpBisector p₁ p₂ := by
simp [mem_perpBisector_iff_inner_eq_zero]
theorem perpBisector_nonempty : (perpBisector p₁ p₂ : Set P).Nonempty :=
⟨_, midpoint_mem_perpBisector _ _⟩
@[simp]
theorem direction_perpBisector (p₁ p₂ : P) :
(perpBisector p₁ p₂).direction = (ℝ ∙ (p₂ -ᵥ p₁))ᗮ := by
erw [perpBisector, comap_symm, map_direction, Submodule.map_id,
Submodule.toAffineSubspace_direction]
ext x
exact Submodule.mem_orthogonal_singleton_iff_inner_right.symm
theorem mem_perpBisector_iff_inner_eq_inner :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = ⟪c -ᵥ p₂, p₁ -ᵥ p₂⟫ := by
rw [Iff.comm, mem_perpBisector_iff_inner_eq_zero, ← add_neg_eq_zero, ← inner_neg_right,
neg_vsub_eq_vsub_rev, ← inner_add_left, vsub_midpoint, invOf_eq_inv, ← smul_add,
real_inner_smul_left]; simp
theorem mem_perpBisector_iff_inner_eq :
c ∈ perpBisector p₁ p₂ ↔ ⟪c -ᵥ p₁, p₂ -ᵥ p₁⟫ = (dist p₁ p₂) ^ 2 / 2 := by
rw [mem_perpBisector_iff_inner_eq_zero, ← vsub_sub_vsub_cancel_right _ _ p₁, inner_sub_left,
sub_eq_zero, midpoint_vsub_left, invOf_eq_inv, real_inner_smul_left, real_inner_self_eq_norm_sq,
dist_eq_norm_vsub' V, div_eq_inv_mul]
| Mathlib/Geometry/Euclidean/PerpBisector.lean | 92 | 95 | theorem mem_perpBisector_iff_dist_eq : c ∈ perpBisector p₁ p₂ ↔ dist c p₁ = dist c p₂ := by
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff, |
rw [dist_eq_norm_vsub V, dist_eq_norm_vsub V, ← real_inner_add_sub_eq_zero_iff,
vsub_sub_vsub_cancel_left, inner_add_left, add_eq_zero_iff_eq_neg, ← inner_neg_right,
neg_vsub_eq_vsub_rev, mem_perpBisector_iff_inner_eq_inner]
| true |
import Mathlib.Algebra.ModEq
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Archimedean
import Mathlib.Algebra.Periodic
import Mathlib.Data.Int.SuccPred
import Mathlib.GroupTheory.QuotientGroup
import Mathlib.Order.Circular
import Mathlib.Data.List.TFAE
import Mathlib.Data.Set.Lattice
#align_import algebra.order.to_interval_mod from "leanprover-community/mathlib"@"213b0cff7bc5ab6696ee07cceec80829ce42efec"
noncomputable section
section LinearOrderedAddCommGroup
variable {α : Type*} [LinearOrderedAddCommGroup α] [hα : Archimedean α] {p : α} (hp : 0 < p)
{a b c : α} {n : ℤ}
def toIcoDiv (a b : α) : ℤ :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose
#align to_Ico_div toIcoDiv
theorem sub_toIcoDiv_zsmul_mem_Ico (a b : α) : b - toIcoDiv hp a b • p ∈ Set.Ico a (a + p) :=
(existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.1
#align sub_to_Ico_div_zsmul_mem_Ico sub_toIcoDiv_zsmul_mem_Ico
theorem toIcoDiv_eq_of_sub_zsmul_mem_Ico (h : b - n • p ∈ Set.Ico a (a + p)) :
toIcoDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ico hp b a).choose_spec.2 _ h).symm
#align to_Ico_div_eq_of_sub_zsmul_mem_Ico toIcoDiv_eq_of_sub_zsmul_mem_Ico
def toIocDiv (a b : α) : ℤ :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose
#align to_Ioc_div toIocDiv
theorem sub_toIocDiv_zsmul_mem_Ioc (a b : α) : b - toIocDiv hp a b • p ∈ Set.Ioc a (a + p) :=
(existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.1
#align sub_to_Ioc_div_zsmul_mem_Ioc sub_toIocDiv_zsmul_mem_Ioc
theorem toIocDiv_eq_of_sub_zsmul_mem_Ioc (h : b - n • p ∈ Set.Ioc a (a + p)) :
toIocDiv hp a b = n :=
((existsUnique_sub_zsmul_mem_Ioc hp b a).choose_spec.2 _ h).symm
#align to_Ioc_div_eq_of_sub_zsmul_mem_Ioc toIocDiv_eq_of_sub_zsmul_mem_Ioc
def toIcoMod (a b : α) : α :=
b - toIcoDiv hp a b • p
#align to_Ico_mod toIcoMod
def toIocMod (a b : α) : α :=
b - toIocDiv hp a b • p
#align to_Ioc_mod toIocMod
theorem toIcoMod_mem_Ico (a b : α) : toIcoMod hp a b ∈ Set.Ico a (a + p) :=
sub_toIcoDiv_zsmul_mem_Ico hp a b
#align to_Ico_mod_mem_Ico toIcoMod_mem_Ico
theorem toIcoMod_mem_Ico' (b : α) : toIcoMod hp 0 b ∈ Set.Ico 0 p := by
convert toIcoMod_mem_Ico hp 0 b
exact (zero_add p).symm
#align to_Ico_mod_mem_Ico' toIcoMod_mem_Ico'
theorem toIocMod_mem_Ioc (a b : α) : toIocMod hp a b ∈ Set.Ioc a (a + p) :=
sub_toIocDiv_zsmul_mem_Ioc hp a b
#align to_Ioc_mod_mem_Ioc toIocMod_mem_Ioc
theorem left_le_toIcoMod (a b : α) : a ≤ toIcoMod hp a b :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).1
#align left_le_to_Ico_mod left_le_toIcoMod
theorem left_lt_toIocMod (a b : α) : a < toIocMod hp a b :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).1
#align left_lt_to_Ioc_mod left_lt_toIocMod
theorem toIcoMod_lt_right (a b : α) : toIcoMod hp a b < a + p :=
(Set.mem_Ico.1 (toIcoMod_mem_Ico hp a b)).2
#align to_Ico_mod_lt_right toIcoMod_lt_right
theorem toIocMod_le_right (a b : α) : toIocMod hp a b ≤ a + p :=
(Set.mem_Ioc.1 (toIocMod_mem_Ioc hp a b)).2
#align to_Ioc_mod_le_right toIocMod_le_right
@[simp]
theorem self_sub_toIcoDiv_zsmul (a b : α) : b - toIcoDiv hp a b • p = toIcoMod hp a b :=
rfl
#align self_sub_to_Ico_div_zsmul self_sub_toIcoDiv_zsmul
@[simp]
theorem self_sub_toIocDiv_zsmul (a b : α) : b - toIocDiv hp a b • p = toIocMod hp a b :=
rfl
#align self_sub_to_Ioc_div_zsmul self_sub_toIocDiv_zsmul
@[simp]
| Mathlib/Algebra/Order/ToIntervalMod.lean | 123 | 124 | theorem toIcoDiv_zsmul_sub_self (a b : α) : toIcoDiv hp a b • p - b = -toIcoMod hp a b := by |
rw [toIcoMod, neg_sub]
| true |
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Nat.Dist
import Mathlib.Data.Ordmap.Ordnode
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
#align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
variable {α : Type*}
namespace Ordnode
theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 :=
not_le_of_gt H
#align ordnode.not_le_delta Ordnode.not_le_delta
theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False :=
not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by
simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta)
#align ordnode.delta_lt_false Ordnode.delta_lt_false
def realSize : Ordnode α → ℕ
| nil => 0
| node _ l _ r => realSize l + realSize r + 1
#align ordnode.real_size Ordnode.realSize
def Sized : Ordnode α → Prop
| nil => True
| node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r
#align ordnode.sized Ordnode.Sized
theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) :=
⟨rfl, hl, hr⟩
#align ordnode.sized.node' Ordnode.Sized.node'
| Mathlib/Data/Ordmap/Ordset.lean | 114 | 115 | theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by |
rw [h.1]
| true |
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Zip
import Mathlib.Data.Nat.Defs
import Mathlib.Data.List.Infix
#align_import data.list.rotate from "leanprover-community/mathlib"@"f694c7dead66f5d4c80f446c796a5aad14707f0e"
universe u
variable {α : Type u}
open Nat Function
namespace List
theorem rotate_mod (l : List α) (n : ℕ) : l.rotate (n % l.length) = l.rotate n := by simp [rotate]
#align list.rotate_mod List.rotate_mod
@[simp]
theorem rotate_nil (n : ℕ) : ([] : List α).rotate n = [] := by simp [rotate]
#align list.rotate_nil List.rotate_nil
@[simp]
theorem rotate_zero (l : List α) : l.rotate 0 = l := by simp [rotate]
#align list.rotate_zero List.rotate_zero
-- Porting note: removing simp, simp can prove it
theorem rotate'_nil (n : ℕ) : ([] : List α).rotate' n = [] := by cases n <;> rfl
#align list.rotate'_nil List.rotate'_nil
@[simp]
theorem rotate'_zero (l : List α) : l.rotate' 0 = l := by cases l <;> rfl
#align list.rotate'_zero List.rotate'_zero
theorem rotate'_cons_succ (l : List α) (a : α) (n : ℕ) :
(a :: l : List α).rotate' n.succ = (l ++ [a]).rotate' n := by simp [rotate']
#align list.rotate'_cons_succ List.rotate'_cons_succ
@[simp]
theorem length_rotate' : ∀ (l : List α) (n : ℕ), (l.rotate' n).length = l.length
| [], _ => by simp
| a :: l, 0 => rfl
| a :: l, n + 1 => by rw [List.rotate', length_rotate' (l ++ [a]) n]; simp
#align list.length_rotate' List.length_rotate'
theorem rotate'_eq_drop_append_take :
∀ {l : List α} {n : ℕ}, n ≤ l.length → l.rotate' n = l.drop n ++ l.take n
| [], n, h => by simp [drop_append_of_le_length h]
| l, 0, h => by simp [take_append_of_le_length h]
| a :: l, n + 1, h => by
have hnl : n ≤ l.length := le_of_succ_le_succ h
have hnl' : n ≤ (l ++ [a]).length := by
rw [length_append, length_cons, List.length]; exact le_of_succ_le h
rw [rotate'_cons_succ, rotate'_eq_drop_append_take hnl', drop, take,
drop_append_of_le_length hnl, take_append_of_le_length hnl]; simp
#align list.rotate'_eq_drop_append_take List.rotate'_eq_drop_append_take
theorem rotate'_rotate' : ∀ (l : List α) (n m : ℕ), (l.rotate' n).rotate' m = l.rotate' (n + m)
| a :: l, 0, m => by simp
| [], n, m => by simp
| a :: l, n + 1, m => by
rw [rotate'_cons_succ, rotate'_rotate' _ n, Nat.add_right_comm, ← rotate'_cons_succ,
Nat.succ_eq_add_one]
#align list.rotate'_rotate' List.rotate'_rotate'
@[simp]
theorem rotate'_length (l : List α) : rotate' l l.length = l := by
rw [rotate'_eq_drop_append_take le_rfl]; simp
#align list.rotate'_length List.rotate'_length
@[simp]
theorem rotate'_length_mul (l : List α) : ∀ n : ℕ, l.rotate' (l.length * n) = l
| 0 => by simp
| n + 1 =>
calc
l.rotate' (l.length * (n + 1)) =
(l.rotate' (l.length * n)).rotate' (l.rotate' (l.length * n)).length := by
simp [-rotate'_length, Nat.mul_succ, rotate'_rotate']
_ = l := by rw [rotate'_length, rotate'_length_mul l n]
#align list.rotate'_length_mul List.rotate'_length_mul
theorem rotate'_mod (l : List α) (n : ℕ) : l.rotate' (n % l.length) = l.rotate' n :=
calc
l.rotate' (n % l.length) =
(l.rotate' (n % l.length)).rotate' ((l.rotate' (n % l.length)).length * (n / l.length)) :=
by rw [rotate'_length_mul]
_ = l.rotate' n := by rw [rotate'_rotate', length_rotate', Nat.mod_add_div]
#align list.rotate'_mod List.rotate'_mod
theorem rotate_eq_rotate' (l : List α) (n : ℕ) : l.rotate n = l.rotate' n :=
if h : l.length = 0 then by simp_all [length_eq_zero]
else by
rw [← rotate'_mod,
rotate'_eq_drop_append_take (le_of_lt (Nat.mod_lt _ (Nat.pos_of_ne_zero h)))];
simp [rotate]
#align list.rotate_eq_rotate' List.rotate_eq_rotate'
theorem rotate_cons_succ (l : List α) (a : α) (n : ℕ) :
(a :: l : List α).rotate (n + 1) = (l ++ [a]).rotate n := by
rw [rotate_eq_rotate', rotate_eq_rotate', rotate'_cons_succ]
#align list.rotate_cons_succ List.rotate_cons_succ
@[simp]
theorem mem_rotate : ∀ {l : List α} {a : α} {n : ℕ}, a ∈ l.rotate n ↔ a ∈ l
| [], _, n => by simp
| a :: l, _, 0 => by simp
| a :: l, _, n + 1 => by simp [rotate_cons_succ, mem_rotate, or_comm]
#align list.mem_rotate List.mem_rotate
@[simp]
theorem length_rotate (l : List α) (n : ℕ) : (l.rotate n).length = l.length := by
rw [rotate_eq_rotate', length_rotate']
#align list.length_rotate List.length_rotate
@[simp]
theorem rotate_replicate (a : α) (n : ℕ) (k : ℕ) : (replicate n a).rotate k = replicate n a :=
eq_replicate.2 ⟨by rw [length_rotate, length_replicate], fun b hb =>
eq_of_mem_replicate <| mem_rotate.1 hb⟩
#align list.rotate_replicate List.rotate_replicate
| Mathlib/Data/List/Rotate.lean | 142 | 144 | theorem rotate_eq_drop_append_take {l : List α} {n : ℕ} :
n ≤ l.length → l.rotate n = l.drop n ++ l.take n := by |
rw [rotate_eq_rotate']; exact rotate'_eq_drop_append_take
| true |
import Mathlib.Topology.Order
import Mathlib.Topology.Sets.Opens
import Mathlib.Topology.ContinuousFunction.Basic
#align_import topology.continuous_function.t0_sierpinski from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
noncomputable section
namespace TopologicalSpace
theorem eq_induced_by_maps_to_sierpinski (X : Type*) [t : TopologicalSpace X] :
t = ⨅ u : Opens X, sierpinskiSpace.induced (· ∈ u) := by
apply le_antisymm
· rw [le_iInf_iff]
exact fun u => Continuous.le_induced (isOpen_iff_continuous_mem.mp u.2)
· intro u h
rw [← generateFrom_iUnion_isOpen]
apply isOpen_generateFrom_of_mem
simp only [Set.mem_iUnion, Set.mem_setOf_eq, isOpen_induced_iff]
exact ⟨⟨u, h⟩, {True}, isOpen_singleton_true, by simp [Set.preimage]⟩
#align topological_space.eq_induced_by_maps_to_sierpinski TopologicalSpace.eq_induced_by_maps_to_sierpinski
variable (X : Type*) [TopologicalSpace X]
def productOfMemOpens : C(X, Opens X → Prop) where
toFun x u := x ∈ u
continuous_toFun := continuous_pi_iff.2 fun u => continuous_Prop.2 u.isOpen
#align topological_space.product_of_mem_opens TopologicalSpace.productOfMemOpens
theorem productOfMemOpens_inducing : Inducing (productOfMemOpens X) := by
convert inducing_iInf_to_pi fun (u : Opens X) (x : X) => x ∈ u
apply eq_induced_by_maps_to_sierpinski
#align topological_space.product_of_mem_opens_inducing TopologicalSpace.productOfMemOpens_inducing
| Mathlib/Topology/ContinuousFunction/T0Sierpinski.lean | 55 | 58 | theorem productOfMemOpens_injective [T0Space X] : Function.Injective (productOfMemOpens X) := by
intro x1 x2 h |
intro x1 x2 h
apply Inseparable.eq
rw [← Inducing.inseparable_iff (productOfMemOpens_inducing X), h]
| true |
import Mathlib.Algebra.Ring.InjSurj
import Mathlib.Algebra.Group.Units.Hom
import Mathlib.Algebra.Ring.Hom.Defs
#align_import algebra.ring.units from "leanprover-community/mathlib"@"2ed7e4aec72395b6a7c3ac4ac7873a7a43ead17c"
universe u v w x
variable {α : Type u} {β : Type v} {γ : Type w} {R : Type x}
open Function
namespace Units
section HasDistribNeg
variable [Monoid α] [HasDistribNeg α] {a b : α}
instance : Neg αˣ :=
⟨fun u => ⟨-↑u, -↑u⁻¹, by simp, by simp⟩⟩
@[simp, norm_cast]
protected theorem val_neg (u : αˣ) : (↑(-u) : α) = -u :=
rfl
#align units.coe_neg Units.val_neg
@[simp, norm_cast]
protected theorem coe_neg_one : ((-1 : αˣ) : α) = -1 :=
rfl
#align units.coe_neg_one Units.coe_neg_one
instance : HasDistribNeg αˣ :=
Units.ext.hasDistribNeg _ Units.val_neg Units.val_mul
@[field_simps]
| Mathlib/Algebra/Ring/Units.lean | 50 | 50 | theorem neg_divp (a : α) (u : αˣ) : -(a /ₚ u) = -a /ₚ u := by | simp only [divp, neg_mul]
| true |
import Batteries.Data.Nat.Gcd
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Mathport.Rename
#align_import init.data.nat.gcd from "leanprover-community/lean"@"855e5b74e3a52a40552e8f067169d747d48743fd"
open WellFounded
namespace Nat
#align nat.gcd Nat.gcd
#align nat.gcd_zero_left Nat.gcd_zero_left
#align nat.gcd_succ Nat.gcd_succ
#align nat.gcd_one_left Nat.gcd_one_left
#align nat.gcd_self Nat.gcd_self
#align nat.gcd_zero_right Nat.gcd_zero_right
#align nat.gcd_rec Nat.gcd_rec
#align nat.gcd.induction Nat.gcd.induction
#align nat.lcm Nat.lcm
| Mathlib/Init/Data/Nat/GCD.lean | 35 | 36 | theorem gcd_def (x y : ℕ) : gcd x y = if x = 0 then y else gcd (y % x) x := by |
cases x <;> simp [Nat.gcd_succ]
| true |
import Mathlib.Algebra.ContinuedFractions.Translations
#align_import algebra.continued_fractions.continuants_recurrence from "leanprover-community/mathlib"@"5f11361a98ae4acd77f5c1837686f6f0102cdc25"
namespace GeneralizedContinuedFraction
variable {K : Type*} {g : GeneralizedContinuedFraction K} {n : ℕ} [DivisionRing K]
theorem continuantsAux_recurrence {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp)
(nth_conts_aux_eq : g.continuantsAux n = ppred)
(succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) :
g.continuantsAux (n + 2) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ :=
by simp [*, continuantsAux, nextContinuants, nextDenominator, nextNumerator]
#align generalized_continued_fraction.continuants_aux_recurrence GeneralizedContinuedFraction.continuantsAux_recurrence
| Mathlib/Algebra/ContinuedFractions/ContinuantsRecurrence.lean | 33 | 38 | theorem continuants_recurrenceAux {gp ppred pred : Pair K} (nth_s_eq : g.s.get? n = some gp)
(nth_conts_aux_eq : g.continuantsAux n = ppred)
(succ_nth_conts_aux_eq : g.continuantsAux (n + 1) = pred) :
g.continuants (n + 1) = ⟨gp.b * pred.a + gp.a * ppred.a, gp.b * pred.b + gp.a * ppred.b⟩ := by
simp [nth_cont_eq_succ_nth_cont_aux, |
simp [nth_cont_eq_succ_nth_cont_aux,
continuantsAux_recurrence nth_s_eq nth_conts_aux_eq succ_nth_conts_aux_eq]
| true |
import Mathlib.SetTheory.Game.Ordinal
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.birthday from "leanprover-community/mathlib"@"a347076985674932c0e91da09b9961ed0a79508c"
universe u
open Ordinal
namespace SetTheory
open scoped NaturalOps PGame
namespace PGame
noncomputable def birthday : PGame.{u} → Ordinal.{u}
| ⟨_, _, xL, xR⟩ =>
max (lsub.{u, u} fun i => birthday (xL i)) (lsub.{u, u} fun i => birthday (xR i))
#align pgame.birthday SetTheory.PGame.birthday
theorem birthday_def (x : PGame) :
birthday x =
max (lsub.{u, u} fun i => birthday (x.moveLeft i))
(lsub.{u, u} fun i => birthday (x.moveRight i)) := by
cases x; rw [birthday]; rfl
#align pgame.birthday_def SetTheory.PGame.birthday_def
| Mathlib/SetTheory/Game/Birthday.lean | 54 | 56 | theorem birthday_moveLeft_lt {x : PGame} (i : x.LeftMoves) :
(x.moveLeft i).birthday < x.birthday := by |
cases x; rw [birthday]; exact lt_max_of_lt_left (lt_lsub _ i)
| true |
import Mathlib.Analysis.Calculus.FDeriv.Analytic
import Mathlib.Analysis.Asymptotics.SpecificAsymptotics
import Mathlib.Analysis.Complex.CauchyIntegral
#align_import analysis.complex.removable_singularity from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open TopologicalSpace Metric Set Filter Asymptotics Function
open scoped Topology Filter NNReal Real
universe u
variable {E : Type u} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E]
namespace Complex
theorem analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt {f : ℂ → E} {c : ℂ}
(hd : ∀ᶠ z in 𝓝[≠] c, DifferentiableAt ℂ f z) (hc : ContinuousAt f c) : AnalyticAt ℂ f c := by
rcases (nhdsWithin_hasBasis nhds_basis_closedBall _).mem_iff.1 hd with ⟨R, hR0, hRs⟩
lift R to ℝ≥0 using hR0.le
replace hc : ContinuousOn f (closedBall c R) := by
refine fun z hz => ContinuousAt.continuousWithinAt ?_
rcases eq_or_ne z c with (rfl | hne)
exacts [hc, (hRs ⟨hz, hne⟩).continuousAt]
exact (hasFPowerSeriesOnBall_of_differentiable_off_countable (countable_singleton c) hc
(fun z hz => hRs (diff_subset_diff_left ball_subset_closedBall hz)) hR0).analyticAt
#align complex.analytic_at_of_differentiable_on_punctured_nhds_of_continuous_at Complex.analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt
theorem differentiableOn_compl_singleton_and_continuousAt_iff {f : ℂ → E} {s : Set ℂ} {c : ℂ}
(hs : s ∈ 𝓝 c) :
DifferentiableOn ℂ f (s \ {c}) ∧ ContinuousAt f c ↔ DifferentiableOn ℂ f s := by
refine ⟨?_, fun hd => ⟨hd.mono diff_subset, (hd.differentiableAt hs).continuousAt⟩⟩
rintro ⟨hd, hc⟩ x hx
rcases eq_or_ne x c with (rfl | hne)
· refine (analyticAt_of_differentiable_on_punctured_nhds_of_continuousAt
?_ hc).differentiableAt.differentiableWithinAt
refine eventually_nhdsWithin_iff.2 ((eventually_mem_nhds.2 hs).mono fun z hz hzx => ?_)
exact hd.differentiableAt (inter_mem hz (isOpen_ne.mem_nhds hzx))
· simpa only [DifferentiableWithinAt, HasFDerivWithinAt, hne.nhdsWithin_diff_singleton] using
hd x ⟨hx, hne⟩
#align complex.differentiable_on_compl_singleton_and_continuous_at_iff Complex.differentiableOn_compl_singleton_and_continuousAt_iff
theorem differentiableOn_dslope {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hc : s ∈ 𝓝 c) :
DifferentiableOn ℂ (dslope f c) s ↔ DifferentiableOn ℂ f s :=
⟨fun h => h.of_dslope, fun h =>
(differentiableOn_compl_singleton_and_continuousAt_iff hc).mp <|
⟨Iff.mpr (differentiableOn_dslope_of_nmem fun h => h.2 rfl) (h.mono diff_subset),
continuousAt_dslope_same.2 <| h.differentiableAt hc⟩⟩
#align complex.differentiable_on_dslope Complex.differentiableOn_dslope
| Mathlib/Analysis/Complex/RemovableSingularity.lean | 71 | 87 | theorem differentiableOn_update_limUnder_of_isLittleO {f : ℂ → E} {s : Set ℂ} {c : ℂ} (hc : s ∈ 𝓝 c)
(hd : DifferentiableOn ℂ f (s \ {c}))
(ho : (fun z => f z - f c) =o[𝓝[≠] c] fun z => (z - c)⁻¹) :
DifferentiableOn ℂ (update f c (limUnder (𝓝[≠] c) f)) s := by
set F : ℂ → E := fun z => (z - c) • f z |
set F : ℂ → E := fun z => (z - c) • f z
suffices DifferentiableOn ℂ F (s \ {c}) ∧ ContinuousAt F c by
rw [differentiableOn_compl_singleton_and_continuousAt_iff hc, ← differentiableOn_dslope hc,
dslope_sub_smul] at this
have hc : Tendsto f (𝓝[≠] c) (𝓝 (deriv F c)) :=
continuousAt_update_same.mp (this.continuousOn.continuousAt hc)
rwa [hc.limUnder_eq]
refine ⟨(differentiableOn_id.sub_const _).smul hd, ?_⟩
rw [← continuousWithinAt_compl_self]
have H := ho.tendsto_inv_smul_nhds_zero
have H' : Tendsto (fun z => (z - c) • f c) (𝓝[≠] c) (𝓝 (F c)) :=
(continuousWithinAt_id.tendsto.sub tendsto_const_nhds).smul tendsto_const_nhds
simpa [← smul_add, ContinuousWithinAt] using H.add H'
| true |
import Mathlib.Analysis.Normed.Group.InfiniteSum
import Mathlib.Analysis.Normed.MulAction
import Mathlib.Topology.Algebra.Order.LiminfLimsup
import Mathlib.Topology.PartialHomeomorph
#align_import analysis.asymptotics.asymptotics from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Filter Set
open scoped Classical
open Topology Filter NNReal
namespace Asymptotics
set_option linter.uppercaseLean3 false
variable {α : Type*} {β : Type*} {E : Type*} {F : Type*} {G : Type*} {E' : Type*}
{F' : Type*} {G' : Type*} {E'' : Type*} {F'' : Type*} {G'' : Type*} {E''' : Type*}
{R : Type*} {R' : Type*} {𝕜 : Type*} {𝕜' : Type*}
variable [Norm E] [Norm F] [Norm G]
variable [SeminormedAddCommGroup E'] [SeminormedAddCommGroup F'] [SeminormedAddCommGroup G']
[NormedAddCommGroup E''] [NormedAddCommGroup F''] [NormedAddCommGroup G''] [SeminormedRing R]
[SeminormedAddGroup E''']
[SeminormedRing R']
variable [NormedDivisionRing 𝕜] [NormedDivisionRing 𝕜']
variable {c c' c₁ c₂ : ℝ} {f : α → E} {g : α → F} {k : α → G}
variable {f' : α → E'} {g' : α → F'} {k' : α → G'}
variable {f'' : α → E''} {g'' : α → F''} {k'' : α → G''}
variable {l l' : Filter α}
section Defs
irreducible_def IsBigOWith (c : ℝ) (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖
#align asymptotics.is_O_with Asymptotics.IsBigOWith
theorem isBigOWith_iff : IsBigOWith c l f g ↔ ∀ᶠ x in l, ‖f x‖ ≤ c * ‖g x‖ := by rw [IsBigOWith_def]
#align asymptotics.is_O_with_iff Asymptotics.isBigOWith_iff
alias ⟨IsBigOWith.bound, IsBigOWith.of_bound⟩ := isBigOWith_iff
#align asymptotics.is_O_with.bound Asymptotics.IsBigOWith.bound
#align asymptotics.is_O_with.of_bound Asymptotics.IsBigOWith.of_bound
irreducible_def IsBigO (l : Filter α) (f : α → E) (g : α → F) : Prop :=
∃ c : ℝ, IsBigOWith c l f g
#align asymptotics.is_O Asymptotics.IsBigO
@[inherit_doc]
notation:100 f " =O[" l "] " g:100 => IsBigO l f g
| Mathlib/Analysis/Asymptotics/Asymptotics.lean | 109 | 109 | theorem isBigO_iff_isBigOWith : f =O[l] g ↔ ∃ c : ℝ, IsBigOWith c l f g := by | rw [IsBigO_def]
| true |
import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Integral.SetIntegral
#align_import measure_theory.measure.haar.normed_space from "leanprover-community/mathlib"@"b84aee748341da06a6d78491367e2c0e9f15e8a5"
noncomputable section
open scoped NNReal ENNReal Pointwise Topology
open Inv Set Function MeasureTheory.Measure Filter
open FiniteDimensional
namespace MeasureTheory
namespace Measure
example {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [Nontrivial E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E] (μ : Measure E) [IsAddHaarMeasure μ] : NoAtoms μ := by
infer_instance
variable {F : Type*} [NormedAddCommGroup F]
| Mathlib/MeasureTheory/Measure/Haar/NormedSpace.lean | 163 | 177 | theorem integrable_comp_smul_iff {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[MeasurableSpace E] [BorelSpace E] [FiniteDimensional ℝ E] (μ : Measure E) [IsAddHaarMeasure μ]
(f : E → F) {R : ℝ} (hR : R ≠ 0) : Integrable (fun x => f (R • x)) μ ↔ Integrable f μ := by
-- reduce to one-way implication |
-- reduce to one-way implication
suffices
∀ {g : E → F} (_ : Integrable g μ) {S : ℝ} (_ : S ≠ 0), Integrable (fun x => g (S • x)) μ by
refine ⟨fun hf => ?_, fun hf => this hf hR⟩
convert this hf (inv_ne_zero hR)
rw [← mul_smul, mul_inv_cancel hR, one_smul]
-- now prove
intro g hg S hS
let t := ((Homeomorph.smul (isUnit_iff_ne_zero.2 hS).unit).toMeasurableEquiv : E ≃ᵐ E)
refine (integrable_map_equiv t g).mp (?_ : Integrable g (map (S • ·) μ))
rwa [map_addHaar_smul μ hS, integrable_smul_measure _ ENNReal.ofReal_ne_top]
simpa only [Ne, ENNReal.ofReal_eq_zero, not_le, abs_pos] using inv_ne_zero (pow_ne_zero _ hS)
| true |
import Mathlib.Algebra.Field.Defs
import Mathlib.Algebra.GroupWithZero.Units.Lemmas
import Mathlib.Algebra.Ring.Commute
import Mathlib.Algebra.Ring.Invertible
import Mathlib.Order.Synonym
#align_import algebra.field.basic from "leanprover-community/mathlib"@"05101c3df9d9cfe9430edc205860c79b6d660102"
open Function OrderDual Set
universe u
variable {α β K : Type*}
section DivisionMonoid
variable [DivisionMonoid K] [HasDistribNeg K] {a b : K}
theorem one_div_neg_one_eq_neg_one : (1 : K) / -1 = -1 :=
have : -1 * -1 = (1 : K) := by rw [neg_mul_neg, one_mul]
Eq.symm (eq_one_div_of_mul_eq_one_right this)
#align one_div_neg_one_eq_neg_one one_div_neg_one_eq_neg_one
| Mathlib/Algebra/Field/Basic.lean | 101 | 106 | theorem one_div_neg_eq_neg_one_div (a : K) : 1 / -a = -(1 / a) :=
calc
1 / -a = 1 / (-1 * a) := by rw [neg_eq_neg_one_mul] | rw [neg_eq_neg_one_mul]
_ = 1 / a * (1 / -1) := by rw [one_div_mul_one_div_rev]
_ = 1 / a * -1 := by rw [one_div_neg_one_eq_neg_one]
_ = -(1 / a) := by rw [mul_neg, mul_one]
| true |
import Mathlib.Data.ENat.Lattice
import Mathlib.Order.OrderIsoNat
import Mathlib.Tactic.TFAE
#align_import order.height from "leanprover-community/mathlib"@"bf27744463e9620ca4e4ebe951fe83530ae6949b"
open List hiding le_antisymm
open OrderDual
universe u v
variable {α β : Type*}
namespace Set
section LT
variable [LT α] [LT β] (s t : Set α)
def subchain : Set (List α) :=
{ l | l.Chain' (· < ·) ∧ ∀ i ∈ l, i ∈ s }
#align set.subchain Set.subchain
@[simp] -- porting note: new `simp`
theorem nil_mem_subchain : [] ∈ s.subchain := ⟨trivial, fun _ ↦ nofun⟩
#align set.nil_mem_subchain Set.nil_mem_subchain
variable {s} {l : List α} {a : α}
theorem cons_mem_subchain_iff :
(a::l) ∈ s.subchain ↔ a ∈ s ∧ l ∈ s.subchain ∧ ∀ b ∈ l.head?, a < b := by
simp only [subchain, mem_setOf_eq, forall_mem_cons, chain'_cons', and_left_comm, and_comm,
and_assoc]
#align set.cons_mem_subchain_iff Set.cons_mem_subchain_iff
@[simp] -- Porting note (#10756): new lemma + `simp`
theorem singleton_mem_subchain_iff : [a] ∈ s.subchain ↔ a ∈ s := by simp [cons_mem_subchain_iff]
instance : Nonempty s.subchain :=
⟨⟨[], s.nil_mem_subchain⟩⟩
variable (s)
noncomputable def chainHeight : ℕ∞ :=
⨆ l ∈ s.subchain, length l
#align set.chain_height Set.chainHeight
theorem chainHeight_eq_iSup_subtype : s.chainHeight = ⨆ l : s.subchain, ↑l.1.length :=
iSup_subtype'
#align set.chain_height_eq_supr_subtype Set.chainHeight_eq_iSup_subtype
theorem exists_chain_of_le_chainHeight {n : ℕ} (hn : ↑n ≤ s.chainHeight) :
∃ l ∈ s.subchain, length l = n := by
rcases (le_top : s.chainHeight ≤ ⊤).eq_or_lt with ha | ha <;>
rw [chainHeight_eq_iSup_subtype] at ha
· obtain ⟨_, ⟨⟨l, h₁, h₂⟩, rfl⟩, h₃⟩ :=
not_bddAbove_iff'.mp (WithTop.iSup_coe_eq_top.1 ha) n
exact ⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| le_of_not_ge h₃⟩
· rw [ENat.iSup_coe_lt_top] at ha
obtain ⟨⟨l, h₁, h₂⟩, e : l.length = _⟩ := Nat.sSup_mem (Set.range_nonempty _) ha
refine
⟨l.take n, ⟨h₁.take _, fun x h ↦ h₂ _ <| take_subset _ _ h⟩,
(l.length_take n).trans <| min_eq_left <| ?_⟩
rwa [e, ← Nat.cast_le (α := ℕ∞), sSup_range, ENat.coe_iSup ha, ← chainHeight_eq_iSup_subtype]
#align set.exists_chain_of_le_chain_height Set.exists_chain_of_le_chainHeight
| Mathlib/Order/Height.lean | 109 | 114 | theorem le_chainHeight_TFAE (n : ℕ) :
TFAE [↑n ≤ s.chainHeight, ∃ l ∈ s.subchain, length l = n, ∃ l ∈ s.subchain, n ≤ length l] := by
tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight |
tfae_have 1 → 2; · exact s.exists_chain_of_le_chainHeight
tfae_have 2 → 3; · rintro ⟨l, hls, he⟩; exact ⟨l, hls, he.ge⟩
tfae_have 3 → 1; · rintro ⟨l, hs, hn⟩; exact le_iSup₂_of_le l hs (WithTop.coe_le_coe.2 hn)
tfae_finish
| true |
import Mathlib.Algebra.MvPolynomial.Derivation
import Mathlib.Algebra.MvPolynomial.Variables
#align_import data.mv_polynomial.pderiv from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
universe u v
namespace MvPolynomial
open Set Function Finsupp
variable {R : Type u} {σ : Type v} {a a' a₁ a₂ : R} {s : σ →₀ ℕ}
section PDeriv
variable [CommSemiring R]
def pderiv (i : σ) : Derivation R (MvPolynomial σ R) (MvPolynomial σ R) :=
letI := Classical.decEq σ
mkDerivation R <| Pi.single i 1
#align mv_polynomial.pderiv MvPolynomial.pderiv
theorem pderiv_def [DecidableEq σ] (i : σ) : pderiv i = mkDerivation R (Pi.single i 1) := by
unfold pderiv; congr!
#align mv_polynomial.pderiv_def MvPolynomial.pderiv_def
@[simp]
| Mathlib/Algebra/MvPolynomial/PDeriv.lean | 69 | 77 | theorem pderiv_monomial {i : σ} :
pderiv i (monomial s a) = monomial (s - single i 1) (a * s i) := by
classical |
classical
simp only [pderiv_def, mkDerivation_monomial, Finsupp.smul_sum, smul_eq_mul, ← smul_mul_assoc,
← (monomial _).map_smul]
refine (Finset.sum_eq_single i (fun j _ hne => ?_) fun hi => ?_).trans ?_
· simp [Pi.single_eq_of_ne hne]
· rw [Finsupp.not_mem_support_iff] at hi; simp [hi]
· simp
| true |
import Mathlib.CategoryTheory.Equivalence
#align_import algebraic_topology.dold_kan.compatibility from "leanprover-community/mathlib"@"32a7e535287f9c73f2e4d2aef306a39190f0b504"
open CategoryTheory CategoryTheory.Category
namespace AlgebraicTopology
namespace DoldKan
namespace Compatibility
variable {A A' B B' : Type*} [Category A] [Category A'] [Category B] [Category B'] (eA : A ≌ A')
(eB : B ≌ B') (e' : A' ≌ B') {F : A ⥤ B'} (hF : eA.functor ⋙ e'.functor ≅ F) {G : B ⥤ A}
(hG : eB.functor ⋙ e'.inverse ≅ G ⋙ eA.functor)
@[simps! functor inverse unitIso_hom_app]
def equivalence₀ : A ≌ B' :=
eA.trans e'
#align algebraic_topology.dold_kan.compatibility.equivalence₀ AlgebraicTopology.DoldKan.Compatibility.equivalence₀
variable {eA} {e'}
@[simps! functor]
def equivalence₁ : A ≌ B' := (equivalence₀ eA e').changeFunctor hF
#align algebraic_topology.dold_kan.compatibility.equivalence₁ AlgebraicTopology.DoldKan.Compatibility.equivalence₁
theorem equivalence₁_inverse : (equivalence₁ hF).inverse = e'.inverse ⋙ eA.inverse :=
rfl
#align algebraic_topology.dold_kan.compatibility.equivalence₁_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₁_inverse
@[simps!]
def equivalence₁CounitIso : (e'.inverse ⋙ eA.inverse) ⋙ F ≅ 𝟭 B' :=
calc
(e'.inverse ⋙ eA.inverse) ⋙ F ≅ (e'.inverse ⋙ eA.inverse) ⋙ eA.functor ⋙ e'.functor :=
isoWhiskerLeft _ hF.symm
_ ≅ e'.inverse ⋙ (eA.inverse ⋙ eA.functor) ⋙ e'.functor := Iso.refl _
_ ≅ e'.inverse ⋙ 𝟭 _ ⋙ e'.functor := isoWhiskerLeft _ (isoWhiskerRight eA.counitIso _)
_ ≅ e'.inverse ⋙ e'.functor := Iso.refl _
_ ≅ 𝟭 B' := e'.counitIso
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso
theorem equivalence₁CounitIso_eq : (equivalence₁ hF).counitIso = equivalence₁CounitIso hF := by
ext Y
simp [equivalence₁, equivalence₀]
#align algebraic_topology.dold_kan.compatibility.equivalence₁_counit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁CounitIso_eq
@[simps!]
def equivalence₁UnitIso : 𝟭 A ≅ F ⋙ e'.inverse ⋙ eA.inverse :=
calc
𝟭 A ≅ eA.functor ⋙ eA.inverse := eA.unitIso
_ ≅ eA.functor ⋙ 𝟭 A' ⋙ eA.inverse := Iso.refl _
_ ≅ eA.functor ⋙ (e'.functor ⋙ e'.inverse) ⋙ eA.inverse :=
isoWhiskerLeft _ (isoWhiskerRight e'.unitIso _)
_ ≅ (eA.functor ⋙ e'.functor) ⋙ e'.inverse ⋙ eA.inverse := Iso.refl _
_ ≅ F ⋙ e'.inverse ⋙ eA.inverse := isoWhiskerRight hF _
#align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso
theorem equivalence₁UnitIso_eq : (equivalence₁ hF).unitIso = equivalence₁UnitIso hF := by
ext X
simp [equivalence₁]
#align algebraic_topology.dold_kan.compatibility.equivalence₁_unit_iso_eq AlgebraicTopology.DoldKan.Compatibility.equivalence₁UnitIso_eq
@[simps! functor]
def equivalence₂ : A ≌ B :=
(equivalence₁ hF).trans eB.symm
#align algebraic_topology.dold_kan.compatibility.equivalence₂ AlgebraicTopology.DoldKan.Compatibility.equivalence₂
theorem equivalence₂_inverse :
(equivalence₂ eB hF).inverse = eB.functor ⋙ e'.inverse ⋙ eA.inverse :=
rfl
#align algebraic_topology.dold_kan.compatibility.equivalence₂_inverse AlgebraicTopology.DoldKan.Compatibility.equivalence₂_inverse
@[simps!]
def equivalence₂CounitIso : (eB.functor ⋙ e'.inverse ⋙ eA.inverse) ⋙ F ⋙ eB.inverse ≅ 𝟭 B :=
calc
(eB.functor ⋙ e'.inverse ⋙ eA.inverse) ⋙ F ⋙ eB.inverse ≅
eB.functor ⋙ (e'.inverse ⋙ eA.inverse ⋙ F) ⋙ eB.inverse :=
Iso.refl _
_ ≅ eB.functor ⋙ 𝟭 _ ⋙ eB.inverse :=
isoWhiskerLeft _ (isoWhiskerRight (equivalence₁CounitIso hF) _)
_ ≅ eB.functor ⋙ eB.inverse := Iso.refl _
_ ≅ 𝟭 B := eB.unitIso.symm
#align algebraic_topology.dold_kan.compatibility.equivalence₂_counit_iso AlgebraicTopology.DoldKan.Compatibility.equivalence₂CounitIso
| Mathlib/AlgebraicTopology/DoldKan/Compatibility.lean | 133 | 138 | theorem equivalence₂CounitIso_eq :
(equivalence₂ eB hF).counitIso = equivalence₂CounitIso eB hF := by
ext Y' |
ext Y'
dsimp [equivalence₂, Iso.refl]
simp only [equivalence₁CounitIso_eq, equivalence₂CounitIso_hom_app,
equivalence₁CounitIso_hom_app, Functor.map_comp, assoc]
| true |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.Algebra.Module.Torsion
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v v' u₁' w w'
variable {R S : Type u} {M : Type v} {M' : Type v'} {M₁ : Type v}
variable {ι : Type w} {ι' : Type w'} {η : Type u₁'} {φ : η → Type*}
open Cardinal Basis Submodule Function Set FiniteDimensional DirectSum
variable [Ring R] [CommRing S] [AddCommGroup M] [AddCommGroup M'] [AddCommGroup M₁]
variable [Module R M] [Module R M'] [Module R M₁]
section Finsupp
variable (R M M')
variable [StrongRankCondition R] [Module.Free R M] [Module.Free R M']
open Module.Free
@[simp]
theorem rank_finsupp (ι : Type w) :
Module.rank R (ι →₀ M) = Cardinal.lift.{v} #ι * Cardinal.lift.{w} (Module.rank R M) := by
obtain ⟨⟨_, bs⟩⟩ := Module.Free.exists_basis (R := R) (M := M)
rw [← bs.mk_eq_rank'', ← (Finsupp.basis fun _ : ι => bs).mk_eq_rank'', Cardinal.mk_sigma,
Cardinal.sum_const]
#align rank_finsupp rank_finsupp
theorem rank_finsupp' (ι : Type v) : Module.rank R (ι →₀ M) = #ι * Module.rank R M := by
simp [rank_finsupp]
#align rank_finsupp' rank_finsupp'
-- Porting note, this should not be `@[simp]`, as simp can prove it.
-- @[simp]
theorem rank_finsupp_self (ι : Type w) : Module.rank R (ι →₀ R) = Cardinal.lift.{u} #ι := by
simp [rank_finsupp]
#align rank_finsupp_self rank_finsupp_self
theorem rank_finsupp_self' {ι : Type u} : Module.rank R (ι →₀ R) = #ι := by simp
#align rank_finsupp_self' rank_finsupp_self'
@[simp]
theorem rank_directSum {ι : Type v} (M : ι → Type w) [∀ i : ι, AddCommGroup (M i)]
[∀ i : ι, Module R (M i)] [∀ i : ι, Module.Free R (M i)] :
Module.rank R (⨁ i, M i) = Cardinal.sum fun i => Module.rank R (M i) := by
let B i := chooseBasis R (M i)
let b : Basis _ R (⨁ i, M i) := DFinsupp.basis fun i => B i
simp [← b.mk_eq_rank'', fun i => (B i).mk_eq_rank'']
#align rank_direct_sum rank_directSum
@[simp]
theorem rank_matrix (m : Type v) (n : Type w) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) =
Cardinal.lift.{max v w u, v} #m * Cardinal.lift.{max v w u, w} #n := by
cases nonempty_fintype m
cases nonempty_fintype n
have h := (Matrix.stdBasis R m n).mk_eq_rank
rw [← lift_lift.{max v w u, max v w}, lift_inj] at h
simpa using h.symm
#align rank_matrix rank_matrix
@[simp high]
theorem rank_matrix' (m n : Type v) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = Cardinal.lift.{u} (#m * #n) := by
rw [rank_matrix, lift_mul, lift_umax.{v, u}]
#align rank_matrix' rank_matrix'
-- @[simp] -- Porting note (#10618): simp can prove this
theorem rank_matrix'' (m n : Type u) [Finite m] [Finite n] :
Module.rank R (Matrix m n R) = #m * #n := by simp
#align rank_matrix'' rank_matrix''
variable [Module.Finite R M] [Module.Finite R M']
open Fintype
section SubalgebraRank
open Module
variable {F E : Type*} [CommRing F] [Ring E] [Algebra F E]
@[simp]
theorem Subalgebra.rank_toSubmodule (S : Subalgebra F E) :
Module.rank F (Subalgebra.toSubmodule S) = Module.rank F S :=
rfl
#align subalgebra.rank_to_submodule Subalgebra.rank_toSubmodule
@[simp]
theorem Subalgebra.finrank_toSubmodule (S : Subalgebra F E) :
finrank F (Subalgebra.toSubmodule S) = finrank F S :=
rfl
#align subalgebra.finrank_to_submodule Subalgebra.finrank_toSubmodule
theorem subalgebra_top_rank_eq_submodule_top_rank :
Module.rank F (⊤ : Subalgebra F E) = Module.rank F (⊤ : Submodule F E) := by
rw [← Algebra.top_toSubmodule]
rfl
#align subalgebra_top_rank_eq_submodule_top_rank subalgebra_top_rank_eq_submodule_top_rank
theorem subalgebra_top_finrank_eq_submodule_top_finrank :
finrank F (⊤ : Subalgebra F E) = finrank F (⊤ : Submodule F E) := by
rw [← Algebra.top_toSubmodule]
rfl
#align subalgebra_top_finrank_eq_submodule_top_finrank subalgebra_top_finrank_eq_submodule_top_finrank
| Mathlib/LinearAlgebra/Dimension/Constructions.lean | 550 | 552 | theorem Subalgebra.rank_top : Module.rank F (⊤ : Subalgebra F E) = Module.rank F E := by
rw [subalgebra_top_rank_eq_submodule_top_rank] |
rw [subalgebra_top_rank_eq_submodule_top_rank]
exact _root_.rank_top F E
| true |
import Mathlib.Data.Fintype.Card
import Mathlib.Order.UpperLower.Basic
#align_import combinatorics.set_family.intersecting from "leanprover-community/mathlib"@"d90e4e186f1d18e375dcd4e5b5f6364b01cb3e46"
open Finset
variable {α : Type*}
namespace Set
section SemilatticeInf
variable [SemilatticeInf α] [OrderBot α] {s t : Set α} {a b c : α}
def Intersecting (s : Set α) : Prop :=
∀ ⦃a⦄, a ∈ s → ∀ ⦃b⦄, b ∈ s → ¬Disjoint a b
#align set.intersecting Set.Intersecting
@[mono]
theorem Intersecting.mono (h : t ⊆ s) (hs : s.Intersecting) : t.Intersecting := fun _a ha _b hb =>
hs (h ha) (h hb)
#align set.intersecting.mono Set.Intersecting.mono
theorem Intersecting.not_bot_mem (hs : s.Intersecting) : ⊥ ∉ s := fun h => hs h h disjoint_bot_left
#align set.intersecting.not_bot_mem Set.Intersecting.not_bot_mem
theorem Intersecting.ne_bot (hs : s.Intersecting) (ha : a ∈ s) : a ≠ ⊥ :=
ne_of_mem_of_not_mem ha hs.not_bot_mem
#align set.intersecting.ne_bot Set.Intersecting.ne_bot
theorem intersecting_empty : (∅ : Set α).Intersecting := fun _ => False.elim
#align set.intersecting_empty Set.intersecting_empty
@[simp]
theorem intersecting_singleton : ({a} : Set α).Intersecting ↔ a ≠ ⊥ := by simp [Intersecting]
#align set.intersecting_singleton Set.intersecting_singleton
protected theorem Intersecting.insert (hs : s.Intersecting) (ha : a ≠ ⊥)
(h : ∀ b ∈ s, ¬Disjoint a b) : (insert a s).Intersecting := by
rintro b (rfl | hb) c (rfl | hc)
· rwa [disjoint_self]
· exact h _ hc
· exact fun H => h _ hb H.symm
· exact hs hb hc
#align set.intersecting.insert Set.Intersecting.insert
theorem intersecting_insert :
(insert a s).Intersecting ↔ s.Intersecting ∧ a ≠ ⊥ ∧ ∀ b ∈ s, ¬Disjoint a b :=
⟨fun h =>
⟨h.mono <| subset_insert _ _, h.ne_bot <| mem_insert _ _, fun _b hb =>
h (mem_insert _ _) <| mem_insert_of_mem _ hb⟩,
fun h => h.1.insert h.2.1 h.2.2⟩
#align set.intersecting_insert Set.intersecting_insert
theorem intersecting_iff_pairwise_not_disjoint :
s.Intersecting ↔ (s.Pairwise fun a b => ¬Disjoint a b) ∧ s ≠ {⊥} := by
refine ⟨fun h => ⟨fun a ha b hb _ => h ha hb, ?_⟩, fun h a ha b hb hab => ?_⟩
· rintro rfl
exact intersecting_singleton.1 h rfl
have := h.1.eq ha hb (Classical.not_not.2 hab)
rw [this, disjoint_self] at hab
rw [hab] at hb
exact
h.2
(eq_singleton_iff_unique_mem.2
⟨hb, fun c hc => not_ne_iff.1 fun H => h.1 hb hc H.symm disjoint_bot_left⟩)
#align set.intersecting_iff_pairwise_not_disjoint Set.intersecting_iff_pairwise_not_disjoint
protected theorem Subsingleton.intersecting (hs : s.Subsingleton) : s.Intersecting ↔ s ≠ {⊥} :=
intersecting_iff_pairwise_not_disjoint.trans <| and_iff_right <| hs.pairwise _
#align set.subsingleton.intersecting Set.Subsingleton.intersecting
theorem intersecting_iff_eq_empty_of_subsingleton [Subsingleton α] (s : Set α) :
s.Intersecting ↔ s = ∅ := by
refine
subsingleton_of_subsingleton.intersecting.trans
⟨not_imp_comm.2 fun h => subsingleton_of_subsingleton.eq_singleton_of_mem ?_, ?_⟩
· obtain ⟨a, ha⟩ := nonempty_iff_ne_empty.2 h
rwa [Subsingleton.elim ⊥ a]
· rintro rfl
exact (Set.singleton_nonempty _).ne_empty.symm
#align set.intersecting_iff_eq_empty_of_subsingleton Set.intersecting_iff_eq_empty_of_subsingleton
protected theorem Intersecting.isUpperSet (hs : s.Intersecting)
(h : ∀ t : Set α, t.Intersecting → s ⊆ t → s = t) : IsUpperSet s := by
classical
rintro a b hab ha
rw [h (Insert.insert b s) _ (subset_insert _ _)]
· exact mem_insert _ _
exact
hs.insert (mt (eq_bot_mono hab) <| hs.ne_bot ha) fun c hc hbc => hs ha hc <| hbc.mono_left hab
#align set.intersecting.is_upper_set Set.Intersecting.isUpperSet
| Mathlib/Combinatorics/SetFamily/Intersecting.lean | 122 | 130 | theorem Intersecting.isUpperSet' {s : Finset α} (hs : (s : Set α).Intersecting)
(h : ∀ t : Finset α, (t : Set α).Intersecting → s ⊆ t → s = t) : IsUpperSet (s : Set α) := by
classical |
classical
rintro a b hab ha
rw [h (Insert.insert b s) _ (Finset.subset_insert _ _)]
· exact mem_insert_self _ _
rw [coe_insert]
exact
hs.insert (mt (eq_bot_mono hab) <| hs.ne_bot ha) fun c hc hbc => hs ha hc <| hbc.mono_left hab
| true |
import Mathlib.Topology.Algebra.InfiniteSum.Group
import Mathlib.Logic.Encodable.Lattice
noncomputable section
open Filter Finset Function Encodable
open scoped Topology
variable {M : Type*} [CommMonoid M] [TopologicalSpace M] {m m' : M}
variable {G : Type*} [CommGroup G] {g g' : G}
-- don't declare [TopologicalAddGroup G] here as some results require [UniformAddGroup G] instead
section Nat
section Monoid
namespace HasProd
@[to_additive "If `f : ℕ → M` has sum `m`, then the partial sums `∑ i ∈ range n, f i` converge
to `m`."]
theorem tendsto_prod_nat {f : ℕ → M} (h : HasProd f m) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) :=
h.comp tendsto_finset_range
#align has_sum.tendsto_sum_nat HasSum.tendsto_sum_nat
@[to_additive "If `f : ℕ → M` is summable, then the partial sums `∑ i ∈ range n, f i` converge
to `∑' i, f i`."]
theorem Multipliable.tendsto_prod_tprod_nat {f : ℕ → M} (h : Multipliable f) :
Tendsto (fun n ↦ ∏ i ∈ range n, f i) atTop (𝓝 (∏' i, f i)) :=
tendsto_prod_nat h.hasProd
namespace Multipliable
@[to_additive]
| Mathlib/Topology/Algebra/InfiniteSum/NatInt.lean | 88 | 92 | theorem hasProd_iff_tendsto_nat [T2Space M] {f : ℕ → M} (hf : Multipliable f) :
HasProd f m ↔ Tendsto (fun n : ℕ ↦ ∏ i ∈ range n, f i) atTop (𝓝 m) := by
refine ⟨fun h ↦ h.tendsto_prod_nat, fun h ↦ ?_⟩ |
refine ⟨fun h ↦ h.tendsto_prod_nat, fun h ↦ ?_⟩
rw [tendsto_nhds_unique h hf.hasProd.tendsto_prod_nat]
exact hf.hasProd
| true |
namespace Nat
@[reducible] def Coprime (m n : Nat) : Prop := gcd m n = 1
instance (m n : Nat) : Decidable (Coprime m n) := inferInstanceAs (Decidable (_ = 1))
theorem coprime_iff_gcd_eq_one : Coprime m n ↔ gcd m n = 1 := .rfl
theorem Coprime.gcd_eq_one : Coprime m n → gcd m n = 1 := id
theorem Coprime.symm : Coprime n m → Coprime m n := (gcd_comm m n).trans
theorem coprime_comm : Coprime n m ↔ Coprime m n := ⟨Coprime.symm, Coprime.symm⟩
theorem Coprime.dvd_of_dvd_mul_right (H1 : Coprime k n) (H2 : k ∣ m * n) : k ∣ m := by
let t := dvd_gcd (Nat.dvd_mul_left k m) H2
rwa [gcd_mul_left, H1.gcd_eq_one, Nat.mul_one] at t
theorem Coprime.dvd_of_dvd_mul_left (H1 : Coprime k m) (H2 : k ∣ m * n) : k ∣ n :=
H1.dvd_of_dvd_mul_right (by rwa [Nat.mul_comm])
theorem Coprime.gcd_mul_left_cancel (m : Nat) (H : Coprime k n) : gcd (k * m) n = gcd m n :=
have H1 : Coprime (gcd (k * m) n) k := by
rw [Coprime, Nat.gcd_assoc, H.symm.gcd_eq_one, gcd_one_right]
Nat.dvd_antisymm
(dvd_gcd (H1.dvd_of_dvd_mul_left (gcd_dvd_left _ _)) (gcd_dvd_right _ _))
(gcd_dvd_gcd_mul_left _ _ _)
theorem Coprime.gcd_mul_right_cancel (m : Nat) (H : Coprime k n) : gcd (m * k) n = gcd m n := by
rw [Nat.mul_comm m k, H.gcd_mul_left_cancel m]
theorem Coprime.gcd_mul_left_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (k * n) = gcd m n := by
rw [gcd_comm m n, gcd_comm m (k * n), H.gcd_mul_left_cancel n]
theorem Coprime.gcd_mul_right_cancel_right (n : Nat)
(H : Coprime k m) : gcd m (n * k) = gcd m n := by
rw [Nat.mul_comm n k, H.gcd_mul_left_cancel_right n]
theorem coprime_div_gcd_div_gcd
(H : 0 < gcd m n) : Coprime (m / gcd m n) (n / gcd m n) := by
rw [coprime_iff_gcd_eq_one, gcd_div (gcd_dvd_left m n) (gcd_dvd_right m n), Nat.div_self H]
theorem not_coprime_of_dvd_of_dvd (dgt1 : 1 < d) (Hm : d ∣ m) (Hn : d ∣ n) : ¬ Coprime m n :=
fun co => Nat.not_le_of_gt dgt1 <| Nat.le_of_dvd Nat.zero_lt_one <| by
rw [← co.gcd_eq_one]; exact dvd_gcd Hm Hn
theorem exists_coprime (m n : Nat) :
∃ m' n', Coprime m' n' ∧ m = m' * gcd m n ∧ n = n' * gcd m n := by
cases eq_zero_or_pos (gcd m n) with
| inl h0 =>
rw [gcd_eq_zero_iff] at h0
refine ⟨1, 1, gcd_one_left 1, ?_⟩
simp [h0]
| inr hpos =>
exact ⟨_, _, coprime_div_gcd_div_gcd hpos,
(Nat.div_mul_cancel (gcd_dvd_left m n)).symm,
(Nat.div_mul_cancel (gcd_dvd_right m n)).symm⟩
theorem exists_coprime' (H : 0 < gcd m n) :
∃ g m' n', 0 < g ∧ Coprime m' n' ∧ m = m' * g ∧ n = n' * g :=
let ⟨m', n', h⟩ := exists_coprime m n; ⟨_, m', n', H, h⟩
theorem Coprime.mul (H1 : Coprime m k) (H2 : Coprime n k) : Coprime (m * n) k :=
(H1.gcd_mul_left_cancel n).trans H2
theorem Coprime.mul_right (H1 : Coprime k m) (H2 : Coprime k n) : Coprime k (m * n) :=
(H1.symm.mul H2.symm).symm
theorem Coprime.coprime_dvd_left (H1 : m ∣ k) (H2 : Coprime k n) : Coprime m n := by
apply eq_one_of_dvd_one
rw [Coprime] at H2
have := Nat.gcd_dvd_gcd_of_dvd_left n H1
rwa [← H2]
theorem Coprime.coprime_dvd_right (H1 : n ∣ m) (H2 : Coprime k m) : Coprime k n :=
(H2.symm.coprime_dvd_left H1).symm
theorem Coprime.coprime_mul_left (H : Coprime (k * m) n) : Coprime m n :=
H.coprime_dvd_left (Nat.dvd_mul_left _ _)
theorem Coprime.coprime_mul_right (H : Coprime (m * k) n) : Coprime m n :=
H.coprime_dvd_left (Nat.dvd_mul_right _ _)
theorem Coprime.coprime_mul_left_right (H : Coprime m (k * n)) : Coprime m n :=
H.coprime_dvd_right (Nat.dvd_mul_left _ _)
theorem Coprime.coprime_mul_right_right (H : Coprime m (n * k)) : Coprime m n :=
H.coprime_dvd_right (Nat.dvd_mul_right _ _)
| .lake/packages/batteries/Batteries/Data/Nat/Gcd.lean | 108 | 118 | theorem Coprime.coprime_div_left (cmn : Coprime m n) (dvd : a ∣ m) : Coprime (m / a) n := by
match eq_zero_or_pos a with |
match eq_zero_or_pos a with
| .inl h0 =>
rw [h0] at dvd
rw [Nat.eq_zero_of_zero_dvd dvd] at cmn ⊢
simp; assumption
| .inr hpos =>
let ⟨k, hk⟩ := dvd
rw [hk, Nat.mul_div_cancel_left _ hpos]
rw [hk] at cmn
exact cmn.coprime_mul_left
| true |
import Mathlib.CategoryTheory.Preadditive.Yoneda.Basic
import Mathlib.CategoryTheory.Preadditive.Injective
import Mathlib.Algebra.Category.GroupCat.EpiMono
import Mathlib.Algebra.Category.ModuleCat.EpiMono
#align_import category_theory.preadditive.yoneda.injective from "leanprover-community/mathlib"@"f8d8465c3c392a93b9ed226956e26dee00975946"
universe v u
open Opposite
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
section Preadditive
variable [Preadditive C]
namespace Injective
theorem injective_iff_preservesEpimorphisms_preadditiveYoneda_obj (J : C) :
Injective J ↔ (preadditiveYoneda.obj J).PreservesEpimorphisms := by
rw [injective_iff_preservesEpimorphisms_yoneda_obj]
refine
⟨fun h : (preadditiveYoneda.obj J ⋙ (forget AddCommGroupCat)).PreservesEpimorphisms => ?_, ?_⟩
· exact
Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveYoneda.obj J) (forget _)
· intro
exact (inferInstance : (preadditiveYoneda.obj J ⋙ forget _).PreservesEpimorphisms)
#align category_theory.injective.injective_iff_preserves_epimorphisms_preadditive_yoneda_obj CategoryTheory.Injective.injective_iff_preservesEpimorphisms_preadditiveYoneda_obj
| Mathlib/CategoryTheory/Preadditive/Yoneda/Injective.lean | 43 | 51 | theorem injective_iff_preservesEpimorphisms_preadditive_yoneda_obj' (J : C) :
Injective J ↔ (preadditiveYonedaObj J).PreservesEpimorphisms := by
rw [injective_iff_preservesEpimorphisms_yoneda_obj] |
rw [injective_iff_preservesEpimorphisms_yoneda_obj]
refine ⟨fun h : (preadditiveYonedaObj J ⋙ (forget <| ModuleCat (End J))).PreservesEpimorphisms =>
?_, ?_⟩
· exact
Functor.preservesEpimorphisms_of_preserves_of_reflects (preadditiveYonedaObj J) (forget _)
· intro
exact (inferInstance : (preadditiveYonedaObj J ⋙ forget _).PreservesEpimorphisms)
| true |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv
#align_import analysis.special_functions.trigonometric.inverse_deriv from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical Topology Filter
open Set Filter
open scoped Real
namespace Real
section Arcsin
theorem deriv_arcsin_aux {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x ∧ ContDiffAt ℝ ⊤ arcsin x := by
cases' h₁.lt_or_lt with h₁ h₁
· have : 1 - x ^ 2 < 0 := by nlinarith [h₁]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => -(π / 2) :=
(gt_mem_nhds h₁).mono fun y hy => arcsin_of_le_neg_one hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
cases' h₂.lt_or_lt with h₂ h₂
· have : 0 < √(1 - x ^ 2) := sqrt_pos.2 (by nlinarith [h₁, h₂])
simp only [← cos_arcsin, one_div] at this ⊢
exact ⟨sinPartialHomeomorph.hasStrictDerivAt_symm ⟨h₁, h₂⟩ this.ne' (hasStrictDerivAt_sin _),
sinPartialHomeomorph.contDiffAt_symm_deriv this.ne' ⟨h₁, h₂⟩ (hasDerivAt_sin _)
contDiff_sin.contDiffAt⟩
· have : 1 - x ^ 2 < 0 := by nlinarith [h₂]
rw [sqrt_eq_zero'.2 this.le, div_zero]
have : arcsin =ᶠ[𝓝 x] fun _ => π / 2 := (lt_mem_nhds h₂).mono fun y hy => arcsin_of_one_le hy.le
exact ⟨(hasStrictDerivAt_const _ _).congr_of_eventuallyEq this.symm,
contDiffAt_const.congr_of_eventuallyEq this⟩
#align real.deriv_arcsin_aux Real.deriv_arcsin_aux
theorem hasStrictDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasStrictDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(deriv_arcsin_aux h₁ h₂).1
#align real.has_strict_deriv_at_arcsin Real.hasStrictDerivAt_arcsin
theorem hasDerivAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) :
HasDerivAt arcsin (1 / √(1 - x ^ 2)) x :=
(hasStrictDerivAt_arcsin h₁ h₂).hasDerivAt
#align real.has_deriv_at_arcsin Real.hasDerivAt_arcsin
theorem contDiffAt_arcsin {x : ℝ} (h₁ : x ≠ -1) (h₂ : x ≠ 1) {n : ℕ∞} : ContDiffAt ℝ n arcsin x :=
(deriv_arcsin_aux h₁ h₂).2.of_le le_top
#align real.cont_diff_at_arcsin Real.contDiffAt_arcsin
| Mathlib/Analysis/SpecialFunctions/Trigonometric/InverseDeriv.lean | 66 | 71 | theorem hasDerivWithinAt_arcsin_Ici {x : ℝ} (h : x ≠ -1) :
HasDerivWithinAt arcsin (1 / √(1 - x ^ 2)) (Ici x) x := by
rcases eq_or_ne x 1 with (rfl | h') |
rcases eq_or_ne x 1 with (rfl | h')
· convert (hasDerivWithinAt_const (1 : ℝ) _ (π / 2)).congr _ _ <;>
simp (config := { contextual := true }) [arcsin_of_one_le]
· exact (hasDerivAt_arcsin h h').hasDerivWithinAt
| true |
import Mathlib.Data.PNat.Prime
import Mathlib.Algebra.IsPrimePow
import Mathlib.NumberTheory.Cyclotomic.Basic
import Mathlib.RingTheory.Adjoin.PowerBasis
import Mathlib.RingTheory.Polynomial.Cyclotomic.Eval
import Mathlib.RingTheory.Norm
import Mathlib.RingTheory.Polynomial.Cyclotomic.Expand
#align_import number_theory.cyclotomic.primitive_roots from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
open Polynomial Algebra Finset FiniteDimensional IsCyclotomicExtension Nat PNat Set
open scoped IntermediateField
universe u v w z
variable {p n : ℕ+} (A : Type w) (B : Type z) (K : Type u) {L : Type v} (C : Type w)
variable [CommRing A] [CommRing B] [Algebra A B] [IsCyclotomicExtension {n} A B]
section Zeta
namespace IsCyclotomicExtension
variable (n)
noncomputable def zeta : B :=
(exists_prim_root A <| Set.mem_singleton n : ∃ r : B, IsPrimitiveRoot r n).choose
#align is_cyclotomic_extension.zeta IsCyclotomicExtension.zeta
@[simp]
theorem zeta_spec : IsPrimitiveRoot (zeta n A B) n :=
Classical.choose_spec (exists_prim_root A (Set.mem_singleton n) : ∃ r : B, IsPrimitiveRoot r n)
#align is_cyclotomic_extension.zeta_spec IsCyclotomicExtension.zeta_spec
theorem aeval_zeta [IsDomain B] [NeZero ((n : ℕ) : B)] :
aeval (zeta n A B) (cyclotomic n A) = 0 := by
rw [aeval_def, ← eval_map, ← IsRoot.def, map_cyclotomic, isRoot_cyclotomic_iff]
exact zeta_spec n A B
#align is_cyclotomic_extension.aeval_zeta IsCyclotomicExtension.aeval_zeta
| Mathlib/NumberTheory/Cyclotomic/PrimitiveRoots.lean | 98 | 100 | theorem zeta_isRoot [IsDomain B] [NeZero ((n : ℕ) : B)] : IsRoot (cyclotomic n B) (zeta n A B) := by
convert aeval_zeta n A B using 0 |
convert aeval_zeta n A B using 0
rw [IsRoot.def, aeval_def, eval₂_eq_eval_map, map_cyclotomic]
| true |
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where
toFun a :=
{ DistribMulAction.toLinearEquiv ℝ ℂ a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by
ext1
simp
#align rotation_trans rotation_trans
| Mathlib/Analysis/Complex/Isometry.lean | 65 | 71 | theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by
intro h |
intro h
have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1
have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I
rw [rotation_apply, RingHom.map_one, mul_one] at h1
rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI
exact one_ne_zero hI
| true |
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
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]
#align ring_of_integers.is_unit_norm_of_is_galois RingOfIntegers.isUnit_norm_of_isGalois
| Mathlib/NumberTheory/NumberField/Norm.lean | 90 | 99 | theorem dvd_norm [IsGalois K L] (x : 𝓞 L) : x ∣ algebraMap (𝓞 K) (𝓞 L) (norm K x) := by
classical |
classical
have hint :
IsIntegral ℤ (∏ σ ∈ univ.erase (AlgEquiv.refl : L ≃ₐ[K] L), σ x) :=
IsIntegral.prod _ (fun σ _ =>
((RingOfIntegers.isIntegral_coe x).map σ))
refine ⟨⟨_, hint⟩, ?_⟩
ext
rw [coe_algebraMap_norm K x, norm_eq_prod_automorphisms]
simp [← Finset.mul_prod_erase _ _ (mem_univ AlgEquiv.refl)]
| true |
import Mathlib.Data.Nat.Factorization.Basic
import Mathlib.Data.SetLike.Fintype
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.PGroup
import Mathlib.GroupTheory.NoncommPiCoprod
import Mathlib.Order.Atoms.Finite
import Mathlib.Data.Set.Lattice
#align_import group_theory.sylow from "leanprover-community/mathlib"@"4be589053caf347b899a494da75410deb55fb3ef"
open Fintype MulAction Subgroup
section InfiniteSylow
variable (p : ℕ) (G : Type*) [Group G]
structure Sylow extends Subgroup G where
isPGroup' : IsPGroup p toSubgroup
is_maximal' : ∀ {Q : Subgroup G}, IsPGroup p Q → toSubgroup ≤ Q → Q = toSubgroup
#align sylow Sylow
variable {p} {G}
open Equiv Equiv.Perm Finset Function List QuotientGroup
universe u v w
variable {G : Type u} {α : Type v} {β : Type w} [Group G]
attribute [local instance 10] Subtype.fintype setFintype Classical.propDecidable
theorem QuotientGroup.card_preimage_mk [Fintype G] (s : Subgroup G) (t : Set (G ⧸ s)) :
Fintype.card (QuotientGroup.mk ⁻¹' t) = Fintype.card s * Fintype.card t := by
rw [← Fintype.card_prod, Fintype.card_congr (preimageMkEquivSubgroupProdSet _ _)]
#align quotient_group.card_preimage_mk QuotientGroup.card_preimage_mk
namespace Sylow
theorem mem_fixedPoints_mul_left_cosets_iff_mem_normalizer {H : Subgroup G} [Finite (H : Set G)]
{x : G} : (x : G ⧸ H) ∈ MulAction.fixedPoints H (G ⧸ H) ↔ x ∈ normalizer H :=
⟨fun hx =>
have ha : ∀ {y : G ⧸ H}, y ∈ orbit H (x : G ⧸ H) → y = x := mem_fixedPoints'.1 hx _
(inv_mem_iff (G := G)).1
(mem_normalizer_fintype fun n (hn : n ∈ H) =>
have : (n⁻¹ * x)⁻¹ * x ∈ H := QuotientGroup.eq.1 (ha ⟨⟨n⁻¹, inv_mem hn⟩, rfl⟩)
show _ ∈ H by
rw [mul_inv_rev, inv_inv] at this
convert this
rw [inv_inv]),
fun hx : ∀ n : G, n ∈ H ↔ x * n * x⁻¹ ∈ H =>
mem_fixedPoints'.2 fun y =>
Quotient.inductionOn' y fun y hy =>
QuotientGroup.eq.2
(let ⟨⟨b, hb₁⟩, hb₂⟩ := hy
have hb₂ : (b * x)⁻¹ * y ∈ H := QuotientGroup.eq.1 hb₂
(inv_mem_iff (G := G)).1 <|
(hx _).2 <|
(mul_mem_cancel_left (inv_mem hb₁)).1 <| by
rw [hx] at hb₂; simpa [mul_inv_rev, mul_assoc] using hb₂)⟩
#align sylow.mem_fixed_points_mul_left_cosets_iff_mem_normalizer Sylow.mem_fixedPoints_mul_left_cosets_iff_mem_normalizer
def fixedPointsMulLeftCosetsEquivQuotient (H : Subgroup G) [Finite (H : Set G)] :
MulAction.fixedPoints H (G ⧸ H) ≃
normalizer H ⧸ Subgroup.comap ((normalizer H).subtype : normalizer H →* G) H :=
@subtypeQuotientEquivQuotientSubtype G (normalizer H : Set G) (_) (_)
(MulAction.fixedPoints H (G ⧸ H))
(fun a => (@mem_fixedPoints_mul_left_cosets_iff_mem_normalizer _ _ _ ‹_› _).symm)
(by
intros
unfold_projs
rw [leftRel_apply (α := normalizer H), leftRel_apply]
rfl)
#align sylow.fixed_points_mul_left_cosets_equiv_quotient Sylow.fixedPointsMulLeftCosetsEquivQuotient
theorem card_quotient_normalizer_modEq_card_quotient [Fintype G] {p : ℕ} {n : ℕ} [hp : Fact p.Prime]
{H : Subgroup G} (hH : Fintype.card H = p ^ n) :
Fintype.card (normalizer H ⧸ Subgroup.comap ((normalizer H).subtype : normalizer H →* G) H) ≡
card (G ⧸ H) [MOD p] := by
rw [← Fintype.card_congr (fixedPointsMulLeftCosetsEquivQuotient H)]
exact ((IsPGroup.of_card hH).card_modEq_card_fixedPoints _).symm
#align sylow.card_quotient_normalizer_modeq_card_quotient Sylow.card_quotient_normalizer_modEq_card_quotient
| Mathlib/GroupTheory/Sylow.lean | 548 | 556 | theorem card_normalizer_modEq_card [Fintype G] {p : ℕ} {n : ℕ} [hp : Fact p.Prime] {H : Subgroup G}
(hH : Fintype.card H = p ^ n) : card (normalizer H) ≡ card G [MOD p ^ (n + 1)] := by
have : H.subgroupOf (normalizer H) ≃ H := (subgroupOfEquivOfLe le_normalizer).toEquiv |
have : H.subgroupOf (normalizer H) ≃ H := (subgroupOfEquivOfLe le_normalizer).toEquiv
simp only [← Nat.card_eq_fintype_card] at hH ⊢
rw [card_eq_card_quotient_mul_card_subgroup H,
card_eq_card_quotient_mul_card_subgroup (H.subgroupOf (normalizer H)), Nat.card_congr this,
hH, pow_succ']
simp only [Nat.card_eq_fintype_card] at hH ⊢
exact (card_quotient_normalizer_modEq_card_quotient hH).mul_right' _
| true |
import Mathlib.Data.Nat.Cast.WithTop
import Mathlib.RingTheory.Prime
import Mathlib.RingTheory.Polynomial.Content
import Mathlib.RingTheory.Ideal.Quotient
#align_import ring_theory.eisenstein_criterion from "leanprover-community/mathlib"@"da420a8c6dd5bdfb85c4ced85c34388f633bc6ff"
open Polynomial Ideal.Quotient
variable {R : Type*} [CommRing R]
namespace Polynomial
open Polynomial
namespace EisensteinCriterionAux
-- Section for auxiliary lemmas used in the proof of `irreducible_of_eisenstein_criterion`
theorem map_eq_C_mul_X_pow_of_forall_coeff_mem {f : R[X]} {P : Ideal R}
(hfP : ∀ n : ℕ, ↑n < f.degree → f.coeff n ∈ P) :
map (mk P) f = C ((mk P) f.leadingCoeff) * X ^ f.natDegree :=
Polynomial.ext fun n => by
by_cases hf0 : f = 0
· simp [hf0]
rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h)
· erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg,
mul_zero]
rintro rfl
exact not_lt_of_ge degree_le_natDegree h
· have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm
rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map]
· rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt]
· refine lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) ?_
rwa [← degree_eq_natDegree hf0]
· exact lt_of_le_of_lt (degree_map_le _ _) h
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.map_eq_C_mul_X_pow_of_forall_coeff_mem Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem
theorem le_natDegree_of_map_eq_mul_X_pow {n : ℕ} {P : Ideal R} (hP : P.IsPrime) {q : R[X]}
{c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hc0 : c.degree = 0) :
n ≤ q.natDegree :=
Nat.cast_le.1
(calc
↑n = degree (q.map (mk P)) := by
rw [hq, degree_mul, hc0, zero_add, degree_pow, degree_X, nsmul_one]
_ ≤ degree q := degree_map_le _ _
_ ≤ natDegree q := degree_le_natDegree
)
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.le_nat_degree_of_map_eq_mul_X_pow Polynomial.EisensteinCriterionAux.le_natDegree_of_map_eq_mul_X_pow
theorem eval_zero_mem_ideal_of_eq_mul_X_pow {n : ℕ} {P : Ideal R} {q : R[X]}
{c : Polynomial (R ⧸ P)} (hq : map (mk P) q = c * X ^ n) (hn0 : n ≠ 0) : eval 0 q ∈ P := by
rw [← coeff_zero_eq_eval_zero, ← eq_zero_iff_mem, ← coeff_map, hq,
coeff_zero_eq_eval_zero, eval_mul, eval_pow, eval_X, zero_pow hn0, mul_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.eisenstein_criterion_aux.eval_zero_mem_ideal_of_eq_mul_X_pow Polynomial.EisensteinCriterionAux.eval_zero_mem_ideal_of_eq_mul_X_pow
| Mathlib/RingTheory/EisensteinCriterion.lean | 72 | 78 | theorem isUnit_of_natDegree_eq_zero_of_isPrimitive {p q : R[X]}
-- Porting note: stated using `IsPrimitive` which is defeq to old statement.
(hu : IsPrimitive (p * q)) (hpm : p.natDegree = 0) : IsUnit p := by
rw [eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm), isUnit_C] |
rw [eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm), isUnit_C]
refine hu _ ?_
rw [← eq_C_of_degree_le_zero (natDegree_eq_zero_iff_degree_le_zero.1 hpm)]
exact dvd_mul_right _ _
| true |
import Mathlib.Data.Finset.Pointwise
#align_import combinatorics.additive.e_transform from "leanprover-community/mathlib"@"207c92594599a06e7c134f8d00a030a83e6c7259"
open MulOpposite
open Pointwise
variable {α : Type*} [DecidableEq α]
namespace Finset
section CommGroup
variable [CommGroup α] (e : α) (x : Finset α × Finset α)
@[to_additive (attr := simps) "The **Dyson e-transform**.
Turns `(s, t)` into `(s ∪ e +ᵥ t, t ∩ -e +ᵥ s)`. This reduces the sum of the two sets."]
def mulDysonETransform : Finset α × Finset α :=
(x.1 ∪ e • x.2, x.2 ∩ e⁻¹ • x.1)
#align finset.mul_dyson_e_transform Finset.mulDysonETransform
#align finset.add_dyson_e_transform Finset.addDysonETransform
@[to_additive]
theorem mulDysonETransform.subset :
(mulDysonETransform e x).1 * (mulDysonETransform e x).2 ⊆ x.1 * x.2 := by
refine union_mul_inter_subset_union.trans (union_subset Subset.rfl ?_)
rw [mul_smul_comm, smul_mul_assoc, inv_smul_smul, mul_comm]
#align finset.mul_dyson_e_transform.subset Finset.mulDysonETransform.subset
#align finset.add_dyson_e_transform.subset Finset.addDysonETransform.subset
@[to_additive]
theorem mulDysonETransform.card :
(mulDysonETransform e x).1.card + (mulDysonETransform e x).2.card = x.1.card + x.2.card := by
dsimp
rw [← card_smul_finset e (_ ∩ _), smul_finset_inter, smul_inv_smul, inter_comm,
card_union_add_card_inter, card_smul_finset]
#align finset.mul_dyson_e_transform.card Finset.mulDysonETransform.card
#align finset.add_dyson_e_transform.card Finset.addDysonETransform.card
@[to_additive (attr := simp)]
theorem mulDysonETransform_idem :
mulDysonETransform e (mulDysonETransform e x) = mulDysonETransform e x := by
ext : 1 <;> dsimp
· rw [smul_finset_inter, smul_inv_smul, inter_comm, union_eq_left]
exact inter_subset_union
· rw [smul_finset_union, inv_smul_smul, union_comm, inter_eq_left]
exact inter_subset_union
#align finset.mul_dyson_e_transform_idem Finset.mulDysonETransform_idem
#align finset.add_dyson_e_transform_idem Finset.addDysonETransform_idem
variable {e x}
@[to_additive]
| Mathlib/Combinatorics/Additive/ETransform.lean | 88 | 92 | theorem mulDysonETransform.smul_finset_snd_subset_fst :
e • (mulDysonETransform e x).2 ⊆ (mulDysonETransform e x).1 := by
dsimp |
dsimp
rw [smul_finset_inter, smul_inv_smul, inter_comm]
exact inter_subset_union
| true |
import Mathlib.Logic.Relation
import Mathlib.Data.List.Forall2
import Mathlib.Data.List.Lex
import Mathlib.Data.List.Infix
#align_import data.list.chain from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
-- Make sure we haven't imported `Data.Nat.Order.Basic`
assert_not_exists OrderedSub
universe u v
open Nat
namespace List
variable {α : Type u} {β : Type v} {R r : α → α → Prop} {l l₁ l₂ : List α} {a b : α}
mk_iff_of_inductive_prop List.Chain List.chain_iff
#align list.chain_iff List.chain_iff
#align list.chain.nil List.Chain.nil
#align list.chain.cons List.Chain.cons
#align list.rel_of_chain_cons List.rel_of_chain_cons
#align list.chain_of_chain_cons List.chain_of_chain_cons
#align list.chain.imp' List.Chain.imp'
#align list.chain.imp List.Chain.imp
theorem Chain.iff {S : α → α → Prop} (H : ∀ a b, R a b ↔ S a b) {a : α} {l : List α} :
Chain R a l ↔ Chain S a l :=
⟨Chain.imp fun a b => (H a b).1, Chain.imp fun a b => (H a b).2⟩
#align list.chain.iff List.Chain.iff
theorem Chain.iff_mem {a : α} {l : List α} :
Chain R a l ↔ Chain (fun x y => x ∈ a :: l ∧ y ∈ l ∧ R x y) a l :=
⟨fun p => by
induction' p with _ a b l r _ IH <;> constructor <;>
[exact ⟨mem_cons_self _ _, mem_cons_self _ _, r⟩;
exact IH.imp fun a b ⟨am, bm, h⟩ => ⟨mem_cons_of_mem _ am, mem_cons_of_mem _ bm, h⟩],
Chain.imp fun a b h => h.2.2⟩
#align list.chain.iff_mem List.Chain.iff_mem
theorem chain_singleton {a b : α} : Chain R a [b] ↔ R a b := by
simp only [chain_cons, Chain.nil, and_true_iff]
#align list.chain_singleton List.chain_singleton
theorem chain_split {a b : α} {l₁ l₂ : List α} :
Chain R a (l₁ ++ b :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ Chain R b l₂ := by
induction' l₁ with x l₁ IH generalizing a <;>
simp only [*, nil_append, cons_append, Chain.nil, chain_cons, and_true_iff, and_assoc]
#align list.chain_split List.chain_split
@[simp]
theorem chain_append_cons_cons {a b c : α} {l₁ l₂ : List α} :
Chain R a (l₁ ++ b :: c :: l₂) ↔ Chain R a (l₁ ++ [b]) ∧ R b c ∧ Chain R c l₂ := by
rw [chain_split, chain_cons]
#align list.chain_append_cons_cons List.chain_append_cons_cons
theorem chain_iff_forall₂ :
∀ {a : α} {l : List α}, Chain R a l ↔ l = [] ∨ Forall₂ R (a :: dropLast l) l
| a, [] => by simp
| a, b :: l => by
by_cases h : l = [] <;>
simp [@chain_iff_forall₂ b l, dropLast, *]
#align list.chain_iff_forall₂ List.chain_iff_forall₂
| Mathlib/Data/List/Chain.lean | 82 | 83 | theorem chain_append_singleton_iff_forall₂ :
Chain R a (l ++ [b]) ↔ Forall₂ R (a :: l) (l ++ [b]) := by | simp [chain_iff_forall₂]
| true |
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
set_option linter.uppercaseLean3 false
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
variable (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C]
structure Mon_ where
X : C
one : 𝟙_ C ⟶ X
mul : X ⊗ X ⟶ X
one_mul : (one ▷ X) ≫ mul = (λ_ X).hom := by aesop_cat
mul_one : (X ◁ one) ≫ mul = (ρ_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul ▷ X) ≫ mul = (α_ X X X).hom ≫ (X ◁ mul) ≫ mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
attribute [simp] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
@[simps]
def trivial : Mon_ C where
X := 𝟙_ C
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
⟨trivial C⟩
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M.X) : (M.one ⊗ f) ≫ M.mul = (λ_ Z).hom ≫ f := by
rw [tensorHom_def'_assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M.X) : (f ⊗ M.one) ≫ M.mul = (ρ_ Z).hom ≫ f := by
rw [tensorHom_def_assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
| Mathlib/CategoryTheory/Monoidal/Mon_.lean | 84 | 85 | theorem assoc_flip :
(M.X ◁ M.mul) ≫ M.mul = (α_ M.X M.X M.X).inv ≫ (M.mul ▷ M.X) ≫ M.mul := by | simp
| true |
import Mathlib.CategoryTheory.Subobject.Limits
#align_import algebra.homology.image_to_kernel from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u w
open CategoryTheory CategoryTheory.Limits
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [HasZeroMorphisms V]
open scoped Classical
noncomputable section
section
variable {A B C : V} (f : A ⟶ B) [HasImage f] (g : B ⟶ C) [HasKernel g]
theorem image_le_kernel (w : f ≫ g = 0) : imageSubobject f ≤ kernelSubobject g :=
imageSubobject_le_mk _ _ (kernel.lift _ _ w) (by simp)
#align image_le_kernel image_le_kernel
def imageToKernel (w : f ≫ g = 0) : (imageSubobject f : V) ⟶ (kernelSubobject g : V) :=
Subobject.ofLE _ _ (image_le_kernel _ _ w)
#align image_to_kernel imageToKernel
instance (w : f ≫ g = 0) : Mono (imageToKernel f g w) := by
dsimp only [imageToKernel]
infer_instance
@[simp]
theorem subobject_ofLE_as_imageToKernel (w : f ≫ g = 0) (h) :
Subobject.ofLE (imageSubobject f) (kernelSubobject g) h = imageToKernel f g w :=
rfl
#align subobject_of_le_as_image_to_kernel subobject_ofLE_as_imageToKernel
attribute [local instance] ConcreteCategory.instFunLike
-- Porting note: removed elementwise attribute which does not seem to be helpful here
-- a more suitable lemma is added below
@[reassoc (attr := simp)]
theorem imageToKernel_arrow (w : f ≫ g = 0) :
imageToKernel f g w ≫ (kernelSubobject g).arrow = (imageSubobject f).arrow := by
simp [imageToKernel]
#align image_to_kernel_arrow imageToKernel_arrow
@[simp]
lemma imageToKernel_arrow_apply [ConcreteCategory V] (w : f ≫ g = 0)
(x : (forget V).obj (Subobject.underlying.obj (imageSubobject f))) :
(kernelSubobject g).arrow (imageToKernel f g w x) =
(imageSubobject f).arrow x := by
rw [← comp_apply, imageToKernel_arrow]
-- This is less useful as a `simp` lemma than it initially appears,
-- as it "loses" the information the morphism factors through the image.
theorem factorThruImageSubobject_comp_imageToKernel (w : f ≫ g = 0) :
factorThruImageSubobject f ≫ imageToKernel f g w = factorThruKernelSubobject g f w := by
ext
simp
#align factor_thru_image_subobject_comp_image_to_kernel factorThruImageSubobject_comp_imageToKernel
end
section
variable {A B C : V} (f : A ⟶ B) (g : B ⟶ C)
@[simp]
theorem imageToKernel_zero_left [HasKernels V] [HasZeroObject V] {w} :
imageToKernel (0 : A ⟶ B) g w = 0 := by
ext
simp
#align image_to_kernel_zero_left imageToKernel_zero_left
theorem imageToKernel_zero_right [HasImages V] {w} :
imageToKernel f (0 : B ⟶ C) w =
(imageSubobject f).arrow ≫ inv (kernelSubobject (0 : B ⟶ C)).arrow := by
ext
simp
#align image_to_kernel_zero_right imageToKernel_zero_right
section
variable [HasKernels V] [HasImages V]
theorem imageToKernel_comp_right {D : V} (h : C ⟶ D) (w : f ≫ g = 0) :
imageToKernel f (g ≫ h) (by simp [reassoc_of% w]) =
imageToKernel f g w ≫ Subobject.ofLE _ _ (kernelSubobject_comp_le g h) := by
ext
simp
#align image_to_kernel_comp_right imageToKernel_comp_right
theorem imageToKernel_comp_left {Z : V} (h : Z ⟶ A) (w : f ≫ g = 0) :
imageToKernel (h ≫ f) g (by simp [w]) =
Subobject.ofLE _ _ (imageSubobject_comp_le h f) ≫ imageToKernel f g w := by
ext
simp
#align image_to_kernel_comp_left imageToKernel_comp_left
@[simp]
| Mathlib/Algebra/Homology/ImageToKernel.lean | 127 | 132 | theorem imageToKernel_comp_mono {D : V} (h : C ⟶ D) [Mono h] (w) :
imageToKernel f (g ≫ h) w =
imageToKernel f g ((cancel_mono h).mp (by simpa using w : (f ≫ g) ≫ h = 0 ≫ h)) ≫
(Subobject.isoOfEq _ _ (kernelSubobject_comp_mono g h)).inv := by
ext |
ext
simp
| true |
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.MeasureTheory.Measure.Haar.OfBasis
import Mathlib.Probability.Independence.Basic
#align_import probability.density from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open scoped Classical MeasureTheory NNReal ENNReal
open TopologicalSpace MeasureTheory.Measure
noncomputable section
namespace MeasureTheory
variable {Ω E : Type*} [MeasurableSpace E]
class HasPDF {m : MeasurableSpace Ω} (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E := by volume_tac) : Prop where
pdf' : AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ
#align measure_theory.has_pdf MeasureTheory.HasPDF
section HasPDF
variable {_ : MeasurableSpace Ω}
theorem hasPDF_iff {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E} :
HasPDF X ℙ μ ↔ AEMeasurable X ℙ ∧ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ :=
⟨@HasPDF.pdf' _ _ _ _ _ _ _, HasPDF.mk⟩
#align measure_theory.pdf.has_pdf_iff MeasureTheory.hasPDF_iff
theorem hasPDF_iff_of_aemeasurable {X : Ω → E} {ℙ : Measure Ω}
{μ : Measure E} (hX : AEMeasurable X ℙ) :
HasPDF X ℙ μ ↔ (map X ℙ).HaveLebesgueDecomposition μ ∧ map X ℙ ≪ μ := by
rw [hasPDF_iff]
simp only [hX, true_and]
#align measure_theory.pdf.has_pdf_iff_of_measurable MeasureTheory.hasPDF_iff_of_aemeasurable
@[measurability]
theorem HasPDF.aemeasurable (X : Ω → E) (ℙ : Measure Ω)
(μ : Measure E) [hX : HasPDF X ℙ μ] : AEMeasurable X ℙ :=
hX.pdf'.1
#align measure_theory.has_pdf.measurable MeasureTheory.HasPDF.aemeasurable
instance HasPDF.haveLebesgueDecomposition {X : Ω → E} {ℙ : Measure Ω}
{μ : Measure E} [hX : HasPDF X ℙ μ] : (map X ℙ).HaveLebesgueDecomposition μ :=
hX.pdf'.2.1
#align measure_theory.pdf.have_lebesgue_decomposition_of_has_pdf MeasureTheory.HasPDF.haveLebesgueDecomposition
theorem HasPDF.absolutelyContinuous {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
[hX : HasPDF X ℙ μ] : map X ℙ ≪ μ :=
hX.pdf'.2.2
#align measure_theory.pdf.map_absolutely_continuous MeasureTheory.HasPDF.absolutelyContinuous
theorem HasPDF.quasiMeasurePreserving_of_measurable (X : Ω → E) (ℙ : Measure Ω) (μ : Measure E)
[HasPDF X ℙ μ] (h : Measurable X) : QuasiMeasurePreserving X ℙ μ :=
{ measurable := h
absolutelyContinuous := HasPDF.absolutelyContinuous }
#align measure_theory.pdf.to_quasi_measure_preserving MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable
theorem HasPDF.congr {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y)
[hX : HasPDF X ℙ μ] : HasPDF Y ℙ μ :=
⟨(HasPDF.aemeasurable X ℙ μ).congr hXY, ℙ.map_congr hXY ▸ hX.haveLebesgueDecomposition,
ℙ.map_congr hXY ▸ hX.absolutelyContinuous⟩
theorem HasPDF.congr' {X Y : Ω → E} {ℙ : Measure Ω} {μ : Measure E} (hXY : X =ᵐ[ℙ] Y) :
HasPDF X ℙ μ ↔ HasPDF Y ℙ μ :=
⟨fun _ ↦ HasPDF.congr hXY, fun _ ↦ HasPDF.congr hXY.symm⟩
| Mathlib/Probability/Density.lean | 122 | 128 | theorem hasPDF_of_map_eq_withDensity {X : Ω → E} {ℙ : Measure Ω} {μ : Measure E}
(hX : AEMeasurable X ℙ) (f : E → ℝ≥0∞) (hf : AEMeasurable f μ) (h : map X ℙ = μ.withDensity f) :
HasPDF X ℙ μ := by
refine ⟨hX, ?_, ?_⟩ <;> rw [h] |
refine ⟨hX, ?_, ?_⟩ <;> rw [h]
· rw [withDensity_congr_ae hf.ae_eq_mk]
exact haveLebesgueDecomposition_withDensity μ hf.measurable_mk
· exact withDensity_absolutelyContinuous μ f
| true |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Factorial.DoubleFactorial
#align_import ring_theory.polynomial.hermite.basic from "leanprover-community/mathlib"@"938d3db9c278f8a52c0f964a405806f0f2b09b74"
noncomputable section
open Polynomial
namespace Polynomial
noncomputable def hermite : ℕ → Polynomial ℤ
| 0 => 1
| n + 1 => X * hermite n - derivative (hermite n)
#align polynomial.hermite Polynomial.hermite
@[simp]
theorem hermite_succ (n : ℕ) : hermite (n + 1) = X * hermite n - derivative (hermite n) := by
rw [hermite]
#align polynomial.hermite_succ Polynomial.hermite_succ
theorem hermite_eq_iterate (n : ℕ) : hermite n = (fun p => X * p - derivative p)^[n] 1 := by
induction' n with n ih
· rfl
· rw [Function.iterate_succ_apply', ← ih, hermite_succ]
#align polynomial.hermite_eq_iterate Polynomial.hermite_eq_iterate
@[simp]
theorem hermite_zero : hermite 0 = C 1 :=
rfl
#align polynomial.hermite_zero Polynomial.hermite_zero
-- Porting note (#10618): There was initially @[simp] on this line but it was removed
-- because simp can prove this theorem
theorem hermite_one : hermite 1 = X := by
rw [hermite_succ, hermite_zero]
simp only [map_one, mul_one, derivative_one, sub_zero]
#align polynomial.hermite_one Polynomial.hermite_one
section coeff
theorem coeff_hermite_succ_zero (n : ℕ) : coeff (hermite (n + 1)) 0 = -coeff (hermite n) 1 := by
simp [coeff_derivative]
#align polynomial.coeff_hermite_succ_zero Polynomial.coeff_hermite_succ_zero
theorem coeff_hermite_succ_succ (n k : ℕ) : coeff (hermite (n + 1)) (k + 1) =
coeff (hermite n) k - (k + 2) * coeff (hermite n) (k + 2) := by
rw [hermite_succ, coeff_sub, coeff_X_mul, coeff_derivative, mul_comm]
norm_cast
#align polynomial.coeff_hermite_succ_succ Polynomial.coeff_hermite_succ_succ
theorem coeff_hermite_of_lt {n k : ℕ} (hnk : n < k) : coeff (hermite n) k = 0 := by
obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnk
clear hnk
induction' n with n ih generalizing k
· apply coeff_C
· have : n + k + 1 + 2 = n + (k + 2) + 1 := by ring
rw [coeff_hermite_succ_succ, add_right_comm, this, ih k, ih (k + 2),
mul_zero, sub_zero]
#align polynomial.coeff_hermite_of_lt Polynomial.coeff_hermite_of_lt
@[simp]
| Mathlib/RingTheory/Polynomial/Hermite/Basic.lean | 103 | 107 | theorem coeff_hermite_self (n : ℕ) : coeff (hermite n) n = 1 := by
induction' n with n ih |
induction' n with n ih
· apply coeff_C
· rw [coeff_hermite_succ_succ, ih, coeff_hermite_of_lt, mul_zero, sub_zero]
simp
| true |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module ℝ E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) • x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) :
gaugeRescale s t (c • x) = c • gaugeRescale s t x := by
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
variable [TopologicalSpace E] [T1Space E]
| Mathlib/Analysis/Convex/GaugeRescale.lean | 48 | 52 | theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s)
(x : E) : gaugeRescale s s x = x := by
rcases eq_or_ne x 0 with rfl | hx; · simp |
rcases eq_or_ne x 0 with rfl | hx; · simp
rw [gaugeRescale, div_self, one_smul]
exact ((gauge_pos hsa hsb).2 hx).ne'
| true |
import Mathlib.CategoryTheory.Sites.Sieves
#align_import category_theory.sites.sheaf_of_types from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe w v₁ v₂ u₁ u₂
namespace CategoryTheory
open Opposite CategoryTheory Category Limits Sieve
namespace Presieve
variable {C : Type u₁} [Category.{v₁} C]
variable {P Q U : Cᵒᵖ ⥤ Type w}
variable {X Y : C} {S : Sieve X} {R : Presieve X}
def FamilyOfElements (P : Cᵒᵖ ⥤ Type w) (R : Presieve X) :=
∀ ⦃Y : C⦄ (f : Y ⟶ X), R f → P.obj (op Y)
#align category_theory.presieve.family_of_elements CategoryTheory.Presieve.FamilyOfElements
instance : Inhabited (FamilyOfElements P (⊥ : Presieve X)) :=
⟨fun _ _ => False.elim⟩
def FamilyOfElements.restrict {R₁ R₂ : Presieve X} (h : R₁ ≤ R₂) :
FamilyOfElements P R₂ → FamilyOfElements P R₁ := fun x _ f hf => x f (h _ hf)
#align category_theory.presieve.family_of_elements.restrict CategoryTheory.Presieve.FamilyOfElements.restrict
def FamilyOfElements.map (p : FamilyOfElements P R) (φ : P ⟶ Q) :
FamilyOfElements Q R :=
fun _ f hf => φ.app _ (p f hf)
@[simp]
lemma FamilyOfElements.map_apply
(p : FamilyOfElements P R) (φ : P ⟶ Q) {Y : C} (f : Y ⟶ X) (hf : R f) :
p.map φ f hf = φ.app _ (p f hf) := rfl
lemma FamilyOfElements.restrict_map
(p : FamilyOfElements P R) (φ : P ⟶ Q) {R' : Presieve X} (h : R' ≤ R) :
(p.restrict h).map φ = (p.map φ).restrict h := rfl
def FamilyOfElements.Compatible (x : FamilyOfElements P R) : Prop :=
∀ ⦃Y₁ Y₂ Z⦄ (g₁ : Z ⟶ Y₁) (g₂ : Z ⟶ Y₂) ⦃f₁ : Y₁ ⟶ X⦄ ⦃f₂ : Y₂ ⟶ X⦄ (h₁ : R f₁) (h₂ : R f₂),
g₁ ≫ f₁ = g₂ ≫ f₂ → P.map g₁.op (x f₁ h₁) = P.map g₂.op (x f₂ h₂)
#align category_theory.presieve.family_of_elements.compatible CategoryTheory.Presieve.FamilyOfElements.Compatible
def FamilyOfElements.PullbackCompatible (x : FamilyOfElements P R) [R.hasPullbacks] : Prop :=
∀ ⦃Y₁ Y₂⦄ ⦃f₁ : Y₁ ⟶ X⦄ ⦃f₂ : Y₂ ⟶ X⦄ (h₁ : R f₁) (h₂ : R f₂),
haveI := hasPullbacks.has_pullbacks h₁ h₂
P.map (pullback.fst : Limits.pullback f₁ f₂ ⟶ _).op (x f₁ h₁) = P.map pullback.snd.op (x f₂ h₂)
#align category_theory.presieve.family_of_elements.pullback_compatible CategoryTheory.Presieve.FamilyOfElements.PullbackCompatible
theorem pullbackCompatible_iff (x : FamilyOfElements P R) [R.hasPullbacks] :
x.Compatible ↔ x.PullbackCompatible := by
constructor
· intro t Y₁ Y₂ f₁ f₂ hf₁ hf₂
apply t
haveI := hasPullbacks.has_pullbacks hf₁ hf₂
apply pullback.condition
· intro t Y₁ Y₂ Z g₁ g₂ f₁ f₂ hf₁ hf₂ comm
haveI := hasPullbacks.has_pullbacks hf₁ hf₂
rw [← pullback.lift_fst _ _ comm, op_comp, FunctorToTypes.map_comp_apply, t hf₁ hf₂,
← FunctorToTypes.map_comp_apply, ← op_comp, pullback.lift_snd]
#align category_theory.presieve.pullback_compatible_iff CategoryTheory.Presieve.pullbackCompatible_iff
theorem FamilyOfElements.Compatible.restrict {R₁ R₂ : Presieve X} (h : R₁ ≤ R₂)
{x : FamilyOfElements P R₂} : x.Compatible → (x.restrict h).Compatible :=
fun q _ _ _ g₁ g₂ _ _ h₁ h₂ comm => q g₁ g₂ (h _ h₁) (h _ h₂) comm
#align category_theory.presieve.family_of_elements.compatible.restrict CategoryTheory.Presieve.FamilyOfElements.Compatible.restrict
noncomputable def FamilyOfElements.sieveExtend (x : FamilyOfElements P R) :
FamilyOfElements P (generate R : Presieve X) := fun _ _ hf =>
P.map hf.choose_spec.choose.op (x _ hf.choose_spec.choose_spec.choose_spec.1)
#align category_theory.presieve.family_of_elements.sieve_extend CategoryTheory.Presieve.FamilyOfElements.sieveExtend
theorem FamilyOfElements.Compatible.sieveExtend {x : FamilyOfElements P R} (hx : x.Compatible) :
x.sieveExtend.Compatible := by
intro _ _ _ _ _ _ _ h₁ h₂ comm
iterate 2 erw [← FunctorToTypes.map_comp_apply]; rw [← op_comp]
apply hx
simp [comm, h₁.choose_spec.choose_spec.choose_spec.2, h₂.choose_spec.choose_spec.choose_spec.2]
#align category_theory.presieve.family_of_elements.compatible.sieve_extend CategoryTheory.Presieve.FamilyOfElements.Compatible.sieveExtend
| Mathlib/CategoryTheory/Sites/IsSheafFor.lean | 195 | 202 | theorem extend_agrees {x : FamilyOfElements P R} (t : x.Compatible) {f : Y ⟶ X} (hf : R f) :
x.sieveExtend f (le_generate R Y hf) = x f hf := by
have h := (le_generate R Y hf).choose_spec |
have h := (le_generate R Y hf).choose_spec
unfold FamilyOfElements.sieveExtend
rw [t h.choose (𝟙 _) _ hf _]
· simp
· rw [id_comp]
exact h.choose_spec.choose_spec.2
| true |
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
| Mathlib/Algebra/Quandle.lean | 232 | 236 | theorem left_cancel_inv (x : R) {y y' : R} : x ◃⁻¹ y = x ◃⁻¹ y' ↔ y = y' := by
constructor |
constructor
· apply (act' x).symm.injective
rintro rfl
rfl
| true |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Data.Set.Finite
#align_import order.conditionally_complete_lattice.finset from "leanprover-community/mathlib"@"2445c98ae4b87eabebdde552593519b9b6dc350c"
open Set
variable {ι α β γ : Type*}
section ConditionallyCompleteLinearOrder
variable [ConditionallyCompleteLinearOrder α] {s t : Set α} {a b : α}
theorem Finset.Nonempty.csSup_eq_max' {s : Finset α} (h : s.Nonempty) : sSup ↑s = s.max' h :=
eq_of_forall_ge_iff fun _ => (csSup_le_iff s.bddAbove h.to_set).trans (s.max'_le_iff h).symm
#align finset.nonempty.cSup_eq_max' Finset.Nonempty.csSup_eq_max'
theorem Finset.Nonempty.csInf_eq_min' {s : Finset α} (h : s.Nonempty) : sInf ↑s = s.min' h :=
@Finset.Nonempty.csSup_eq_max' αᵒᵈ _ s h
#align finset.nonempty.cInf_eq_min' Finset.Nonempty.csInf_eq_min'
| Mathlib/Order/ConditionallyCompleteLattice/Finset.lean | 33 | 35 | theorem Finset.Nonempty.csSup_mem {s : Finset α} (h : s.Nonempty) : sSup (s : Set α) ∈ s := by
rw [h.csSup_eq_max'] |
rw [h.csSup_eq_max']
exact s.max'_mem _
| true |
import Mathlib.Data.Nat.Lattice
import Mathlib.Logic.Denumerable
import Mathlib.Logic.Function.Iterate
import Mathlib.Order.Hom.Basic
import Mathlib.Data.Set.Subsingleton
#align_import order.order_iso_nat from "leanprover-community/mathlib"@"210657c4ea4a4a7b234392f70a3a2a83346dfa90"
variable {α : Type*}
namespace RelEmbedding
variable {r : α → α → Prop} [IsStrictOrder α r]
def natLT (f : ℕ → α) (H : ∀ n : ℕ, r (f n) (f (n + 1))) : ((· < ·) : ℕ → ℕ → Prop) ↪r r :=
ofMonotone f <| Nat.rel_of_forall_rel_succ_of_lt r H
#align rel_embedding.nat_lt RelEmbedding.natLT
@[simp]
theorem coe_natLT {f : ℕ → α} {H : ∀ n : ℕ, r (f n) (f (n + 1))} : ⇑(natLT f H) = f :=
rfl
#align rel_embedding.coe_nat_lt RelEmbedding.coe_natLT
def natGT (f : ℕ → α) (H : ∀ n : ℕ, r (f (n + 1)) (f n)) : ((· > ·) : ℕ → ℕ → Prop) ↪r r :=
haveI := IsStrictOrder.swap r
RelEmbedding.swap (natLT f H)
#align rel_embedding.nat_gt RelEmbedding.natGT
@[simp]
theorem coe_natGT {f : ℕ → α} {H : ∀ n : ℕ, r (f (n + 1)) (f n)} : ⇑(natGT f H) = f :=
rfl
#align rel_embedding.coe_nat_gt RelEmbedding.coe_natGT
| Mathlib/Order/OrderIsoNat.lean | 58 | 62 | theorem exists_not_acc_lt_of_not_acc {a : α} {r} (h : ¬Acc r a) : ∃ b, ¬Acc r b ∧ r b a := by
contrapose! h |
contrapose! h
refine ⟨_, fun b hr => ?_⟩
by_contra hb
exact h b hb hr
| true |
import Mathlib.Init.Control.Combinators
import Mathlib.Init.Function
import Mathlib.Tactic.CasesM
import Mathlib.Tactic.Attr.Core
#align_import control.basic from "leanprover-community/mathlib"@"48fb5b5280e7c81672afc9524185ae994553ebf4"
universe u v w
variable {α β γ : Type u}
section Monad
variable {m : Type u → Type v} [Monad m] [LawfulMonad m]
open List
#align list.mpartition List.partitionM
| Mathlib/Control/Basic.lean | 83 | 85 | theorem map_bind (x : m α) {g : α → m β} {f : β → γ} :
f <$> (x >>= g) = x >>= fun a => f <$> g a := by |
rw [← bind_pure_comp, bind_assoc]; simp [bind_pure_comp]
| true |
import Mathlib.Algebra.Group.Units.Hom
import Mathlib.Algebra.GroupWithZero.Commute
import Mathlib.Algebra.GroupWithZero.Hom
import Mathlib.GroupTheory.GroupAction.Units
#align_import algebra.group_with_zero.units.lemmas from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
assert_not_exists DenselyOrdered
variable {α M₀ G₀ M₀' G₀' F F' : Type*}
variable [MonoidWithZero M₀]
section MonoidWithZero
variable [GroupWithZero G₀] [Nontrivial M₀] [MonoidWithZero M₀'] [FunLike F G₀ M₀]
[MonoidWithZeroHomClass F G₀ M₀] [FunLike F' G₀ M₀'] [MonoidWithZeroHomClass F' G₀ M₀']
(f : F) {a : G₀}
theorem map_ne_zero : f a ≠ 0 ↔ a ≠ 0 :=
⟨fun hfa ha => hfa <| ha.symm ▸ map_zero f, fun ha => ((IsUnit.mk0 a ha).map f).ne_zero⟩
#align map_ne_zero map_ne_zero
@[simp]
theorem map_eq_zero : f a = 0 ↔ a = 0 :=
not_iff_not.1 (map_ne_zero f)
#align map_eq_zero map_eq_zero
| Mathlib/Algebra/GroupWithZero/Units/Lemmas.lean | 49 | 52 | theorem eq_on_inv₀ (f g : F') (h : f a = g a) : f a⁻¹ = g a⁻¹ := by
rcases eq_or_ne a 0 with (rfl | ha) |
rcases eq_or_ne a 0 with (rfl | ha)
· rw [inv_zero, map_zero, map_zero]
· exact (IsUnit.mk0 a ha).eq_on_inv f g h
| true |
import Mathlib.CategoryTheory.Sites.Subsheaf
import Mathlib.CategoryTheory.Sites.CompatibleSheafification
import Mathlib.CategoryTheory.Sites.LocallyInjective
#align_import category_theory.sites.surjective from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
universe v u w v' u' w'
open Opposite CategoryTheory CategoryTheory.GrothendieckTopology
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] (J : GrothendieckTopology C)
attribute [local instance] ConcreteCategory.hasCoeToSort ConcreteCategory.instFunLike
variable {A : Type u'} [Category.{v'} A] [ConcreteCategory.{w'} A]
namespace Presheaf
@[simps (config := .lemmasOnly)]
def imageSieve {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) : Sieve U where
arrows V i := ∃ t : F.obj (op V), f.app _ t = G.map i.op s
downward_closed := by
rintro V W i ⟨t, ht⟩ j
refine ⟨F.map j.op t, ?_⟩
rw [op_comp, G.map_comp, comp_apply, ← ht, elementwise_of% f.naturality]
#align category_theory.image_sieve CategoryTheory.Presheaf.imageSieve
theorem imageSieve_eq_sieveOfSection {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) :
imageSieve f s = (imagePresheaf (whiskerRight f (forget A))).sieveOfSection s :=
rfl
#align category_theory.image_sieve_eq_sieve_of_section CategoryTheory.Presheaf.imageSieve_eq_sieveOfSection
theorem imageSieve_whisker_forget {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : G.obj (op U)) :
imageSieve (whiskerRight f (forget A)) s = imageSieve f s :=
rfl
#align category_theory.image_sieve_whisker_forget CategoryTheory.Presheaf.imageSieve_whisker_forget
theorem imageSieve_app {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : C} (s : F.obj (op U)) :
imageSieve f (f.app _ s) = ⊤ := by
ext V i
simp only [Sieve.top_apply, iff_true_iff, imageSieve_apply]
have := elementwise_of% (f.naturality i.op)
exact ⟨F.map i.op s, this s⟩
#align category_theory.image_sieve_app CategoryTheory.Presheaf.imageSieve_app
noncomputable def localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U)
{V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) :
F.obj (op V) :=
hg.choose
@[simp]
lemma app_localPreimage {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) {U : Cᵒᵖ} (s : G.obj U)
{V : C} (g : V ⟶ U.unop) (hg : imageSieve f s g) :
f.app _ (localPreimage f s g hg) = G.map g.op s :=
hg.choose_spec
class IsLocallySurjective {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) : Prop where
imageSieve_mem {U : C} (s : G.obj (op U)) : imageSieve f s ∈ J U
#align category_theory.is_locally_surjective CategoryTheory.Presheaf.IsLocallySurjective
lemma imageSieve_mem {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] {U : Cᵒᵖ}
(s : G.obj U) : imageSieve f s ∈ J U.unop :=
IsLocallySurjective.imageSieve_mem _
instance {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) [IsLocallySurjective J f] :
IsLocallySurjective J (whiskerRight f (forget A)) where
imageSieve_mem s := imageSieve_mem J f s
| Mathlib/CategoryTheory/Sites/LocallySurjective.lean | 101 | 105 | theorem isLocallySurjective_iff_imagePresheaf_sheafify_eq_top {F G : Cᵒᵖ ⥤ A} (f : F ⟶ G) :
IsLocallySurjective J f ↔ (imagePresheaf (whiskerRight f (forget A))).sheafify J = ⊤ := by
simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj, |
simp only [Subpresheaf.ext_iff, Function.funext_iff, Set.ext_iff, top_subpresheaf_obj,
Set.top_eq_univ, Set.mem_univ, iff_true_iff]
exact ⟨fun H _ => H.imageSieve_mem, fun H => ⟨H _⟩⟩
| true |
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
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]
#align power_basis.finrank PowerBasis.finrank
theorem mem_span_pow' {x y : S} {d : ℕ} :
y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔
∃ f : R[X], f.degree < d ∧ y = aeval x f := by
have : (Set.range fun i : Fin d => x ^ (i : ℕ)) = (fun i : ℕ => x ^ i) '' ↑(Finset.range d) := by
ext n
simp_rw [Set.mem_range, Set.mem_image, Finset.mem_coe, Finset.mem_range]
exact ⟨fun ⟨⟨i, hi⟩, hy⟩ => ⟨i, hi, hy⟩, fun ⟨i, hi, hy⟩ => ⟨⟨i, hi⟩, hy⟩⟩
simp only [this, Finsupp.mem_span_image_iff_total, degree_lt_iff_coeff_zero, support,
exists_iff_exists_finsupp, coeff, aeval_def, eval₂RingHom', eval₂_eq_sum, Polynomial.sum,
Finsupp.mem_supported', Finsupp.total, Finsupp.sum, Algebra.smul_def, eval₂_zero, exists_prop,
LinearMap.id_coe, eval₂_one, id, not_lt, Finsupp.coe_lsum, LinearMap.coe_smulRight,
Finset.mem_range, AlgHom.coe_mks, Finset.mem_coe]
simp_rw [@eq_comm _ y]
exact Iff.rfl
#align power_basis.mem_span_pow' PowerBasis.mem_span_pow'
theorem mem_span_pow {x y : S} {d : ℕ} (hd : d ≠ 0) :
y ∈ Submodule.span R (Set.range fun i : Fin d => x ^ (i : ℕ)) ↔
∃ f : R[X], f.natDegree < d ∧ y = aeval x f := by
rw [mem_span_pow']
constructor <;>
· rintro ⟨f, h, hy⟩
refine ⟨f, ?_, hy⟩
by_cases hf : f = 0
· simp only [hf, natDegree_zero, degree_zero] at h ⊢
first | exact lt_of_le_of_ne (Nat.zero_le d) hd.symm | exact WithBot.bot_lt_coe d
simp_all only [degree_eq_natDegree hf]
· first | exact WithBot.coe_lt_coe.1 h | exact WithBot.coe_lt_coe.2 h
#align power_basis.mem_span_pow PowerBasis.mem_span_pow
theorem dim_ne_zero [Nontrivial S] (pb : PowerBasis R S) : pb.dim ≠ 0 := fun h =>
not_nonempty_iff.mpr (h.symm ▸ Fin.isEmpty : IsEmpty (Fin pb.dim)) pb.basis.index_nonempty
#align power_basis.dim_ne_zero PowerBasis.dim_ne_zero
theorem dim_pos [Nontrivial S] (pb : PowerBasis R S) : 0 < pb.dim :=
Nat.pos_of_ne_zero pb.dim_ne_zero
#align power_basis.dim_pos PowerBasis.dim_pos
theorem exists_eq_aeval [Nontrivial S] (pb : PowerBasis R S) (y : S) :
∃ f : R[X], f.natDegree < pb.dim ∧ y = aeval pb.gen f :=
(mem_span_pow pb.dim_ne_zero).mp (by simpa using pb.basis.mem_span y)
#align power_basis.exists_eq_aeval PowerBasis.exists_eq_aeval
| Mathlib/RingTheory/PowerBasis.lean | 132 | 135 | theorem exists_eq_aeval' (pb : PowerBasis R S) (y : S) : ∃ f : R[X], y = aeval pb.gen f := by
nontriviality S |
nontriviality S
obtain ⟨f, _, hf⟩ := exists_eq_aeval pb y
exact ⟨f, hf⟩
| true |
import Mathlib.Algebra.Lie.OfAssociative
import Mathlib.Algebra.Lie.IdealOperations
#align_import algebra.lie.abelian from "leanprover-community/mathlib"@"8983bec7cdf6cb2dd1f21315c8a34ab00d7b2f6d"
universe u v w w₁ w₂
class LieModule.IsTrivial (L : Type v) (M : Type w) [Bracket L M] [Zero M] : Prop where
trivial : ∀ (x : L) (m : M), ⁅x, m⁆ = 0
#align lie_module.is_trivial LieModule.IsTrivial
@[simp]
theorem trivial_lie_zero (L : Type v) (M : Type w) [Bracket L M] [Zero M] [LieModule.IsTrivial L M]
(x : L) (m : M) : ⁅x, m⁆ = 0 :=
LieModule.IsTrivial.trivial x m
#align trivial_lie_zero trivial_lie_zero
instance LieModule.instIsTrivialOfSubsingleton {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton L] : LieModule.IsTrivial L M :=
⟨fun x m ↦ by rw [Subsingleton.eq_zero x, zero_lie]⟩
instance LieModule.instIsTrivialOfSubsingleton' {L M : Type*}
[LieRing L] [AddCommGroup M] [LieRingModule L M] [Subsingleton M] : LieModule.IsTrivial L M :=
⟨fun x m ↦ by simp_rw [Subsingleton.eq_zero m, lie_zero]⟩
abbrev IsLieAbelian (L : Type v) [Bracket L L] [Zero L] : Prop :=
LieModule.IsTrivial L L
#align is_lie_abelian IsLieAbelian
instance LieIdeal.isLieAbelian_of_trivial (R : Type u) (L : Type v) [CommRing R] [LieRing L]
[LieAlgebra R L] (I : LieIdeal R L) [h : LieModule.IsTrivial L I] : IsLieAbelian I where
trivial x y := by apply h.trivial
#align lie_ideal.is_lie_abelian_of_trivial LieIdeal.isLieAbelian_of_trivial
theorem Function.Injective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
(h₁ : Function.Injective f) (_ : IsLieAbelian L₂) : IsLieAbelian L₁ :=
{ trivial := fun x y => h₁ <|
calc
f ⁅x, y⁆ = ⁅f x, f y⁆ := LieHom.map_lie f x y
_ = 0 := trivial_lie_zero _ _ _ _
_ = f 0 := f.map_zero.symm}
#align function.injective.is_lie_abelian Function.Injective.isLieAbelian
theorem Function.Surjective.isLieAbelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] {f : L₁ →ₗ⁅R⁆ L₂}
(h₁ : Function.Surjective f) (h₂ : IsLieAbelian L₁) : IsLieAbelian L₂ :=
{ trivial := fun x y => by
obtain ⟨u, rfl⟩ := h₁ x
obtain ⟨v, rfl⟩ := h₁ y
rw [← LieHom.map_lie, trivial_lie_zero, LieHom.map_zero] }
#align function.surjective.is_lie_abelian Function.Surjective.isLieAbelian
theorem lie_abelian_iff_equiv_lie_abelian {R : Type u} {L₁ : Type v} {L₂ : Type w} [CommRing R]
[LieRing L₁] [LieRing L₂] [LieAlgebra R L₁] [LieAlgebra R L₂] (e : L₁ ≃ₗ⁅R⁆ L₂) :
IsLieAbelian L₁ ↔ IsLieAbelian L₂ :=
⟨e.symm.injective.isLieAbelian, e.injective.isLieAbelian⟩
#align lie_abelian_iff_equiv_lie_abelian lie_abelian_iff_equiv_lie_abelian
theorem commutative_ring_iff_abelian_lie_ring {A : Type v} [Ring A] :
Std.Commutative (α := A) (· * ·) ↔ IsLieAbelian A := by
have h₁ : Std.Commutative (α := A) (· * ·) ↔ ∀ a b : A, a * b = b * a :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
have h₂ : IsLieAbelian A ↔ ∀ a b : A, ⁅a, b⁆ = 0 := ⟨fun h => h.1, fun h => ⟨h⟩⟩
simp only [h₁, h₂, LieRing.of_associative_ring_bracket, sub_eq_zero]
#align commutative_ring_iff_abelian_lie_ring commutative_ring_iff_abelian_lie_ring
section Center
variable (R : Type u) (L : Type v) (M : Type w) (N : Type w₁)
variable [CommRing R] [LieRing L] [LieAlgebra R L]
variable [AddCommGroup M] [Module R M] [LieRingModule L M] [LieModule R L M]
variable [AddCommGroup N] [Module R N] [LieRingModule L N] [LieModule R L N]
section IdealOperations
open LieSubmodule LieSubalgebra
variable {R : Type u} {L : Type v} {M : Type w}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
variable [LieRingModule L M] [LieModule R L M]
variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L)
@[simp]
theorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : ⁅I, N⁆ = ⊥ := by
suffices ⁅I, N⁆ ≤ ⊥ from le_bot_iff.mp this
rw [lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le]
rintro m ⟨x, n, h⟩; rw [trivial_lie_zero] at h; simp [← h]
#align lie_submodule.trivial_lie_oper_zero LieSubmodule.trivial_lie_oper_zero
| Mathlib/Algebra/Lie/Abelian.lean | 318 | 326 | theorem LieSubmodule.lie_abelian_iff_lie_self_eq_bot : IsLieAbelian I ↔ ⁅I, I⁆ = ⊥ := by
simp only [_root_.eq_bot_iff, lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le, |
simp only [_root_.eq_bot_iff, lieIdeal_oper_eq_span, LieSubmodule.lieSpan_le,
LieSubmodule.bot_coe, Set.subset_singleton_iff, Set.mem_setOf_eq, exists_imp]
refine
⟨fun h z x y hz =>
hz.symm.trans
(((I : LieSubalgebra R L).coe_bracket x y).symm.trans
((coe_zero_iff_zero _ _).mpr (by apply h.trivial))),
fun h => ⟨fun x y => ((I : LieSubalgebra R L).coe_zero_iff_zero _).mp (h _ x y rfl)⟩⟩
| true |
import Mathlib.Data.Option.NAry
import Mathlib.Data.Seq.Computation
#align_import data.seq.seq from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace Stream'
universe u v w
def IsSeq {α : Type u} (s : Stream' (Option α)) : Prop :=
∀ {n : ℕ}, s n = none → s (n + 1) = none
#align stream.is_seq Stream'.IsSeq
def Seq (α : Type u) : Type u :=
{ f : Stream' (Option α) // f.IsSeq }
#align stream.seq Stream'.Seq
def Seq1 (α) :=
α × Seq α
#align stream.seq1 Stream'.Seq1
namespace Seq
variable {α : Type u} {β : Type v} {γ : Type w}
def nil : Seq α :=
⟨Stream'.const none, fun {_} _ => rfl⟩
#align stream.seq.nil Stream'.Seq.nil
instance : Inhabited (Seq α) :=
⟨nil⟩
def cons (a : α) (s : Seq α) : Seq α :=
⟨some a::s.1, by
rintro (n | _) h
· contradiction
· exact s.2 h⟩
#align stream.seq.cons Stream'.Seq.cons
@[simp]
theorem val_cons (s : Seq α) (x : α) : (cons x s).val = some x::s.val :=
rfl
#align stream.seq.val_cons Stream'.Seq.val_cons
def get? : Seq α → ℕ → Option α :=
Subtype.val
#align stream.seq.nth Stream'.Seq.get?
@[simp]
theorem get?_mk (f hf) : @get? α ⟨f, hf⟩ = f :=
rfl
#align stream.seq.nth_mk Stream'.Seq.get?_mk
@[simp]
theorem get?_nil (n : ℕ) : (@nil α).get? n = none :=
rfl
#align stream.seq.nth_nil Stream'.Seq.get?_nil
@[simp]
theorem get?_cons_zero (a : α) (s : Seq α) : (cons a s).get? 0 = some a :=
rfl
#align stream.seq.nth_cons_zero Stream'.Seq.get?_cons_zero
@[simp]
theorem get?_cons_succ (a : α) (s : Seq α) (n : ℕ) : (cons a s).get? (n + 1) = s.get? n :=
rfl
#align stream.seq.nth_cons_succ Stream'.Seq.get?_cons_succ
@[ext]
protected theorem ext {s t : Seq α} (h : ∀ n : ℕ, s.get? n = t.get? n) : s = t :=
Subtype.eq <| funext h
#align stream.seq.ext Stream'.Seq.ext
theorem cons_injective2 : Function.Injective2 (cons : α → Seq α → Seq α) := fun x y s t h =>
⟨by rw [← Option.some_inj, ← get?_cons_zero, h, get?_cons_zero],
Seq.ext fun n => by simp_rw [← get?_cons_succ x s n, h, get?_cons_succ]⟩
#align stream.seq.cons_injective2 Stream'.Seq.cons_injective2
theorem cons_left_injective (s : Seq α) : Function.Injective fun x => cons x s :=
cons_injective2.left _
#align stream.seq.cons_left_injective Stream'.Seq.cons_left_injective
theorem cons_right_injective (x : α) : Function.Injective (cons x) :=
cons_injective2.right _
#align stream.seq.cons_right_injective Stream'.Seq.cons_right_injective
def TerminatedAt (s : Seq α) (n : ℕ) : Prop :=
s.get? n = none
#align stream.seq.terminated_at Stream'.Seq.TerminatedAt
instance terminatedAtDecidable (s : Seq α) (n : ℕ) : Decidable (s.TerminatedAt n) :=
decidable_of_iff' (s.get? n).isNone <| by unfold TerminatedAt; cases s.get? n <;> simp
#align stream.seq.terminated_at_decidable Stream'.Seq.terminatedAtDecidable
def Terminates (s : Seq α) : Prop :=
∃ n : ℕ, s.TerminatedAt n
#align stream.seq.terminates Stream'.Seq.Terminates
theorem not_terminates_iff {s : Seq α} : ¬s.Terminates ↔ ∀ n, (s.get? n).isSome := by
simp only [Terminates, TerminatedAt, ← Ne.eq_def, Option.ne_none_iff_isSome, not_exists, iff_self]
#align stream.seq.not_terminates_iff Stream'.Seq.not_terminates_iff
@[simp]
def omap (f : β → γ) : Option (α × β) → Option (α × γ)
| none => none
| some (a, b) => some (a, f b)
#align stream.seq.omap Stream'.Seq.omap
def head (s : Seq α) : Option α :=
get? s 0
#align stream.seq.head Stream'.Seq.head
def tail (s : Seq α) : Seq α :=
⟨s.1.tail, fun n' => by
cases' s with f al
exact al n'⟩
#align stream.seq.tail Stream'.Seq.tail
protected def Mem (a : α) (s : Seq α) :=
some a ∈ s.1
#align stream.seq.mem Stream'.Seq.Mem
instance : Membership α (Seq α) :=
⟨Seq.Mem⟩
theorem le_stable (s : Seq α) {m n} (h : m ≤ n) : s.get? m = none → s.get? n = none := by
cases' s with f al
induction' h with n _ IH
exacts [id, fun h2 => al (IH h2)]
#align stream.seq.le_stable Stream'.Seq.le_stable
theorem terminated_stable : ∀ (s : Seq α) {m n : ℕ}, m ≤ n → s.TerminatedAt m → s.TerminatedAt n :=
le_stable
#align stream.seq.terminated_stable Stream'.Seq.terminated_stable
| Mathlib/Data/Seq/Seq.lean | 174 | 178 | theorem ge_stable (s : Seq α) {aₙ : α} {n m : ℕ} (m_le_n : m ≤ n)
(s_nth_eq_some : s.get? n = some aₙ) : ∃ aₘ : α, s.get? m = some aₘ :=
have : s.get? n ≠ none := by simp [s_nth_eq_some] | simp [s_nth_eq_some]
have : s.get? m ≠ none := mt (s.le_stable m_le_n) this
Option.ne_none_iff_exists'.mp this
| true |
import Mathlib.Order.Interval.Set.UnorderedInterval
import Mathlib.Algebra.Order.Interval.Set.Monoid
import Mathlib.Data.Set.Pointwise.Basic
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
#align_import data.set.pointwise.interval from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Interval Pointwise
variable {α : Type*}
namespace Set
section LinearOrderedField
variable [LinearOrderedField α] {a : α}
@[simp]
theorem preimage_mul_const_Iio (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iio a = Iio (a / c) :=
ext fun _x => (lt_div_iff h).symm
#align set.preimage_mul_const_Iio Set.preimage_mul_const_Iio
@[simp]
theorem preimage_mul_const_Ioi (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioi a = Ioi (a / c) :=
ext fun _x => (div_lt_iff h).symm
#align set.preimage_mul_const_Ioi Set.preimage_mul_const_Ioi
@[simp]
theorem preimage_mul_const_Iic (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Iic a = Iic (a / c) :=
ext fun _x => (le_div_iff h).symm
#align set.preimage_mul_const_Iic Set.preimage_mul_const_Iic
@[simp]
theorem preimage_mul_const_Ici (a : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ici a = Ici (a / c) :=
ext fun _x => (div_le_iff h).symm
#align set.preimage_mul_const_Ici Set.preimage_mul_const_Ici
@[simp]
theorem preimage_mul_const_Ioo (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioo a b = Ioo (a / c) (b / c) := by simp [← Ioi_inter_Iio, h]
#align set.preimage_mul_const_Ioo Set.preimage_mul_const_Ioo
@[simp]
| Mathlib/Data/Set/Pointwise/Interval.lean | 624 | 625 | theorem preimage_mul_const_Ioc (a b : α) {c : α} (h : 0 < c) :
(fun x => x * c) ⁻¹' Ioc a b = Ioc (a / c) (b / c) := by | simp [← Ioi_inter_Iic, h]
| true |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Polynomial.RingDivision
#align_import data.polynomial.mirror from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
namespace Polynomial
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] (p q : R[X])
noncomputable def mirror :=
p.reverse * X ^ p.natTrailingDegree
#align polynomial.mirror Polynomial.mirror
@[simp]
theorem mirror_zero : (0 : R[X]).mirror = 0 := by simp [mirror]
#align polynomial.mirror_zero Polynomial.mirror_zero
theorem mirror_monomial (n : ℕ) (a : R) : (monomial n a).mirror = monomial n a := by
classical
by_cases ha : a = 0
· rw [ha, monomial_zero_right, mirror_zero]
· rw [mirror, reverse, natDegree_monomial n a, if_neg ha, natTrailingDegree_monomial ha, ←
C_mul_X_pow_eq_monomial, reflect_C_mul_X_pow, revAt_le (le_refl n), tsub_self, pow_zero,
mul_one]
#align polynomial.mirror_monomial Polynomial.mirror_monomial
theorem mirror_C (a : R) : (C a).mirror = C a :=
mirror_monomial 0 a
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_C Polynomial.mirror_C
theorem mirror_X : X.mirror = (X : R[X]) :=
mirror_monomial 1 (1 : R)
set_option linter.uppercaseLean3 false in
#align polynomial.mirror_X Polynomial.mirror_X
theorem mirror_natDegree : p.mirror.natDegree = p.natDegree := by
by_cases hp : p = 0
· rw [hp, mirror_zero]
nontriviality R
rw [mirror, natDegree_mul', reverse_natDegree, natDegree_X_pow,
tsub_add_cancel_of_le p.natTrailingDegree_le_natDegree]
rwa [leadingCoeff_X_pow, mul_one, reverse_leadingCoeff, Ne, trailingCoeff_eq_zero]
#align polynomial.mirror_nat_degree Polynomial.mirror_natDegree
theorem mirror_natTrailingDegree : p.mirror.natTrailingDegree = p.natTrailingDegree := by
by_cases hp : p = 0
· rw [hp, mirror_zero]
· rw [mirror, natTrailingDegree_mul_X_pow ((mt reverse_eq_zero.mp) hp),
natTrailingDegree_reverse, zero_add]
#align polynomial.mirror_nat_trailing_degree Polynomial.mirror_natTrailingDegree
| Mathlib/Algebra/Polynomial/Mirror.lean | 82 | 97 | theorem coeff_mirror (n : ℕ) :
p.mirror.coeff n = p.coeff (revAt (p.natDegree + p.natTrailingDegree) n) := by
by_cases h2 : p.natDegree < n |
by_cases h2 : p.natDegree < n
· rw [coeff_eq_zero_of_natDegree_lt (by rwa [mirror_natDegree])]
by_cases h1 : n ≤ p.natDegree + p.natTrailingDegree
· rw [revAt_le h1, coeff_eq_zero_of_lt_natTrailingDegree]
exact (tsub_lt_iff_left h1).mpr (Nat.add_lt_add_right h2 _)
· rw [← revAtFun_eq, revAtFun, if_neg h1, coeff_eq_zero_of_natDegree_lt h2]
rw [not_lt] at h2
rw [revAt_le (h2.trans (Nat.le_add_right _ _))]
by_cases h3 : p.natTrailingDegree ≤ n
· rw [← tsub_add_eq_add_tsub h2, ← tsub_tsub_assoc h2 h3, mirror, coeff_mul_X_pow', if_pos h3,
coeff_reverse, revAt_le (tsub_le_self.trans h2)]
rw [not_le] at h3
rw [coeff_eq_zero_of_natDegree_lt (lt_tsub_iff_right.mpr (Nat.add_lt_add_left h3 _))]
exact coeff_eq_zero_of_lt_natTrailingDegree (by rwa [mirror_natTrailingDegree])
| true |
import Mathlib.Algebra.Algebra.Unitization
import Mathlib.Algebra.Star.NonUnitalSubalgebra
import Mathlib.Algebra.Star.Subalgebra
import Mathlib.GroupTheory.GroupAction.Ring
section Subalgebra
variable {R A : Type*} [CommSemiring R] [Semiring A] [Algebra R A]
def Subalgebra.toNonUnitalSubalgebra (S : Subalgebra R A) : NonUnitalSubalgebra R A :=
{ S with
smul_mem' := fun r _x hx => S.smul_mem hx r }
theorem Subalgebra.one_mem_toNonUnitalSubalgebra (S : Subalgebra R A) :
(1 : A) ∈ S.toNonUnitalSubalgebra :=
S.one_mem
def NonUnitalSubalgebra.toSubalgebra (S : NonUnitalSubalgebra R A) (h1 : (1 : A) ∈ S) :
Subalgebra R A :=
{ S with
one_mem' := h1
algebraMap_mem' := fun r =>
(Algebra.algebraMap_eq_smul_one (R := R) (A := A) r).symm ▸ SMulMemClass.smul_mem r h1 }
theorem Subalgebra.toNonUnitalSubalgebra_toSubalgebra (S : Subalgebra R A) :
S.toNonUnitalSubalgebra.toSubalgebra S.one_mem = S := by cases S; rfl
| Mathlib/Algebra/Algebra/Subalgebra/Unitization.lean | 73 | 75 | theorem NonUnitalSubalgebra.toSubalgebra_toNonUnitalSubalgebra (S : NonUnitalSubalgebra R A)
(h1 : (1 : A) ∈ S) : (NonUnitalSubalgebra.toSubalgebra S h1).toNonUnitalSubalgebra = S := by |
cases S; rfl
| true |
import Mathlib.Data.Finset.Fold
import Mathlib.Algebra.GCDMonoid.Multiset
#align_import algebra.gcd_monoid.finset from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
#align_import algebra.gcd_monoid.div from "leanprover-community/mathlib"@"b537794f8409bc9598febb79cd510b1df5f4539d"
variable {ι α β γ : Type*}
namespace Finset
open Multiset
variable [CancelCommMonoidWithZero α] [NormalizedGCDMonoid α]
section lcm
def lcm (s : Finset β) (f : β → α) : α :=
s.fold GCDMonoid.lcm 1 f
#align finset.lcm Finset.lcm
variable {s s₁ s₂ : Finset β} {f : β → α}
theorem lcm_def : s.lcm f = (s.1.map f).lcm :=
rfl
#align finset.lcm_def Finset.lcm_def
@[simp]
theorem lcm_empty : (∅ : Finset β).lcm f = 1 :=
fold_empty
#align finset.lcm_empty Finset.lcm_empty
@[simp]
theorem lcm_dvd_iff {a : α} : s.lcm f ∣ a ↔ ∀ b ∈ s, f b ∣ a := by
apply Iff.trans Multiset.lcm_dvd
simp only [Multiset.mem_map, and_imp, exists_imp]
exact ⟨fun k b hb ↦ k _ _ hb rfl, fun k a' b hb h ↦ h ▸ k _ hb⟩
#align finset.lcm_dvd_iff Finset.lcm_dvd_iff
theorem lcm_dvd {a : α} : (∀ b ∈ s, f b ∣ a) → s.lcm f ∣ a :=
lcm_dvd_iff.2
#align finset.lcm_dvd Finset.lcm_dvd
theorem dvd_lcm {b : β} (hb : b ∈ s) : f b ∣ s.lcm f :=
lcm_dvd_iff.1 dvd_rfl _ hb
#align finset.dvd_lcm Finset.dvd_lcm
@[simp]
| Mathlib/Algebra/GCDMonoid/Finset.lean | 77 | 82 | theorem lcm_insert [DecidableEq β] {b : β} :
(insert b s : Finset β).lcm f = GCDMonoid.lcm (f b) (s.lcm f) := by
by_cases h : b ∈ s |
by_cases h : b ∈ s
· rw [insert_eq_of_mem h,
(lcm_eq_right_iff (f b) (s.lcm f) (Multiset.normalize_lcm (s.1.map f))).2 (dvd_lcm h)]
apply fold_insert h
| true |
import Mathlib.FieldTheory.RatFunc.Defs
import Mathlib.RingTheory.EuclideanDomain
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.Polynomial.Content
#align_import field_theory.ratfunc from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u v
noncomputable section
open scoped Classical
open scoped nonZeroDivisors Polynomial
variable {K : Type u}
namespace RatFunc
section Field
variable [CommRing K]
protected irreducible_def zero : RatFunc K :=
⟨0⟩
#align ratfunc.zero RatFunc.zero
instance : Zero (RatFunc K) :=
⟨RatFunc.zero⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [zero_def]`
-- that does not close the goal
theorem ofFractionRing_zero : (ofFractionRing 0 : RatFunc K) = 0 := by
simp only [Zero.zero, OfNat.ofNat, RatFunc.zero]
#align ratfunc.of_fraction_ring_zero RatFunc.ofFractionRing_zero
protected irreducible_def add : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p + q⟩
#align ratfunc.add RatFunc.add
instance : Add (RatFunc K) :=
⟨RatFunc.add⟩
-- Porting note: added `HAdd.hAdd`. using `simp?` produces `simp only [add_def]`
-- that does not close the goal
theorem ofFractionRing_add (p q : FractionRing K[X]) :
ofFractionRing (p + q) = ofFractionRing p + ofFractionRing q := by
simp only [HAdd.hAdd, Add.add, RatFunc.add]
#align ratfunc.of_fraction_ring_add RatFunc.ofFractionRing_add
protected irreducible_def sub : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p - q⟩
#align ratfunc.sub RatFunc.sub
instance : Sub (RatFunc K) :=
⟨RatFunc.sub⟩
-- Porting note: added `HSub.hSub`. using `simp?` produces `simp only [sub_def]`
-- that does not close the goal
theorem ofFractionRing_sub (p q : FractionRing K[X]) :
ofFractionRing (p - q) = ofFractionRing p - ofFractionRing q := by
simp only [Sub.sub, HSub.hSub, RatFunc.sub]
#align ratfunc.of_fraction_ring_sub RatFunc.ofFractionRing_sub
protected irreducible_def neg : RatFunc K → RatFunc K
| ⟨p⟩ => ⟨-p⟩
#align ratfunc.neg RatFunc.neg
instance : Neg (RatFunc K) :=
⟨RatFunc.neg⟩
theorem ofFractionRing_neg (p : FractionRing K[X]) :
ofFractionRing (-p) = -ofFractionRing p := by simp only [Neg.neg, RatFunc.neg]
#align ratfunc.of_fraction_ring_neg RatFunc.ofFractionRing_neg
protected irreducible_def one : RatFunc K :=
⟨1⟩
#align ratfunc.one RatFunc.one
instance : One (RatFunc K) :=
⟨RatFunc.one⟩
-- Porting note: added `OfNat.ofNat`. using `simp?` produces `simp only [one_def]`
-- that does not close the goal
theorem ofFractionRing_one : (ofFractionRing 1 : RatFunc K) = 1 := by
simp only [One.one, OfNat.ofNat, RatFunc.one]
#align ratfunc.of_fraction_ring_one RatFunc.ofFractionRing_one
protected irreducible_def mul : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p * q⟩
#align ratfunc.mul RatFunc.mul
instance : Mul (RatFunc K) :=
⟨RatFunc.mul⟩
-- Porting note: added `HMul.hMul`. using `simp?` produces `simp only [mul_def]`
-- that does not close the goal
theorem ofFractionRing_mul (p q : FractionRing K[X]) :
ofFractionRing (p * q) = ofFractionRing p * ofFractionRing q := by
simp only [Mul.mul, HMul.hMul, RatFunc.mul]
#align ratfunc.of_fraction_ring_mul RatFunc.ofFractionRing_mul
section IsDomain
variable [IsDomain K]
protected irreducible_def div : RatFunc K → RatFunc K → RatFunc K
| ⟨p⟩, ⟨q⟩ => ⟨p / q⟩
#align ratfunc.div RatFunc.div
instance : Div (RatFunc K) :=
⟨RatFunc.div⟩
-- Porting note: added `HDiv.hDiv`. using `simp?` produces `simp only [div_def]`
-- that does not close the goal
theorem ofFractionRing_div (p q : FractionRing K[X]) :
ofFractionRing (p / q) = ofFractionRing p / ofFractionRing q := by
simp only [Div.div, HDiv.hDiv, RatFunc.div]
#align ratfunc.of_fraction_ring_div RatFunc.ofFractionRing_div
protected irreducible_def inv : RatFunc K → RatFunc K
| ⟨p⟩ => ⟨p⁻¹⟩
#align ratfunc.inv RatFunc.inv
instance : Inv (RatFunc K) :=
⟨RatFunc.inv⟩
| Mathlib/FieldTheory/RatFunc/Basic.lean | 177 | 179 | theorem ofFractionRing_inv (p : FractionRing K[X]) :
ofFractionRing p⁻¹ = (ofFractionRing p)⁻¹ := by |
simp only [Inv.inv, RatFunc.inv]
| true |
import Mathlib.Algebra.Homology.Single
#align_import algebra.homology.augment from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
open CategoryTheory Limits HomologicalComplex
universe v u
variable {V : Type u} [Category.{v} V]
namespace CochainComplex
@[simps]
def truncate [HasZeroMorphisms V] : CochainComplex V ℕ ⥤ CochainComplex V ℕ where
obj C :=
{ X := fun i => C.X (i + 1)
d := fun i j => C.d (i + 1) (j + 1)
shape := fun i j w => by
apply C.shape
simpa }
map f := { f := fun i => f.f (i + 1) }
#align cochain_complex.truncate CochainComplex.truncate
def toTruncate [HasZeroObject V] [HasZeroMorphisms V] (C : CochainComplex V ℕ) :
(single₀ V).obj (C.X 0) ⟶ truncate.obj C :=
(fromSingle₀Equiv (truncate.obj C) (C.X 0)).symm ⟨C.d 0 1, by aesop⟩
#align cochain_complex.to_truncate CochainComplex.toTruncate
variable [HasZeroMorphisms V]
def augment (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0) :
CochainComplex V ℕ where
X | 0 => X
| i + 1 => C.X i
d | 0, 1 => f
| i + 1, j + 1 => C.d i j
| _, _ => 0
shape i j s := by
simp? at s says simp only [ComplexShape.up_Rel] at s
rcases j with (_ | _ | j) <;> cases i <;> try simp
· contradiction
· rw [C.shape]
simp only [ComplexShape.up_Rel]
contrapose! s
rw [← s]
d_comp_d' i j k hij hjk := by
rcases k with (_ | _ | k) <;> rcases j with (_ | _ | j) <;> cases i <;> try simp
cases k
· exact w
· rw [C.shape, comp_zero]
simp only [Nat.zero_eq, ComplexShape.up_Rel, zero_add]
exact (Nat.one_lt_succ_succ _).ne
#align cochain_complex.augment CochainComplex.augment
@[simp]
theorem augment_X_zero (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0) :
(augment C f w).X 0 = X :=
rfl
set_option linter.uppercaseLean3 false in
#align cochain_complex.augment_X_zero CochainComplex.augment_X_zero
@[simp]
theorem augment_X_succ (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0)
(i : ℕ) : (augment C f w).X (i + 1) = C.X i :=
rfl
set_option linter.uppercaseLean3 false in
#align cochain_complex.augment_X_succ CochainComplex.augment_X_succ
@[simp]
theorem augment_d_zero_one (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0) :
(augment C f w).d 0 1 = f :=
rfl
#align cochain_complex.augment_d_zero_one CochainComplex.augment_d_zero_one
@[simp]
theorem augment_d_succ_succ (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0)
(i j : ℕ) : (augment C f w).d (i + 1) (j + 1) = C.d i j :=
rfl
#align cochain_complex.augment_d_succ_succ CochainComplex.augment_d_succ_succ
def truncateAugment (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0) (w : f ≫ C.d 0 1 = 0) :
truncate.obj (augment C f w) ≅ C where
hom := { f := fun i => 𝟙 _ }
inv :=
{ f := fun i => 𝟙 _
comm' := fun i j => by
cases j <;>
· dsimp
simp }
hom_inv_id := by
ext i
cases i <;>
· dsimp
simp
inv_hom_id := by
ext i
cases i <;>
· dsimp
simp
#align cochain_complex.truncate_augment CochainComplex.truncateAugment
@[simp]
theorem truncateAugment_hom_f (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0)
(w : f ≫ C.d 0 1 = 0) (i : ℕ) : (truncateAugment C f w).hom.f i = 𝟙 (C.X i) :=
rfl
#align cochain_complex.truncate_augment_hom_f CochainComplex.truncateAugment_hom_f
@[simp]
theorem truncateAugment_inv_f (C : CochainComplex V ℕ) {X : V} (f : X ⟶ C.X 0)
(w : f ≫ C.d 0 1 = 0) (i : ℕ) :
(truncateAugment C f w).inv.f i = 𝟙 ((truncate.obj (augment C f w)).X i) :=
rfl
#align cochain_complex.truncate_augment_inv_f CochainComplex.truncateAugment_inv_f
@[simp]
| Mathlib/Algebra/Homology/Augment.lean | 325 | 328 | theorem cochainComplex_d_succ_succ_zero (C : CochainComplex V ℕ) (i : ℕ) : C.d 0 (i + 2) = 0 := by
rw [C.shape] |
rw [C.shape]
simp only [ComplexShape.up_Rel, zero_add]
exact (Nat.one_lt_succ_succ _).ne
| true |
import Mathlib.Algebra.Group.ConjFinite
import Mathlib.GroupTheory.Abelianization
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.GroupAction.Quotient
import Mathlib.GroupTheory.Index
import Mathlib.GroupTheory.SpecificGroups.Dihedral
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.LinearCombination
import Mathlib.Tactic.Qify
#align_import group_theory.commuting_probability from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
noncomputable section
open scoped Classical
open Fintype
variable (M : Type*) [Mul M]
def commProb : ℚ :=
Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2
#align comm_prob commProb
theorem commProb_def :
commProb M = Nat.card { p : M × M // Commute p.1 p.2 } / (Nat.card M : ℚ) ^ 2 :=
rfl
#align comm_prob_def commProb_def
theorem commProb_prod (M' : Type*) [Mul M'] : commProb (M × M') = commProb M * commProb M' := by
simp_rw [commProb_def, div_mul_div_comm, Nat.card_prod, Nat.cast_mul, mul_pow, ← Nat.cast_mul,
← Nat.card_prod, Commute, SemiconjBy, Prod.ext_iff]
congr 2
exact Nat.card_congr ⟨fun x => ⟨⟨⟨x.1.1.1, x.1.2.1⟩, x.2.1⟩, ⟨⟨x.1.1.2, x.1.2.2⟩, x.2.2⟩⟩,
fun x => ⟨⟨⟨x.1.1.1, x.2.1.1⟩, ⟨x.1.1.2, x.2.1.2⟩⟩, ⟨x.1.2, x.2.2⟩⟩, fun x => rfl, fun x => rfl⟩
theorem commProb_pi {α : Type*} (i : α → Type*) [Fintype α] [∀ a, Mul (i a)] :
commProb (∀ a, i a) = ∏ a, commProb (i a) := by
simp_rw [commProb_def, Finset.prod_div_distrib, Finset.prod_pow, ← Nat.cast_prod,
← Nat.card_pi, Commute, SemiconjBy, Function.funext_iff]
congr 2
exact Nat.card_congr ⟨fun x a => ⟨⟨x.1.1 a, x.1.2 a⟩, x.2 a⟩, fun x => ⟨⟨fun a => (x a).1.1,
fun a => (x a).1.2⟩, fun a => (x a).2⟩, fun x => rfl, fun x => rfl⟩
theorem commProb_function {α β : Type*} [Fintype α] [Mul β] :
commProb (α → β) = (commProb β) ^ Fintype.card α := by
rw [commProb_pi, Finset.prod_const, Finset.card_univ]
@[simp]
theorem commProb_eq_zero_of_infinite [Infinite M] : commProb M = 0 :=
div_eq_zero_iff.2 (Or.inl (Nat.cast_eq_zero.2 Nat.card_eq_zero_of_infinite))
variable [Finite M]
theorem commProb_pos [h : Nonempty M] : 0 < commProb M :=
h.elim fun x ↦
div_pos (Nat.cast_pos.mpr (Finite.card_pos_iff.mpr ⟨⟨(x, x), rfl⟩⟩))
(pow_pos (Nat.cast_pos.mpr Finite.card_pos) 2)
#align comm_prob_pos commProb_pos
| Mathlib/GroupTheory/CommutingProbability.lean | 78 | 81 | theorem commProb_le_one : commProb M ≤ 1 := by
refine div_le_one_of_le ?_ (sq_nonneg (Nat.card M : ℚ)) |
refine div_le_one_of_le ?_ (sq_nonneg (Nat.card M : ℚ))
rw [← Nat.cast_pow, Nat.cast_le, sq, ← Nat.card_prod]
apply Finite.card_subtype_le
| true |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.MonoidAlgebra.Basic
import Mathlib.Data.Finset.Sort
#align_import data.polynomial.basic from "leanprover-community/mathlib"@"949dc57e616a621462062668c9f39e4e17b64b69"
set_option linter.uppercaseLean3 false
noncomputable section
structure Polynomial (R : Type*) [Semiring R] where ofFinsupp ::
toFinsupp : AddMonoidAlgebra R ℕ
#align polynomial Polynomial
#align polynomial.of_finsupp Polynomial.ofFinsupp
#align polynomial.to_finsupp Polynomial.toFinsupp
@[inherit_doc] scoped[Polynomial] notation:9000 R "[X]" => Polynomial R
open AddMonoidAlgebra
open Finsupp hiding single
open Function hiding Commute
open Polynomial
namespace Polynomial
universe u
variable {R : Type u} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q : R[X]}
theorem forall_iff_forall_finsupp (P : R[X] → Prop) :
(∀ p, P p) ↔ ∀ q : R[ℕ], P ⟨q⟩ :=
⟨fun h q => h ⟨q⟩, fun h ⟨p⟩ => h p⟩
#align polynomial.forall_iff_forall_finsupp Polynomial.forall_iff_forall_finsupp
theorem exists_iff_exists_finsupp (P : R[X] → Prop) :
(∃ p, P p) ↔ ∃ q : R[ℕ], P ⟨q⟩ :=
⟨fun ⟨⟨p⟩, hp⟩ => ⟨p, hp⟩, fun ⟨q, hq⟩ => ⟨⟨q⟩, hq⟩⟩
#align polynomial.exists_iff_exists_finsupp Polynomial.exists_iff_exists_finsupp
@[simp]
theorem eta (f : R[X]) : Polynomial.ofFinsupp f.toFinsupp = f := by cases f; rfl
#align polynomial.eta Polynomial.eta
section AddMonoidAlgebra
private irreducible_def add : R[X] → R[X] → R[X]
| ⟨a⟩, ⟨b⟩ => ⟨a + b⟩
private irreducible_def neg {R : Type u} [Ring R] : R[X] → R[X]
| ⟨a⟩ => ⟨-a⟩
private irreducible_def mul : R[X] → R[X] → R[X]
| ⟨a⟩, ⟨b⟩ => ⟨a * b⟩
instance zero : Zero R[X] :=
⟨⟨0⟩⟩
#align polynomial.has_zero Polynomial.zero
instance one : One R[X] :=
⟨⟨1⟩⟩
#align polynomial.one Polynomial.one
instance add' : Add R[X] :=
⟨add⟩
#align polynomial.has_add Polynomial.add'
instance neg' {R : Type u} [Ring R] : Neg R[X] :=
⟨neg⟩
#align polynomial.has_neg Polynomial.neg'
instance sub {R : Type u} [Ring R] : Sub R[X] :=
⟨fun a b => a + -b⟩
#align polynomial.has_sub Polynomial.sub
instance mul' : Mul R[X] :=
⟨mul⟩
#align polynomial.has_mul Polynomial.mul'
-- If the private definitions are accidentally exposed, simplify them away.
@[simp] theorem add_eq_add : add p q = p + q := rfl
@[simp] theorem mul_eq_mul : mul p q = p * q := rfl
instance smulZeroClass {S : Type*} [SMulZeroClass S R] : SMulZeroClass S R[X] where
smul r p := ⟨r • p.toFinsupp⟩
smul_zero a := congr_arg ofFinsupp (smul_zero a)
#align polynomial.smul_zero_class Polynomial.smulZeroClass
-- to avoid a bug in the `ring` tactic
instance (priority := 1) pow : Pow R[X] ℕ where pow p n := npowRec n p
#align polynomial.has_pow Polynomial.pow
@[simp]
theorem ofFinsupp_zero : (⟨0⟩ : R[X]) = 0 :=
rfl
#align polynomial.of_finsupp_zero Polynomial.ofFinsupp_zero
@[simp]
theorem ofFinsupp_one : (⟨1⟩ : R[X]) = 1 :=
rfl
#align polynomial.of_finsupp_one Polynomial.ofFinsupp_one
@[simp]
theorem ofFinsupp_add {a b} : (⟨a + b⟩ : R[X]) = ⟨a⟩ + ⟨b⟩ :=
show _ = add _ _ by rw [add_def]
#align polynomial.of_finsupp_add Polynomial.ofFinsupp_add
@[simp]
theorem ofFinsupp_neg {R : Type u} [Ring R] {a} : (⟨-a⟩ : R[X]) = -⟨a⟩ :=
show _ = neg _ by rw [neg_def]
#align polynomial.of_finsupp_neg Polynomial.ofFinsupp_neg
@[simp]
| Mathlib/Algebra/Polynomial/Basic.lean | 178 | 180 | theorem ofFinsupp_sub {R : Type u} [Ring R] {a b} : (⟨a - b⟩ : R[X]) = ⟨a⟩ - ⟨b⟩ := by
rw [sub_eq_add_neg, ofFinsupp_add, ofFinsupp_neg] |
rw [sub_eq_add_neg, ofFinsupp_add, ofFinsupp_neg]
rfl
| true |
import Mathlib.Order.Filter.Basic
#align_import order.filter.prod from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
open Set
open Filter
namespace Filter
variable {α β γ δ : Type*} {ι : Sort*}
section Prod
variable {s : Set α} {t : Set β} {f : Filter α} {g : Filter β}
protected def prod (f : Filter α) (g : Filter β) : Filter (α × β) :=
f.comap Prod.fst ⊓ g.comap Prod.snd
#align filter.prod Filter.prod
instance instSProd : SProd (Filter α) (Filter β) (Filter (α × β)) where
sprod := Filter.prod
theorem prod_mem_prod (hs : s ∈ f) (ht : t ∈ g) : s ×ˢ t ∈ f ×ˢ g :=
inter_mem_inf (preimage_mem_comap hs) (preimage_mem_comap ht)
#align filter.prod_mem_prod Filter.prod_mem_prod
theorem mem_prod_iff {s : Set (α × β)} {f : Filter α} {g : Filter β} :
s ∈ f ×ˢ g ↔ ∃ t₁ ∈ f, ∃ t₂ ∈ g, t₁ ×ˢ t₂ ⊆ s := by
simp only [SProd.sprod, Filter.prod]
constructor
· rintro ⟨t₁, ⟨s₁, hs₁, hts₁⟩, t₂, ⟨s₂, hs₂, hts₂⟩, rfl⟩
exact ⟨s₁, hs₁, s₂, hs₂, fun p ⟨h, h'⟩ => ⟨hts₁ h, hts₂ h'⟩⟩
· rintro ⟨t₁, ht₁, t₂, ht₂, h⟩
exact mem_inf_of_inter (preimage_mem_comap ht₁) (preimage_mem_comap ht₂) h
#align filter.mem_prod_iff Filter.mem_prod_iff
@[simp]
theorem prod_mem_prod_iff [f.NeBot] [g.NeBot] : s ×ˢ t ∈ f ×ˢ g ↔ s ∈ f ∧ t ∈ g :=
⟨fun h =>
let ⟨_s', hs', _t', ht', H⟩ := mem_prod_iff.1 h
(prod_subset_prod_iff.1 H).elim
(fun ⟨hs's, ht't⟩ => ⟨mem_of_superset hs' hs's, mem_of_superset ht' ht't⟩) fun h =>
h.elim (fun hs'e => absurd hs'e (nonempty_of_mem hs').ne_empty) fun ht'e =>
absurd ht'e (nonempty_of_mem ht').ne_empty,
fun h => prod_mem_prod h.1 h.2⟩
#align filter.prod_mem_prod_iff Filter.prod_mem_prod_iff
theorem mem_prod_principal {s : Set (α × β)} :
s ∈ f ×ˢ 𝓟 t ↔ { a | ∀ b ∈ t, (a, b) ∈ s } ∈ f := by
rw [← @exists_mem_subset_iff _ f, mem_prod_iff]
refine exists_congr fun u => Iff.rfl.and ⟨?_, fun h => ⟨t, mem_principal_self t, ?_⟩⟩
· rintro ⟨v, v_in, hv⟩ a a_in b b_in
exact hv (mk_mem_prod a_in <| v_in b_in)
· rintro ⟨x, y⟩ ⟨hx, hy⟩
exact h hx y hy
#align filter.mem_prod_principal Filter.mem_prod_principal
theorem mem_prod_top {s : Set (α × β)} :
s ∈ f ×ˢ (⊤ : Filter β) ↔ { a | ∀ b, (a, b) ∈ s } ∈ f := by
rw [← principal_univ, mem_prod_principal]
simp only [mem_univ, forall_true_left]
#align filter.mem_prod_top Filter.mem_prod_top
| Mathlib/Order/Filter/Prod.lean | 101 | 104 | theorem eventually_prod_principal_iff {p : α × β → Prop} {s : Set β} :
(∀ᶠ x : α × β in f ×ˢ 𝓟 s, p x) ↔ ∀ᶠ x : α in f, ∀ y : β, y ∈ s → p (x, y) := by
rw [eventually_iff, eventually_iff, mem_prod_principal] |
rw [eventually_iff, eventually_iff, mem_prod_principal]
simp only [mem_setOf_eq]
| true |
import Mathlib.Order.CompleteLattice
import Mathlib.Order.GaloisConnection
import Mathlib.Data.Set.Lattice
import Mathlib.Tactic.AdaptationNote
#align_import data.rel from "leanprover-community/mathlib"@"706d88f2b8fdfeb0b22796433d7a6c1a010af9f2"
variable {α β γ : Type*}
def Rel (α β : Type*) :=
α → β → Prop -- deriving CompleteLattice, Inhabited
#align rel Rel
-- Porting note: `deriving` above doesn't work.
instance : CompleteLattice (Rel α β) := show CompleteLattice (α → β → Prop) from inferInstance
instance : Inhabited (Rel α β) := show Inhabited (α → β → Prop) from inferInstance
namespace Rel
variable (r : Rel α β)
-- Porting note: required for later theorems.
@[ext] theorem ext {r s : Rel α β} : (∀ a, r a = s a) → r = s := funext
def inv : Rel β α :=
flip r
#align rel.inv Rel.inv
theorem inv_def (x : α) (y : β) : r.inv y x ↔ r x y :=
Iff.rfl
#align rel.inv_def Rel.inv_def
theorem inv_inv : inv (inv r) = r := by
ext x y
rfl
#align rel.inv_inv Rel.inv_inv
def dom := { x | ∃ y, r x y }
#align rel.dom Rel.dom
theorem dom_mono {r s : Rel α β} (h : r ≤ s) : dom r ⊆ dom s := fun a ⟨b, hx⟩ => ⟨b, h a b hx⟩
#align rel.dom_mono Rel.dom_mono
def codom := { y | ∃ x, r x y }
#align rel.codom Rel.codom
theorem codom_inv : r.inv.codom = r.dom := by
ext x
rfl
#align rel.codom_inv Rel.codom_inv
theorem dom_inv : r.inv.dom = r.codom := by
ext x
rfl
#align rel.dom_inv Rel.dom_inv
def comp (r : Rel α β) (s : Rel β γ) : Rel α γ := fun x z => ∃ y, r x y ∧ s y z
#align rel.comp Rel.comp
-- Porting note: the original `∘` syntax can't be overloaded here, lean considers it ambiguous.
local infixr:90 " • " => Rel.comp
theorem comp_assoc {δ : Type*} (r : Rel α β) (s : Rel β γ) (t : Rel γ δ) :
(r • s) • t = r • (s • t) := by
unfold comp; ext (x w); constructor
· rintro ⟨z, ⟨y, rxy, syz⟩, tzw⟩; exact ⟨y, rxy, z, syz, tzw⟩
· rintro ⟨y, rxy, z, syz, tzw⟩; exact ⟨z, ⟨y, rxy, syz⟩, tzw⟩
#align rel.comp_assoc Rel.comp_assoc
@[simp]
theorem comp_right_id (r : Rel α β) : r • @Eq β = r := by
unfold comp
ext y
simp
#align rel.comp_right_id Rel.comp_right_id
@[simp]
theorem comp_left_id (r : Rel α β) : @Eq α • r = r := by
unfold comp
ext x
simp
#align rel.comp_left_id Rel.comp_left_id
@[simp]
theorem comp_right_bot (r : Rel α β) : r • (⊥ : Rel β γ) = ⊥ := by
ext x y
simp [comp, Bot.bot]
@[simp]
theorem comp_left_bot (r : Rel α β) : (⊥ : Rel γ α) • r = ⊥ := by
ext x y
simp [comp, Bot.bot]
@[simp]
theorem comp_right_top (r : Rel α β) : r • (⊤ : Rel β γ) = fun x _ ↦ x ∈ r.dom := by
ext x z
simp [comp, Top.top, dom]
@[simp]
theorem comp_left_top (r : Rel α β) : (⊤ : Rel γ α) • r = fun _ y ↦ y ∈ r.codom := by
ext x z
simp [comp, Top.top, codom]
theorem inv_id : inv (@Eq α) = @Eq α := by
ext x y
constructor <;> apply Eq.symm
#align rel.inv_id Rel.inv_id
theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv r := by
ext x z
simp [comp, inv, flip, and_comm]
#align rel.inv_comp Rel.inv_comp
@[simp]
| Mathlib/Data/Rel.lean | 156 | 158 | theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by
#adaptation_note /-- nightly-2024-03-16: simp was `simp [Bot.bot, inv, flip]` -/ |
#adaptation_note /-- nightly-2024-03-16: simp was `simp [Bot.bot, inv, flip]` -/
simp [Bot.bot, inv, Function.flip_def]
| true |
import Mathlib.Data.Set.Basic
#align_import data.set.bool_indicator from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
open Bool
namespace Set
variable {α : Type*} (s : Set α)
noncomputable def boolIndicator (x : α) :=
@ite _ (x ∈ s) (Classical.propDecidable _) true false
#align set.bool_indicator Set.boolIndicator
theorem mem_iff_boolIndicator (x : α) : x ∈ s ↔ s.boolIndicator x = true := by
unfold boolIndicator
split_ifs with h <;> simp [h]
#align set.mem_iff_bool_indicator Set.mem_iff_boolIndicator
| Mathlib/Data/Set/BoolIndicator.lean | 32 | 34 | theorem not_mem_iff_boolIndicator (x : α) : x ∉ s ↔ s.boolIndicator x = false := by
unfold boolIndicator |
unfold boolIndicator
split_ifs with h <;> simp [h]
| true |
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Data.Nat.Choose.Sum
import Mathlib.RingTheory.PowerSeries.Basic
#align_import ring_theory.power_series.well_known from "leanprover-community/mathlib"@"8199f6717c150a7fe91c4534175f4cf99725978f"
namespace PowerSeries
section Field
variable (A A' : Type*) [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A']
open Nat
def exp : PowerSeries A :=
mk fun n => algebraMap ℚ A (1 / n !)
#align power_series.exp PowerSeries.exp
def sin : PowerSeries A :=
mk fun n => if Even n then 0 else algebraMap ℚ A ((-1) ^ (n / 2) / n !)
#align power_series.sin PowerSeries.sin
def cos : PowerSeries A :=
mk fun n => if Even n then algebraMap ℚ A ((-1) ^ (n / 2) / n !) else 0
#align power_series.cos PowerSeries.cos
variable {A A'} [Ring A] [Ring A'] [Algebra ℚ A] [Algebra ℚ A'] (n : ℕ) (f : A →+* A')
@[simp]
theorem coeff_exp : coeff A n (exp A) = algebraMap ℚ A (1 / n !) :=
coeff_mk _ _
#align power_series.coeff_exp PowerSeries.coeff_exp
@[simp]
theorem constantCoeff_exp : constantCoeff A (exp A) = 1 := by
rw [← coeff_zero_eq_constantCoeff_apply, coeff_exp]
simp
#align power_series.constant_coeff_exp PowerSeries.constantCoeff_exp
set_option linter.deprecated false in
@[simp]
| Mathlib/RingTheory/PowerSeries/WellKnown.lean | 181 | 182 | theorem coeff_sin_bit0 : coeff A (bit0 n) (sin A) = 0 := by |
rw [sin, coeff_mk, if_pos (even_bit0 n)]
| true |
import Mathlib.LinearAlgebra.Dimension.Finrank
import Mathlib.LinearAlgebra.InvariantBasisNumber
#align_import linear_algebra.dimension from "leanprover-community/mathlib"@"47a5f8186becdbc826190ced4312f8199f9db6a5"
noncomputable section
universe u v w w'
variable {R : Type u} {M : Type v} [Ring R] [AddCommGroup M] [Module R M]
variable {ι : Type w} {ι' : Type w'}
open Cardinal Basis Submodule Function Set
attribute [local instance] nontrivial_of_invariantBasisNumber
section StrongRankCondition
variable [StrongRankCondition R]
open Submodule
-- An auxiliary lemma for `linearIndependent_le_span'`,
-- with the additional assumption that the linearly independent family is finite.
theorem linearIndependent_le_span_aux' {ι : Type*} [Fintype ι] (v : ι → M)
(i : LinearIndependent R v) (w : Set M) [Fintype w] (s : range v ≤ span R w) :
Fintype.card ι ≤ Fintype.card w := by
-- We construct an injective linear map `(ι → R) →ₗ[R] (w → R)`,
-- by thinking of `f : ι → R` as a linear combination of the finite family `v`,
-- and expressing that (using the axiom of choice) as a linear combination over `w`.
-- We can do this linearly by constructing the map on a basis.
fapply card_le_of_injective' R
· apply Finsupp.total
exact fun i => Span.repr R w ⟨v i, s (mem_range_self i)⟩
· intro f g h
apply_fun Finsupp.total w M R (↑) at h
simp only [Finsupp.total_total, Submodule.coe_mk, Span.finsupp_total_repr] at h
rw [← sub_eq_zero, ← LinearMap.map_sub] at h
exact sub_eq_zero.mp (linearIndependent_iff.mp i _ h)
#align linear_independent_le_span_aux' linearIndependent_le_span_aux'
lemma LinearIndependent.finite_of_le_span_finite {ι : Type*} (v : ι → M) (i : LinearIndependent R v)
(w : Set M) [Finite w] (s : range v ≤ span R w) : Finite ι :=
letI := Fintype.ofFinite w
Fintype.finite <| fintypeOfFinsetCardLe (Fintype.card w) fun t => by
let v' := fun x : (t : Set ι) => v x
have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective
have s' : range v' ≤ span R w := (range_comp_subset_range _ _).trans s
simpa using linearIndependent_le_span_aux' v' i' w s'
#align linear_independent_fintype_of_le_span_fintype LinearIndependent.finite_of_le_span_finite
theorem linearIndependent_le_span' {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M)
[Fintype w] (s : range v ≤ span R w) : #ι ≤ Fintype.card w := by
haveI : Finite ι := i.finite_of_le_span_finite v w s
letI := Fintype.ofFinite ι
rw [Cardinal.mk_fintype]
simp only [Cardinal.natCast_le]
exact linearIndependent_le_span_aux' v i w s
#align linear_independent_le_span' linearIndependent_le_span'
theorem linearIndependent_le_span {ι : Type*} (v : ι → M) (i : LinearIndependent R v) (w : Set M)
[Fintype w] (s : span R w = ⊤) : #ι ≤ Fintype.card w := by
apply linearIndependent_le_span' v i w
rw [s]
exact le_top
#align linear_independent_le_span linearIndependent_le_span
theorem linearIndependent_le_span_finset {ι : Type*} (v : ι → M) (i : LinearIndependent R v)
(w : Finset M) (s : span R (w : Set M) = ⊤) : #ι ≤ w.card := by
simpa only [Finset.coe_sort_coe, Fintype.card_coe] using linearIndependent_le_span v i w s
#align linear_independent_le_span_finset linearIndependent_le_span_finset
theorem linearIndependent_le_infinite_basis {ι : Type w} (b : Basis ι R M) [Infinite ι] {κ : Type w}
(v : κ → M) (i : LinearIndependent R v) : #κ ≤ #ι := by
classical
by_contra h
rw [not_le, ← Cardinal.mk_finset_of_infinite ι] at h
let Φ := fun k : κ => (b.repr (v k)).support
obtain ⟨s, w : Infinite ↑(Φ ⁻¹' {s})⟩ := Cardinal.exists_infinite_fiber Φ h (by infer_instance)
let v' := fun k : Φ ⁻¹' {s} => v k
have i' : LinearIndependent R v' := i.comp _ Subtype.val_injective
have w' : Finite (Φ ⁻¹' {s}) := by
apply i'.finite_of_le_span_finite v' (s.image b)
rintro m ⟨⟨p, ⟨rfl⟩⟩, rfl⟩
simp only [SetLike.mem_coe, Subtype.coe_mk, Finset.coe_image]
apply Basis.mem_span_repr_support
exact w.false
#align linear_independent_le_infinite_basis linearIndependent_le_infinite_basis
| Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean | 266 | 276 | theorem linearIndependent_le_basis {ι : Type w} (b : Basis ι R M) {κ : Type w} (v : κ → M)
(i : LinearIndependent R v) : #κ ≤ #ι := by
classical |
classical
-- We split into cases depending on whether `ι` is infinite.
cases fintypeOrInfinite ι
· rw [Cardinal.mk_fintype ι] -- When `ι` is finite, we have `linearIndependent_le_span`,
haveI : Nontrivial R := nontrivial_of_invariantBasisNumber R
rw [Fintype.card_congr (Equiv.ofInjective b b.injective)]
exact linearIndependent_le_span v i (range b) b.span_eq
· -- and otherwise we have `linearIndependent_le_infinite_basis`.
exact linearIndependent_le_infinite_basis b v i
| true |
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.
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
#align lucas_lehmer.int.coe_nat_pow_pred LucasLehmer.Int.natCast_pow_pred
@[deprecated (since := "2024-05-25")] alias Int.coe_nat_pow_pred := Int.natCast_pow_pred
theorem Int.coe_nat_two_pow_pred (p : ℕ) : ((2 ^ p - 1 : ℕ) : ℤ) = (2 ^ p - 1 : ℤ) :=
Int.natCast_pow_pred 2 p (by decide)
#align lucas_lehmer.int.coe_nat_two_pow_pred LucasLehmer.Int.coe_nat_two_pow_pred
| Mathlib/NumberTheory/LucasLehmer.lean | 173 | 174 | theorem sZMod_eq_sMod (p : ℕ) (i : ℕ) : sZMod p i = (sMod p i : ZMod (2 ^ p - 1)) := by |
induction i <;> push_cast [← Int.coe_nat_two_pow_pred p, sMod, sZMod, *] <;> rfl
| true |
import Mathlib.Algebra.Field.Defs
import Mathlib.Tactic.Common
#align_import algebra.field.defs from "leanprover-community/mathlib"@"2651125b48fc5c170ab1111afd0817c903b1fc6c"
universe u
section IsField
structure IsField (R : Type u) [Semiring R] : Prop where
exists_pair_ne : ∃ x y : R, x ≠ y
mul_comm : ∀ x y : R, x * y = y * x
mul_inv_cancel : ∀ {a : R}, a ≠ 0 → ∃ b, a * b = 1
#align is_field IsField
theorem Semifield.toIsField (R : Type u) [Semifield R] : IsField R where
__ := ‹Semifield R›
mul_inv_cancel {a} ha := ⟨a⁻¹, mul_inv_cancel ha⟩
#align semifield.to_is_field Semifield.toIsField
theorem Field.toIsField (R : Type u) [Field R] : IsField R :=
Semifield.toIsField _
#align field.to_is_field Field.toIsField
@[simp]
theorem IsField.nontrivial {R : Type u} [Semiring R] (h : IsField R) : Nontrivial R :=
⟨h.exists_pair_ne⟩
#align is_field.nontrivial IsField.nontrivial
@[simp]
theorem not_isField_of_subsingleton (R : Type u) [Semiring R] [Subsingleton R] : ¬IsField R :=
fun h =>
let ⟨_, _, h⟩ := h.exists_pair_ne
h (Subsingleton.elim _ _)
#align not_is_field_of_subsingleton not_isField_of_subsingleton
open scoped Classical
noncomputable def IsField.toSemifield {R : Type u} [Semiring R] (h : IsField R) : Semifield R where
__ := ‹Semiring R›
__ := h
inv a := if ha : a = 0 then 0 else Classical.choose (h.mul_inv_cancel ha)
inv_zero := dif_pos rfl
mul_inv_cancel a ha := by convert Classical.choose_spec (h.mul_inv_cancel ha); exact dif_neg ha
nnqsmul := _
#align is_field.to_semifield IsField.toSemifield
noncomputable def IsField.toField {R : Type u} [Ring R] (h : IsField R) : Field R :=
{ ‹Ring R›, IsField.toSemifield h with qsmul := _ }
#align is_field.to_field IsField.toField
| Mathlib/Algebra/Field/IsField.lean | 84 | 93 | theorem uniq_inv_of_isField (R : Type u) [Ring R] (hf : IsField R) :
∀ x : R, x ≠ 0 → ∃! y : R, x * y = 1 := by
intro x hx |
intro x hx
apply exists_unique_of_exists_of_unique
· exact hf.mul_inv_cancel hx
· intro y z hxy hxz
calc
y = y * (x * z) := by rw [hxz, mul_one]
_ = x * y * z := by rw [← mul_assoc, hf.mul_comm y x]
_ = z := by rw [hxy, one_mul]
| true |
import Mathlib.CategoryTheory.Limits.Shapes.SplitCoequalizer
import Mathlib.CategoryTheory.Limits.Preserves.Basic
#align_import category_theory.limits.preserves.shapes.equalizers from "leanprover-community/mathlib"@"4698e35ca56a0d4fa53aa5639c3364e0a77f4eba"
noncomputable section
universe w v₁ v₂ u₁ u₂
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits
variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
variable (G : C ⥤ D)
namespace CategoryTheory.Limits
section Coequalizers
variable {X Y Z : C} {f g : X ⟶ Y} {h : Y ⟶ Z} (w : f ≫ h = g ≫ h)
def isColimitMapCoconeCoforkEquiv :
IsColimit (G.mapCocone (Cofork.ofπ h w)) ≃
IsColimit
(Cofork.ofπ (G.map h) (by simp only [← G.map_comp, w]) : Cofork (G.map f) (G.map g)) :=
(IsColimit.precomposeInvEquiv (diagramIsoParallelPair _) _).symm.trans <|
IsColimit.equivIsoColimit <|
Cofork.ext (Iso.refl _) <| by
dsimp only [Cofork.π, Cofork.ofπ_ι_app]
dsimp; rw [Category.comp_id, Category.id_comp]
#align category_theory.limits.is_colimit_map_cocone_cofork_equiv CategoryTheory.Limits.isColimitMapCoconeCoforkEquiv
def isColimitCoforkMapOfIsColimit [PreservesColimit (parallelPair f g) G]
(l : IsColimit (Cofork.ofπ h w)) :
IsColimit
(Cofork.ofπ (G.map h) (by simp only [← G.map_comp, w]) : Cofork (G.map f) (G.map g)) :=
isColimitMapCoconeCoforkEquiv G w (PreservesColimit.preserves l)
#align category_theory.limits.is_colimit_cofork_map_of_is_colimit CategoryTheory.Limits.isColimitCoforkMapOfIsColimit
def isColimitOfIsColimitCoforkMap [ReflectsColimit (parallelPair f g) G]
(l :
IsColimit
(Cofork.ofπ (G.map h) (by simp only [← G.map_comp, w]) : Cofork (G.map f) (G.map g))) :
IsColimit (Cofork.ofπ h w) :=
ReflectsColimit.reflects ((isColimitMapCoconeCoforkEquiv G w).symm l)
#align category_theory.limits.is_colimit_of_is_colimit_cofork_map CategoryTheory.Limits.isColimitOfIsColimitCoforkMap
variable (f g) [HasCoequalizer f g]
def isColimitOfHasCoequalizerOfPreservesColimit [PreservesColimit (parallelPair f g) G] :
IsColimit (Cofork.ofπ (G.map (coequalizer.π f g)) (by
simp only [← G.map_comp]; rw [coequalizer.condition]) : Cofork (G.map f) (G.map g)) :=
isColimitCoforkMapOfIsColimit G _ (coequalizerIsCoequalizer f g)
#align category_theory.limits.is_colimit_of_has_coequalizer_of_preserves_colimit CategoryTheory.Limits.isColimitOfHasCoequalizerOfPreservesColimit
variable [HasCoequalizer (G.map f) (G.map g)]
def ofIsoComparison [i : IsIso (coequalizerComparison f g G)] :
PreservesColimit (parallelPair f g) G := by
apply preservesColimitOfPreservesColimitCocone (coequalizerIsCoequalizer f g)
apply (isColimitMapCoconeCoforkEquiv _ _).symm _
refine
@IsColimit.ofPointIso _ _ _ _ _ _ _ (colimit.isColimit (parallelPair (G.map f) (G.map g))) ?_
apply i
#align category_theory.limits.of_iso_comparison CategoryTheory.Limits.ofIsoComparison
variable [PreservesColimit (parallelPair f g) G]
def PreservesCoequalizer.iso : coequalizer (G.map f) (G.map g) ≅ G.obj (coequalizer f g) :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _)
(isColimitOfHasCoequalizerOfPreservesColimit G f g)
#align category_theory.limits.preserves_coequalizer.iso CategoryTheory.Limits.PreservesCoequalizer.iso
@[simp]
theorem PreservesCoequalizer.iso_hom :
(PreservesCoequalizer.iso G f g).hom = coequalizerComparison f g G :=
rfl
#align category_theory.limits.preserves_coequalizer.iso_hom CategoryTheory.Limits.PreservesCoequalizer.iso_hom
instance : IsIso (coequalizerComparison f g G) := by
rw [← PreservesCoequalizer.iso_hom]
infer_instance
instance map_π_epi : Epi (G.map (coequalizer.π f g)) :=
⟨fun {W} h k => by
rw [← ι_comp_coequalizerComparison]
haveI : Epi (coequalizer.π (G.map f) (G.map g) ≫ coequalizerComparison f g G) := by
apply epi_comp
apply (cancel_epi _).1⟩
#align category_theory.limits.map_π_epi CategoryTheory.Limits.map_π_epi
@[reassoc]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Equalizers.lean | 207 | 211 | theorem map_π_preserves_coequalizer_inv :
G.map (coequalizer.π f g) ≫ (PreservesCoequalizer.iso G f g).inv =
coequalizer.π (G.map f) (G.map g) := by
rw [← ι_comp_coequalizerComparison_assoc, ← PreservesCoequalizer.iso_hom, Iso.hom_inv_id, |
rw [← ι_comp_coequalizerComparison_assoc, ← PreservesCoequalizer.iso_hom, Iso.hom_inv_id,
comp_id]
| true |
import Mathlib.Analysis.PSeries
import Mathlib.Data.Real.Pi.Wallis
import Mathlib.Tactic.AdaptationNote
#align_import analysis.special_functions.stirling from "leanprover-community/mathlib"@"2c1d8ca2812b64f88992a5294ea3dba144755cd1"
open scoped Topology Real Nat Asymptotics
open Finset Filter Nat Real
namespace Stirling
noncomputable def stirlingSeq (n : ℕ) : ℝ :=
n ! / (√(2 * n : ℝ) * (n / exp 1) ^ n)
#align stirling.stirling_seq Stirling.stirlingSeq
@[simp]
theorem stirlingSeq_zero : stirlingSeq 0 = 0 := by
rw [stirlingSeq, cast_zero, mul_zero, Real.sqrt_zero, zero_mul, div_zero]
#align stirling.stirling_seq_zero Stirling.stirlingSeq_zero
@[simp]
theorem stirlingSeq_one : stirlingSeq 1 = exp 1 / √2 := by
rw [stirlingSeq, pow_one, factorial_one, cast_one, mul_one, mul_one_div, one_div_div]
#align stirling.stirling_seq_one Stirling.stirlingSeq_one
theorem log_stirlingSeq_formula (n : ℕ) :
log (stirlingSeq n) = Real.log n ! - 1 / 2 * Real.log (2 * n) - n * log (n / exp 1) := by
cases n
· simp
· rw [stirlingSeq, log_div, log_mul, sqrt_eq_rpow, log_rpow, Real.log_pow, tsub_tsub]
<;> positivity
-- Porting note: generalized from `n.succ` to `n`
#align stirling.log_stirling_seq_formula Stirling.log_stirlingSeq_formulaₓ
theorem log_stirlingSeq_diff_hasSum (m : ℕ) :
HasSum (fun k : ℕ => (1 : ℝ) / (2 * ↑(k + 1) + 1) * ((1 / (2 * ↑(m + 1) + 1)) ^ 2) ^ ↑(k + 1))
(log (stirlingSeq (m + 1)) - log (stirlingSeq (m + 2))) := by
let f (k : ℕ) := (1 : ℝ) / (2 * k + 1) * ((1 / (2 * ↑(m + 1) + 1)) ^ 2) ^ k
change HasSum (fun k => f (k + 1)) _
rw [hasSum_nat_add_iff]
convert (hasSum_log_one_add_inv m.cast_add_one_pos).mul_left ((↑(m + 1) : ℝ) + 1 / 2) using 1
· ext k
dsimp only [f]
rw [← pow_mul, pow_add]
push_cast
field_simp
ring
· have h : ∀ x ≠ (0 : ℝ), 1 + x⁻¹ = (x + 1) / x := fun x hx ↦ by field_simp [hx]
simp (disch := positivity) only [log_stirlingSeq_formula, log_div, log_mul, log_exp,
factorial_succ, cast_mul, cast_succ, cast_zero, range_one, sum_singleton, h]
ring
#align stirling.log_stirling_seq_diff_has_sum Stirling.log_stirlingSeq_diff_hasSum
theorem log_stirlingSeq'_antitone : Antitone (Real.log ∘ stirlingSeq ∘ succ) :=
antitone_nat_of_succ_le fun n =>
sub_nonneg.mp <| (log_stirlingSeq_diff_hasSum n).nonneg fun m => by positivity
#align stirling.log_stirling_seq'_antitone Stirling.log_stirlingSeq'_antitone
| Mathlib/Analysis/SpecialFunctions/Stirling.lean | 104 | 120 | theorem log_stirlingSeq_diff_le_geo_sum (n : ℕ) :
log (stirlingSeq (n + 1)) - log (stirlingSeq (n + 2)) ≤
((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2 / (1 - ((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2) := by
have h_nonneg : (0 : ℝ) ≤ ((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2 := sq_nonneg _ |
have h_nonneg : (0 : ℝ) ≤ ((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2 := sq_nonneg _
have g : HasSum (fun k : ℕ => (((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2) ^ ↑(k + 1))
(((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2 / (1 - ((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2)) := by
have := (hasSum_geometric_of_lt_one h_nonneg ?_).mul_left (((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2)
· simp_rw [← _root_.pow_succ'] at this
exact this
rw [one_div, inv_pow]
exact inv_lt_one (one_lt_pow ((lt_add_iff_pos_left 1).mpr <| by positivity) two_ne_zero)
have hab (k : ℕ) : (1 : ℝ) / (2 * ↑(k + 1) + 1) * ((1 / (2 * ↑(n + 1) + 1)) ^ 2) ^ ↑(k + 1) ≤
(((1 : ℝ) / (2 * ↑(n + 1) + 1)) ^ 2) ^ ↑(k + 1) := by
refine mul_le_of_le_one_left (pow_nonneg h_nonneg ↑(k + 1)) ?_
rw [one_div]
exact inv_le_one (le_add_of_nonneg_left <| by positivity)
exact hasSum_le hab (log_stirlingSeq_diff_hasSum n) g
| true |
import Mathlib.MeasureTheory.OuterMeasure.Caratheodory
#align_import measure_theory.measure.outer_measure from "leanprover-community/mathlib"@"343e80208d29d2d15f8050b929aa50fe4ce71b55"
noncomputable section
open Set Function Filter
open scoped Classical NNReal Topology ENNReal
namespace MeasureTheory
open OuterMeasure
section Extend
variable {α : Type*} {P : α → Prop}
variable (m : ∀ s : α, P s → ℝ≥0∞)
def extend (s : α) : ℝ≥0∞ :=
⨅ h : P s, m s h
#align measure_theory.extend MeasureTheory.extend
theorem extend_eq {s : α} (h : P s) : extend m s = m s h := by simp [extend, h]
#align measure_theory.extend_eq MeasureTheory.extend_eq
theorem extend_eq_top {s : α} (h : ¬P s) : extend m s = ∞ := by simp [extend, h]
#align measure_theory.extend_eq_top MeasureTheory.extend_eq_top
theorem smul_extend {R} [Zero R] [SMulWithZero R ℝ≥0∞] [IsScalarTower R ℝ≥0∞ ℝ≥0∞]
[NoZeroSMulDivisors R ℝ≥0∞] {c : R} (hc : c ≠ 0) :
c • extend m = extend fun s h => c • m s h := by
ext1 s
dsimp [extend]
by_cases h : P s
· simp [h]
· simp [h, ENNReal.smul_top, hc]
#align measure_theory.smul_extend MeasureTheory.smul_extend
| Mathlib/MeasureTheory/OuterMeasure/Induced.lean | 65 | 68 | theorem le_extend {s : α} (h : P s) : m s h ≤ extend m s := by
simp only [extend, le_iInf_iff] |
simp only [extend, le_iInf_iff]
intro
rfl
| true |
import Mathlib.LinearAlgebra.BilinearForm.TensorProduct
import Mathlib.LinearAlgebra.QuadraticForm.Basic
universe uR uA uM₁ uM₂
variable {R : Type uR} {A : Type uA} {M₁ : Type uM₁} {M₂ : Type uM₂}
open TensorProduct
open LinearMap (BilinForm)
namespace QuadraticForm
section CommRing
variable [CommRing R] [CommRing A]
variable [AddCommGroup M₁] [AddCommGroup M₂]
variable [Algebra R A] [Module R M₁] [Module A M₁]
variable [SMulCommClass R A M₁] [SMulCommClass A R M₁] [IsScalarTower R A M₁]
variable [Module R M₂] [Invertible (2 : R)]
variable (R A) in
-- `noncomputable` is a performance workaround for mathlib4#7103
noncomputable def tensorDistrib :
QuadraticForm A M₁ ⊗[R] QuadraticForm R M₂ →ₗ[A] QuadraticForm A (M₁ ⊗[R] M₂) :=
letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm
-- while `letI`s would produce a better term than `let`, they would make this already-slow
-- definition even slower.
let toQ := BilinForm.toQuadraticFormLinearMap A A (M₁ ⊗[R] M₂)
let tmulB := BilinForm.tensorDistrib R A (M₁ := M₁) (M₂ := M₂)
let toB := AlgebraTensorModule.map
(QuadraticForm.associated : QuadraticForm A M₁ →ₗ[A] BilinForm A M₁)
(QuadraticForm.associated : QuadraticForm R M₂ →ₗ[R] BilinForm R M₂)
toQ ∘ₗ tmulB ∘ₗ toB
-- TODO: make the RHS `MulOpposite.op (Q₂ m₂) • Q₁ m₁` so that this has a nicer defeq for
-- `R = A` of `Q₁ m₁ * Q₂ m₂`.
@[simp]
theorem tensorDistrib_tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) (m₁ : M₁) (m₂ : M₂) :
tensorDistrib R A (Q₁ ⊗ₜ Q₂) (m₁ ⊗ₜ m₂) = Q₂ m₂ • Q₁ m₁ :=
letI : Invertible (2 : A) := (Invertible.map (algebraMap R A) 2).copy 2 (map_ofNat _ _).symm
(BilinForm.tensorDistrib_tmul _ _ _ _ _ _).trans <| congr_arg₂ _
(associated_eq_self_apply _ _ _) (associated_eq_self_apply _ _ _)
-- `noncomputable` is a performance workaround for mathlib4#7103
protected noncomputable abbrev tmul (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
QuadraticForm A (M₁ ⊗[R] M₂) :=
tensorDistrib R A (Q₁ ⊗ₜ[R] Q₂)
theorem associated_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
associated (R := A) (Q₁.tmul Q₂)
= (associated (R := A) Q₁).tmul (associated (R := R) Q₂) := by
rw [QuadraticForm.tmul, tensorDistrib, BilinForm.tmul]
dsimp
have : Subsingleton (Invertible (2 : A)) := inferInstance
convert associated_left_inverse A ((associated_isSymm A Q₁).tmul (associated_isSymm R Q₂))
theorem polarBilin_tmul [Invertible (2 : A)] (Q₁ : QuadraticForm A M₁) (Q₂ : QuadraticForm R M₂) :
polarBilin (Q₁.tmul Q₂) = ⅟(2 : A) • (polarBilin Q₁).tmul (polarBilin Q₂) := by
simp_rw [← two_nsmul_associated A, ← two_nsmul_associated R, BilinForm.tmul, tmul_smul,
← smul_tmul', map_nsmul, associated_tmul]
rw [smul_comm (_ : A) (_ : ℕ), ← smul_assoc, two_smul _ (_ : A), invOf_two_add_invOf_two,
one_smul]
variable (A) in
-- `noncomputable` is a performance workaround for mathlib4#7103
protected noncomputable def baseChange (Q : QuadraticForm R M₂) : QuadraticForm A (A ⊗[R] M₂) :=
QuadraticForm.tmul (R := R) (A := A) (M₁ := A) (M₂ := M₂) (QuadraticForm.sq (R := A)) Q
@[simp]
theorem baseChange_tmul (Q : QuadraticForm R M₂) (a : A) (m₂ : M₂) :
Q.baseChange A (a ⊗ₜ m₂) = Q m₂ • (a * a) :=
tensorDistrib_tmul _ _ _ _
| Mathlib/LinearAlgebra/QuadraticForm/TensorProduct.lean | 95 | 99 | theorem associated_baseChange [Invertible (2 : A)] (Q : QuadraticForm R M₂) :
associated (R := A) (Q.baseChange A) = (associated (R := R) Q).baseChange A := by
dsimp only [QuadraticForm.baseChange, LinearMap.baseChange] |
dsimp only [QuadraticForm.baseChange, LinearMap.baseChange]
rw [associated_tmul (QuadraticForm.sq (R := A)) Q, associated_sq]
exact rfl
| true |
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Data.DFinsupp.Basic
#align_import algebra.direct_sum.basic from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
open Function
universe u v w u₁
variable (ι : Type v) [dec_ι : DecidableEq ι] (β : ι → Type w)
def DirectSum [∀ i, AddCommMonoid (β i)] : Type _ :=
-- Porting note: Failed to synthesize
-- Π₀ i, β i deriving AddCommMonoid, Inhabited
-- See https://github.com/leanprover-community/mathlib4/issues/5020
Π₀ i, β i
#align direct_sum DirectSum
-- Porting note (#10754): Added inhabited instance manually
instance [∀ i, AddCommMonoid (β i)] : Inhabited (DirectSum ι β) :=
inferInstanceAs (Inhabited (Π₀ i, β i))
-- Porting note (#10754): Added addCommMonoid instance manually
instance [∀ i, AddCommMonoid (β i)] : AddCommMonoid (DirectSum ι β) :=
inferInstanceAs (AddCommMonoid (Π₀ i, β i))
instance [∀ i, AddCommMonoid (β i)] : DFunLike (DirectSum ι β) _ fun i : ι => β i :=
inferInstanceAs (DFunLike (Π₀ i, β i) _ _)
instance [∀ i, AddCommMonoid (β i)] : CoeFun (DirectSum ι β) fun _ => ∀ i : ι, β i :=
inferInstanceAs (CoeFun (Π₀ i, β i) fun _ => ∀ i : ι, β i)
scoped[DirectSum] notation3 "⨁ "(...)", "r:(scoped f => DirectSum _ f) => r
-- Porting note: The below recreates some of the lean3 notation, not fully yet
-- section
-- open Batteries.ExtendedBinder
-- syntax (name := bigdirectsum) "⨁ " extBinders ", " term : term
-- macro_rules (kind := bigdirectsum)
-- | `(⨁ $_:ident, $y:ident → $z:ident) => `(DirectSum _ (fun $y ↦ $z))
-- | `(⨁ $x:ident, $p) => `(DirectSum _ (fun $x ↦ $p))
-- | `(⨁ $_:ident : $t:ident, $p) => `(DirectSum _ (fun $t ↦ $p))
-- | `(⨁ ($x:ident) ($y:ident), $p) => `(DirectSum _ (fun $x ↦ fun $y ↦ $p))
-- end
instance [∀ i, AddCommMonoid (β i)] [∀ i, DecidableEq (β i)] : DecidableEq (DirectSum ι β) :=
inferInstanceAs <| DecidableEq (Π₀ i, β i)
namespace DirectSum
variable {ι}
variable [∀ i, AddCommMonoid (β i)]
@[simp]
theorem zero_apply (i : ι) : (0 : ⨁ i, β i) i = 0 :=
rfl
#align direct_sum.zero_apply DirectSum.zero_apply
variable {β}
@[simp]
theorem add_apply (g₁ g₂ : ⨁ i, β i) (i : ι) : (g₁ + g₂) i = g₁ i + g₂ i :=
rfl
#align direct_sum.add_apply DirectSum.add_apply
variable (β)
def mk (s : Finset ι) : (∀ i : (↑s : Set ι), β i.1) →+ ⨁ i, β i where
toFun := DFinsupp.mk s
map_add' _ _ := DFinsupp.mk_add
map_zero' := DFinsupp.mk_zero
#align direct_sum.mk DirectSum.mk
def of (i : ι) : β i →+ ⨁ i, β i :=
DFinsupp.singleAddHom β i
#align direct_sum.of DirectSum.of
@[simp]
theorem of_eq_same (i : ι) (x : β i) : (of _ i x) i = x :=
DFinsupp.single_eq_same
#align direct_sum.of_eq_same DirectSum.of_eq_same
theorem of_eq_of_ne (i j : ι) (x : β i) (h : i ≠ j) : (of _ i x) j = 0 :=
DFinsupp.single_eq_of_ne h
#align direct_sum.of_eq_of_ne DirectSum.of_eq_of_ne
lemma of_apply {i : ι} (j : ι) (x : β i) : of β i x j = if h : i = j then Eq.recOn h x else 0 :=
DFinsupp.single_apply
@[simp]
theorem support_zero [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] : (0 : ⨁ i, β i).support = ∅ :=
DFinsupp.support_zero
#align direct_sum.support_zero DirectSum.support_zero
@[simp]
theorem support_of [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] (i : ι) (x : β i) (h : x ≠ 0) :
(of _ i x).support = {i} :=
DFinsupp.support_single_ne_zero h
#align direct_sum.support_of DirectSum.support_of
theorem support_of_subset [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] {i : ι} {b : β i} :
(of _ i b).support ⊆ {i} :=
DFinsupp.support_single_subset
#align direct_sum.support_of_subset DirectSum.support_of_subset
theorem sum_support_of [∀ (i : ι) (x : β i), Decidable (x ≠ 0)] (x : ⨁ i, β i) :
(∑ i ∈ x.support, of β i (x i)) = x :=
DFinsupp.sum_single
#align direct_sum.sum_support_of DirectSum.sum_support_of
| Mathlib/Algebra/DirectSum/Basic.lean | 155 | 159 | theorem sum_univ_of [Fintype ι] (x : ⨁ i, β i) :
∑ i ∈ Finset.univ, of β i (x i) = x := by
apply DFinsupp.ext (fun i ↦ ?_) |
apply DFinsupp.ext (fun i ↦ ?_)
rw [DFinsupp.finset_sum_apply]
simp [of_apply]
| true |
import Mathlib.Algebra.Polynomial.Module.AEval
#align_import data.polynomial.module from "leanprover-community/mathlib"@"63417e01fbc711beaf25fa73b6edb395c0cfddd0"
universe u v
open Polynomial BigOperators
@[nolint unusedArguments]
def PolynomialModule (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] := ℕ →₀ M
#align polynomial_module PolynomialModule
variable (R M : Type*) [CommRing R] [AddCommGroup M] [Module R M] (I : Ideal R)
-- Porting note: stated instead of deriving
noncomputable instance : Inhabited (PolynomialModule R M) := Finsupp.instInhabited
noncomputable instance : AddCommGroup (PolynomialModule R M) := Finsupp.instAddCommGroup
variable {M}
variable {S : Type*} [CommSemiring S] [Algebra S R] [Module S M] [IsScalarTower S R M]
namespace PolynomialModule
@[nolint unusedArguments]
noncomputable instance : Module S (PolynomialModule R M) :=
Finsupp.module ℕ M
instance instFunLike : FunLike (PolynomialModule R M) ℕ M :=
Finsupp.instFunLike
instance : CoeFun (PolynomialModule R M) fun _ => ℕ → M :=
Finsupp.instCoeFun
theorem zero_apply (i : ℕ) : (0 : PolynomialModule R M) i = 0 :=
Finsupp.zero_apply
theorem add_apply (g₁ g₂ : PolynomialModule R M) (a : ℕ) : (g₁ + g₂) a = g₁ a + g₂ a :=
Finsupp.add_apply g₁ g₂ a
noncomputable def single (i : ℕ) : M →+ PolynomialModule R M :=
Finsupp.singleAddHom i
#align polynomial_module.single PolynomialModule.single
theorem single_apply (i : ℕ) (m : M) (n : ℕ) : single R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.single_apply PolynomialModule.single_apply
noncomputable def lsingle (i : ℕ) : M →ₗ[R] PolynomialModule R M :=
Finsupp.lsingle i
#align polynomial_module.lsingle PolynomialModule.lsingle
theorem lsingle_apply (i : ℕ) (m : M) (n : ℕ) : lsingle R i m n = ite (i = n) m 0 :=
Finsupp.single_apply
#align polynomial_module.lsingle_apply PolynomialModule.lsingle_apply
theorem single_smul (i : ℕ) (r : R) (m : M) : single R i (r • m) = r • single R i m :=
(lsingle R i).map_smul r m
#align polynomial_module.single_smul PolynomialModule.single_smul
variable {R}
theorem induction_linear {P : PolynomialModule R M → Prop} (f : PolynomialModule R M) (h0 : P 0)
(hadd : ∀ f g, P f → P g → P (f + g)) (hsingle : ∀ a b, P (single R a b)) : P f :=
Finsupp.induction_linear f h0 hadd hsingle
#align polynomial_module.induction_linear PolynomialModule.induction_linear
noncomputable instance polynomialModule : Module R[X] (PolynomialModule R M) :=
inferInstanceAs (Module R[X] (Module.AEval' (Finsupp.lmapDomain M R Nat.succ)))
#align polynomial_module.polynomial_module PolynomialModule.polynomialModule
lemma smul_def (f : R[X]) (m : PolynomialModule R M) :
f • m = aeval (Finsupp.lmapDomain M R Nat.succ) f m := by
rfl
instance (M : Type u) [AddCommGroup M] [Module R M] [Module S M] [IsScalarTower S R M] :
IsScalarTower S R (PolynomialModule R M) :=
Finsupp.isScalarTower _ _
instance isScalarTower' (M : Type u) [AddCommGroup M] [Module R M] [Module S M]
[IsScalarTower S R M] : IsScalarTower S R[X] (PolynomialModule R M) := by
haveI : IsScalarTower R R[X] (PolynomialModule R M) :=
inferInstanceAs <| IsScalarTower R R[X] <| Module.AEval' <| Finsupp.lmapDomain M R Nat.succ
constructor
intro x y z
rw [← @IsScalarTower.algebraMap_smul S R, ← @IsScalarTower.algebraMap_smul S R, smul_assoc]
#align polynomial_module.is_scalar_tower' PolynomialModule.isScalarTower'
@[simp]
| Mathlib/Algebra/Polynomial/Module/Basic.lean | 123 | 135 | theorem monomial_smul_single (i : ℕ) (r : R) (j : ℕ) (m : M) :
monomial i r • single R j m = single R (i + j) (r • m) := by
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply, |
simp only [LinearMap.mul_apply, Polynomial.aeval_monomial, LinearMap.pow_apply,
Module.algebraMap_end_apply, smul_def]
induction i generalizing r j m with
| zero =>
rw [Function.iterate_zero, zero_add]
exact Finsupp.smul_single r j m
| succ n hn =>
rw [Function.iterate_succ, Function.comp_apply, add_assoc, ← hn]
congr 2
rw [Nat.one_add]
exact Finsupp.mapDomain_single
| true |
import Mathlib.Analysis.Analytic.IsolatedZeros
import Mathlib.Analysis.Complex.CauchyIntegral
import Mathlib.Analysis.Complex.AbsMax
#align_import analysis.complex.open_mapping from "leanprover-community/mathlib"@"f9dd3204df14a0749cd456fac1e6849dfe7d2b88"
open Set Filter Metric Complex
open scoped Topology
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] {U : Set E} {f : ℂ → ℂ} {g : E → ℂ}
{z₀ w : ℂ} {ε r m : ℝ}
theorem DiffContOnCl.ball_subset_image_closedBall (h : DiffContOnCl ℂ f (ball z₀ r)) (hr : 0 < r)
(hf : ∀ z ∈ sphere z₀ r, ε ≤ ‖f z - f z₀‖) (hz₀ : ∃ᶠ z in 𝓝 z₀, f z ≠ f z₀) :
ball (f z₀) (ε / 2) ⊆ f '' closedBall z₀ r := by
rintro v hv
have h1 : DiffContOnCl ℂ (fun z => f z - v) (ball z₀ r) := h.sub_const v
have h2 : ContinuousOn (fun z => ‖f z - v‖) (closedBall z₀ r) :=
continuous_norm.comp_continuousOn (closure_ball z₀ hr.ne.symm ▸ h1.continuousOn)
have h3 : AnalyticOn ℂ f (ball z₀ r) := h.differentiableOn.analyticOn isOpen_ball
have h4 : ∀ z ∈ sphere z₀ r, ε / 2 ≤ ‖f z - v‖ := fun z hz => by
linarith [hf z hz, show ‖v - f z₀‖ < ε / 2 from mem_ball.mp hv,
norm_sub_sub_norm_sub_le_norm_sub (f z) v (f z₀)]
have h5 : ‖f z₀ - v‖ < ε / 2 := by simpa [← dist_eq_norm, dist_comm] using mem_ball.mp hv
obtain ⟨z, hz1, hz2⟩ : ∃ z ∈ ball z₀ r, IsLocalMin (fun z => ‖f z - v‖) z :=
exists_isLocalMin_mem_ball h2 (mem_closedBall_self hr.le) fun z hz => h5.trans_le (h4 z hz)
refine ⟨z, ball_subset_closedBall hz1, sub_eq_zero.mp ?_⟩
have h6 := h1.differentiableOn.eventually_differentiableAt (isOpen_ball.mem_nhds hz1)
refine (eventually_eq_or_eq_zero_of_isLocalMin_norm h6 hz2).resolve_left fun key => ?_
have h7 : ∀ᶠ w in 𝓝 z, f w = f z := by filter_upwards [key] with h; field_simp
replace h7 : ∃ᶠ w in 𝓝[≠] z, f w = f z := (h7.filter_mono nhdsWithin_le_nhds).frequently
have h8 : IsPreconnected (ball z₀ r) := (convex_ball z₀ r).isPreconnected
have h9 := h3.eqOn_of_preconnected_of_frequently_eq analyticOn_const h8 hz1 h7
have h10 : f z = f z₀ := (h9 (mem_ball_self hr)).symm
exact not_eventually.mpr hz₀ (mem_of_superset (ball_mem_nhds z₀ hr) (h10 ▸ h9))
#align diff_cont_on_cl.ball_subset_image_closed_ball DiffContOnCl.ball_subset_image_closedBall
| Mathlib/Analysis/Complex/OpenMapping.lean | 77 | 106 | theorem AnalyticAt.eventually_constant_or_nhds_le_map_nhds_aux (hf : AnalyticAt ℂ f z₀) :
(∀ᶠ z in 𝓝 z₀, f z = f z₀) ∨ 𝓝 (f z₀) ≤ map f (𝓝 z₀) := by
/- The function `f` is analytic in a neighborhood of `z₀`; by the isolated zeros principle, if `f` |
/- The function `f` is analytic in a neighborhood of `z₀`; by the isolated zeros principle, if `f`
is not constant in a neighborhood of `z₀`, then it is nonzero, and therefore bounded below, on
every small enough circle around `z₀` and then `DiffContOnCl.ball_subset_image_closedBall`
provides an explicit ball centered at `f z₀` contained in the range of `f`. -/
refine or_iff_not_imp_left.mpr fun h => ?_
refine (nhds_basis_ball.le_basis_iff (nhds_basis_closedBall.map f)).mpr fun R hR => ?_
have h1 := (hf.eventually_eq_or_eventually_ne analyticAt_const).resolve_left h
have h2 : ∀ᶠ z in 𝓝 z₀, AnalyticAt ℂ f z := (isOpen_analyticAt ℂ f).eventually_mem hf
obtain ⟨ρ, hρ, h3, h4⟩ :
∃ ρ > 0, AnalyticOn ℂ f (closedBall z₀ ρ) ∧ ∀ z ∈ closedBall z₀ ρ, z ≠ z₀ → f z ≠ f z₀ := by
simpa only [setOf_and, subset_inter_iff] using
nhds_basis_closedBall.mem_iff.mp (h2.and (eventually_nhdsWithin_iff.mp h1))
replace h3 : DiffContOnCl ℂ f (ball z₀ ρ) :=
⟨h3.differentiableOn.mono ball_subset_closedBall,
(closure_ball z₀ hρ.lt.ne.symm).symm ▸ h3.continuousOn⟩
let r := ρ ⊓ R
have hr : 0 < r := lt_inf_iff.mpr ⟨hρ, hR⟩
have h5 : closedBall z₀ r ⊆ closedBall z₀ ρ := closedBall_subset_closedBall inf_le_left
have h6 : DiffContOnCl ℂ f (ball z₀ r) := h3.mono (ball_subset_ball inf_le_left)
have h7 : ∀ z ∈ sphere z₀ r, f z ≠ f z₀ := fun z hz =>
h4 z (h5 (sphere_subset_closedBall hz)) (ne_of_mem_sphere hz hr.ne.symm)
have h8 : (sphere z₀ r).Nonempty := NormedSpace.sphere_nonempty.mpr hr.le
have h9 : ContinuousOn (fun x => ‖f x - f z₀‖) (sphere z₀ r) := continuous_norm.comp_continuousOn
((h6.sub_const (f z₀)).continuousOn_ball.mono sphere_subset_closedBall)
obtain ⟨x, hx, hfx⟩ := (isCompact_sphere z₀ r).exists_isMinOn h8 h9
refine ⟨‖f x - f z₀‖ / 2, half_pos (norm_sub_pos_iff.mpr (h7 x hx)), ?_⟩
exact (h6.ball_subset_image_closedBall hr (fun z hz => hfx hz) (not_eventually.mp h)).trans
(image_subset f (closedBall_subset_closedBall inf_le_right))
| true |
import Mathlib.MeasureTheory.Function.AEEqFun.DomAct
import Mathlib.MeasureTheory.Function.LpSpace
set_option autoImplicit true
open MeasureTheory Filter
open scoped ENNReal
namespace DomMulAct
variable {M N α E : Type*} [MeasurableSpace M] [MeasurableSpace N]
[MeasurableSpace α] [NormedAddCommGroup E] {μ : MeasureTheory.Measure α} {p : ℝ≥0∞}
section SMul
variable [SMul M α] [SMulInvariantMeasure M α μ] [MeasurableSMul M α]
@[to_additive]
instance : SMul Mᵈᵐᵃ (Lp E p μ) where
smul c f := Lp.compMeasurePreserving (mk.symm c • ·) (measurePreserving_smul _ _) f
@[to_additive (attr := simp)]
theorem smul_Lp_val (c : Mᵈᵐᵃ) (f : Lp E p μ) : (c • f).1 = c • f.1 := rfl
@[to_additive]
theorem smul_Lp_ae_eq (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • f =ᵐ[μ] (f <| mk.symm c • ·) :=
Lp.coeFn_compMeasurePreserving _ _
@[to_additive]
theorem mk_smul_toLp (c : M) {f : α → E} (hf : Memℒp f p μ) :
mk c • hf.toLp f =
(hf.comp_measurePreserving <| measurePreserving_smul c μ).toLp (f <| c • ·) :=
rfl
@[to_additive (attr := simp)]
theorem smul_Lp_const [IsFiniteMeasure μ] (c : Mᵈᵐᵃ) (a : E) :
c • Lp.const p μ a = Lp.const p μ a :=
rfl
instance [SMul N α] [SMulCommClass M N α] [SMulInvariantMeasure N α μ] [MeasurableSMul N α] :
SMulCommClass Mᵈᵐᵃ Nᵈᵐᵃ (Lp E p μ) :=
Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl
instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass Mᵈᵐᵃ 𝕜 (Lp E p μ) :=
Subtype.val_injective.smulCommClass (fun _ _ ↦ rfl) fun _ _ ↦ rfl
instance [NormedRing 𝕜] [Module 𝕜 E] [BoundedSMul 𝕜 E] : SMulCommClass 𝕜 Mᵈᵐᵃ (Lp E p μ) :=
.symm _ _ _
-- We don't have a typeclass for additive versions of the next few lemmas
-- Should we add `AddDistribAddAction` with `to_additive` both from `MulDistribMulAction`
-- and `DistribMulAction`?
@[to_additive]
theorem smul_Lp_add (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f + g) = c • f + c • g := by
rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl
attribute [simp] DomAddAct.vadd_Lp_add
@[to_additive (attr := simp 1001)]
theorem smul_Lp_zero (c : Mᵈᵐᵃ) : c • (0 : Lp E p μ) = 0 := rfl
@[to_additive]
theorem smul_Lp_neg (c : Mᵈᵐᵃ) (f : Lp E p μ) : c • (-f) = -(c • f) := by
rcases f with ⟨⟨_⟩, _⟩; rfl
@[to_additive]
| Mathlib/MeasureTheory/Function/LpSpace/DomAct/Basic.lean | 82 | 83 | theorem smul_Lp_sub (c : Mᵈᵐᵃ) : ∀ f g : Lp E p μ, c • (f - g) = c • f - c • g := by |
rintro ⟨⟨⟩, _⟩ ⟨⟨⟩, _⟩; rfl
| true |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Nat.GCD.BigOperators
import Mathlib.Order.SupIndep
#align_import group_theory.noncomm_pi_coprod from "leanprover-community/mathlib"@"6f9f36364eae3f42368b04858fd66d6d9ae730d8"
namespace Subgroup
variable {G : Type*} [Group G]
@[to_additive "`Finset.noncommSum` is “injective” in `f` if `f` maps into independent subgroups.
This generalizes (one direction of) `AddSubgroup.disjoint_iff_add_eq_zero`. "]
| Mathlib/GroupTheory/NoncommPiCoprod.lean | 55 | 78 | theorem eq_one_of_noncommProd_eq_one_of_independent {ι : Type*} (s : Finset ι) (f : ι → G) (comm)
(K : ι → Subgroup G) (hind : CompleteLattice.Independent K) (hmem : ∀ x ∈ s, f x ∈ K x)
(heq1 : s.noncommProd f comm = 1) : ∀ i ∈ s, f i = 1 := by
classical |
classical
revert heq1
induction' s using Finset.induction_on with i s hnmem ih
· simp
· have hcomm := comm.mono (Finset.coe_subset.2 <| Finset.subset_insert _ _)
simp only [Finset.forall_mem_insert] at hmem
have hmem_bsupr : s.noncommProd f hcomm ∈ ⨆ i ∈ (s : Set ι), K i := by
refine Subgroup.noncommProd_mem _ _ ?_
intro x hx
have : K x ≤ ⨆ i ∈ (s : Set ι), K i := le_iSup₂ (f := fun i _ => K i) x hx
exact this (hmem.2 x hx)
intro heq1
rw [Finset.noncommProd_insert_of_not_mem _ _ _ _ hnmem] at heq1
have hnmem' : i ∉ (s : Set ι) := by simpa
obtain ⟨heq1i : f i = 1, heq1S : s.noncommProd f _ = 1⟩ :=
Subgroup.disjoint_iff_mul_eq_one.mp (hind.disjoint_biSup hnmem') hmem.1 hmem_bsupr heq1
intro i h
simp only [Finset.mem_insert] at h
rcases h with (rfl | h)
· exact heq1i
· refine ih hcomm hmem.2 heq1S _ h
| true |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.special_functions.pow.nnreal from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real NNReal ENNReal ComplexConjugate
open Finset Function Set
namespace NNReal
variable {w x y z : ℝ}
noncomputable def rpow (x : ℝ≥0) (y : ℝ) : ℝ≥0 :=
⟨(x : ℝ) ^ y, Real.rpow_nonneg x.2 y⟩
#align nnreal.rpow NNReal.rpow
noncomputable instance : Pow ℝ≥0 ℝ :=
⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x : ℝ≥0) (y : ℝ) : rpow x y = x ^ y :=
rfl
#align nnreal.rpow_eq_pow NNReal.rpow_eq_pow
@[simp, norm_cast]
theorem coe_rpow (x : ℝ≥0) (y : ℝ) : ((x ^ y : ℝ≥0) : ℝ) = (x : ℝ) ^ y :=
rfl
#align nnreal.coe_rpow NNReal.coe_rpow
@[simp]
theorem rpow_zero (x : ℝ≥0) : x ^ (0 : ℝ) = 1 :=
NNReal.eq <| Real.rpow_zero _
#align nnreal.rpow_zero NNReal.rpow_zero
@[simp]
| Mathlib/Analysis/SpecialFunctions/Pow/NNReal.lean | 57 | 59 | theorem rpow_eq_zero_iff {x : ℝ≥0} {y : ℝ} : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by |
rw [← NNReal.coe_inj, coe_rpow, ← NNReal.coe_eq_zero]
exact Real.rpow_eq_zero_iff_of_nonneg x.2
| false |
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Analysis.Convex.Normed
open Metric Bornology Filter Set
open scoped NNReal Topology Pointwise
noncomputable section
section Module
variable {E : Type*} [AddCommGroup E] [Module ℝ E]
def gaugeRescale (s t : Set E) (x : E) : E := (gauge s x / gauge t x) • x
theorem gaugeRescale_def (s t : Set E) (x : E) :
gaugeRescale s t x = (gauge s x / gauge t x) • x :=
rfl
@[simp] theorem gaugeRescale_zero (s t : Set E) : gaugeRescale s t 0 = 0 := smul_zero _
theorem gaugeRescale_smul (s t : Set E) {c : ℝ} (hc : 0 ≤ c) (x : E) :
gaugeRescale s t (c • x) = c • gaugeRescale s t x := by
simp only [gaugeRescale, gauge_smul_of_nonneg hc, smul_smul, smul_eq_mul]
rw [mul_div_mul_comm, mul_right_comm, div_self_mul_self]
variable [TopologicalSpace E] [T1Space E]
theorem gaugeRescale_self_apply {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s)
(x : E) : gaugeRescale s s x = x := by
rcases eq_or_ne x 0 with rfl | hx; · simp
rw [gaugeRescale, div_self, one_smul]
exact ((gauge_pos hsa hsb).2 hx).ne'
theorem gaugeRescale_self {s : Set E} (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s) :
gaugeRescale s s = id :=
funext <| gaugeRescale_self_apply hsa hsb
theorem gauge_gaugeRescale' (s : Set E) {t : Set E} {x : E} (hx : gauge t x ≠ 0) :
gauge t (gaugeRescale s t x) = gauge s x := by
rw [gaugeRescale, gauge_smul_of_nonneg (div_nonneg (gauge_nonneg _) (gauge_nonneg _)),
smul_eq_mul, div_mul_cancel₀ _ hx]
theorem gauge_gaugeRescale (s : Set E) {t : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t)
(x : E) : gauge t (gaugeRescale s t x) = gauge s x := by
rcases eq_or_ne x 0 with rfl | hx
· simp
· exact gauge_gaugeRescale' s ((gauge_pos hta htb).2 hx).ne'
theorem gauge_gaugeRescale_le (s t : Set E) (x : E) :
gauge t (gaugeRescale s t x) ≤ gauge s x := by
by_cases hx : gauge t x = 0
· simp [gaugeRescale, hx, gauge_nonneg]
· exact (gauge_gaugeRescale' s hx).le
theorem gaugeRescale_gaugeRescale {s t u : Set E} (hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t)
(x : E) : gaugeRescale t u (gaugeRescale s t x) = gaugeRescale s u x := by
rcases eq_or_ne x 0 with rfl | hx; · simp
rw [gaugeRescale_def s t x, gaugeRescale_smul, gaugeRescale, gaugeRescale, smul_smul,
div_mul_div_cancel]
exacts [((gauge_pos hta htb).2 hx).ne', div_nonneg (gauge_nonneg _) (gauge_nonneg _)]
def gaugeRescaleEquiv (s t : Set E) (hsa : Absorbent ℝ s) (hsb : IsVonNBounded ℝ s)
(hta : Absorbent ℝ t) (htb : IsVonNBounded ℝ t) : E ≃ E where
toFun := gaugeRescale s t
invFun := gaugeRescale t s
left_inv x := by rw [gaugeRescale_gaugeRescale, gaugeRescale_self_apply] <;> assumption
right_inv x := by rw [gaugeRescale_gaugeRescale, gaugeRescale_self_apply] <;> assumption
variable [TopologicalAddGroup E] [ContinuousSMul ℝ E] {s t : Set E}
theorem mapsTo_gaugeRescale_interior (h₀ : t ∈ 𝓝 0) (hc : Convex ℝ t) :
MapsTo (gaugeRescale s t) (interior s) (interior t) := fun x hx ↦ by
rw [← gauge_lt_one_iff_mem_interior] <;> try assumption
exact (gauge_gaugeRescale_le _ _ _).trans_lt (interior_subset_gauge_lt_one _ hx)
theorem mapsTo_gaugeRescale_closure {s t : Set E} (hsc : Convex ℝ s) (hs₀ : s ∈ 𝓝 0)
(htc : Convex ℝ t) (ht₀ : 0 ∈ t) (hta : Absorbent ℝ t) :
MapsTo (gaugeRescale s t) (closure s) (closure t) := fun _x hx ↦
mem_closure_of_gauge_le_one htc ht₀ hta <| (gauge_gaugeRescale_le _ _ _).trans <|
(gauge_le_one_iff_mem_closure hsc hs₀).2 hx
| Mathlib/Analysis/Convex/GaugeRescale.lean | 103 | 114 | theorem continuous_gaugeRescale {s t : Set E} (hs : Convex ℝ s) (hs₀ : s ∈ 𝓝 0)
(ht : Convex ℝ t) (ht₀ : t ∈ 𝓝 0) (htb : IsVonNBounded ℝ t) :
Continuous (gaugeRescale s t) := by |
have hta : Absorbent ℝ t := absorbent_nhds_zero ht₀
refine continuous_iff_continuousAt.2 fun x ↦ ?_
rcases eq_or_ne x 0 with rfl | hx
· rw [ContinuousAt, gaugeRescale_zero]
nth_rewrite 2 [← comap_gauge_nhds_zero htb ht₀]
simp only [tendsto_comap_iff, (· ∘ ·), gauge_gaugeRescale _ hta htb]
exact tendsto_gauge_nhds_zero hs₀
· exact ((continuousAt_gauge hs hs₀).div (continuousAt_gauge ht ht₀)
((gauge_pos hta htb).2 hx).ne').smul continuousAt_id
| false |
import Mathlib.Analysis.InnerProductSpace.GramSchmidtOrtho
import Mathlib.LinearAlgebra.Orientation
#align_import analysis.inner_product_space.orientation from "leanprover-community/mathlib"@"bd65478311e4dfd41f48bf38c7e3b02fb75d0163"
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
open FiniteDimensional
open scoped RealInnerProductSpace
namespace OrthonormalBasis
variable {ι : Type*} [Fintype ι] [DecidableEq ι] [ne : Nonempty ι] (e f : OrthonormalBasis ι ℝ E)
(x : Orientation ℝ E ι)
theorem det_to_matrix_orthonormalBasis_of_same_orientation
(h : e.toBasis.orientation = f.toBasis.orientation) : e.toBasis.det f = 1 := by
apply (e.det_to_matrix_orthonormalBasis_real f).resolve_right
have : 0 < e.toBasis.det f := by
rw [e.toBasis.orientation_eq_iff_det_pos] at h
simpa using h
linarith
#align orthonormal_basis.det_to_matrix_orthonormal_basis_of_same_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_same_orientation
theorem det_to_matrix_orthonormalBasis_of_opposite_orientation
(h : e.toBasis.orientation ≠ f.toBasis.orientation) : e.toBasis.det f = -1 := by
contrapose! h
simp [e.toBasis.orientation_eq_iff_det_pos,
(e.det_to_matrix_orthonormalBasis_real f).resolve_right h]
#align orthonormal_basis.det_to_matrix_orthonormal_basis_of_opposite_orientation OrthonormalBasis.det_to_matrix_orthonormalBasis_of_opposite_orientation
variable {e f}
theorem same_orientation_iff_det_eq_det :
e.toBasis.det = f.toBasis.det ↔ e.toBasis.orientation = f.toBasis.orientation := by
constructor
· intro h
dsimp [Basis.orientation]
congr
· intro h
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
simp [e.det_to_matrix_orthonormalBasis_of_same_orientation f h]
#align orthonormal_basis.same_orientation_iff_det_eq_det OrthonormalBasis.same_orientation_iff_det_eq_det
variable (e f)
| Mathlib/Analysis/InnerProductSpace/Orientation.lean | 91 | 96 | theorem det_eq_neg_det_of_opposite_orientation (h : e.toBasis.orientation ≠ f.toBasis.orientation) :
e.toBasis.det = -f.toBasis.det := by |
rw [e.toBasis.det.eq_smul_basis_det f.toBasis]
-- Porting note: added `neg_one_smul` with explicit type
simp [e.det_to_matrix_orthonormalBasis_of_opposite_orientation f h,
neg_one_smul ℝ (M := E [⋀^ι]→ₗ[ℝ] ℝ)]
| false |
import Mathlib.LinearAlgebra.AffineSpace.AffineEquiv
#align_import linear_algebra.affine_space.affine_subspace from "leanprover-community/mathlib"@"e96bdfbd1e8c98a09ff75f7ac6204d142debc840"
noncomputable section
open Affine
open Set
section
variable (k : Type*) {V : Type*} {P : Type*} [Ring k] [AddCommGroup V] [Module k V]
variable [AffineSpace V P]
def vectorSpan (s : Set P) : Submodule k V :=
Submodule.span k (s -ᵥ s)
#align vector_span vectorSpan
theorem vectorSpan_def (s : Set P) : vectorSpan k s = Submodule.span k (s -ᵥ s) :=
rfl
#align vector_span_def vectorSpan_def
theorem vectorSpan_mono {s₁ s₂ : Set P} (h : s₁ ⊆ s₂) : vectorSpan k s₁ ≤ vectorSpan k s₂ :=
Submodule.span_mono (vsub_self_mono h)
#align vector_span_mono vectorSpan_mono
variable (P)
@[simp]
theorem vectorSpan_empty : vectorSpan k (∅ : Set P) = (⊥ : Submodule k V) := by
rw [vectorSpan_def, vsub_empty, Submodule.span_empty]
#align vector_span_empty vectorSpan_empty
variable {P}
@[simp]
theorem vectorSpan_singleton (p : P) : vectorSpan k ({p} : Set P) = ⊥ := by simp [vectorSpan_def]
#align vector_span_singleton vectorSpan_singleton
theorem vsub_set_subset_vectorSpan (s : Set P) : s -ᵥ s ⊆ ↑(vectorSpan k s) :=
Submodule.subset_span
#align vsub_set_subset_vector_span vsub_set_subset_vectorSpan
theorem vsub_mem_vectorSpan {s : Set P} {p1 p2 : P} (hp1 : p1 ∈ s) (hp2 : p2 ∈ s) :
p1 -ᵥ p2 ∈ vectorSpan k s :=
vsub_set_subset_vectorSpan k s (vsub_mem_vsub hp1 hp2)
#align vsub_mem_vector_span vsub_mem_vectorSpan
def spanPoints (s : Set P) : Set P :=
{ p | ∃ p1 ∈ s, ∃ v ∈ vectorSpan k s, p = v +ᵥ p1 }
#align span_points spanPoints
theorem mem_spanPoints (p : P) (s : Set P) : p ∈ s → p ∈ spanPoints k s
| hp => ⟨p, hp, 0, Submodule.zero_mem _, (zero_vadd V p).symm⟩
#align mem_span_points mem_spanPoints
theorem subset_spanPoints (s : Set P) : s ⊆ spanPoints k s := fun p => mem_spanPoints k p s
#align subset_span_points subset_spanPoints
@[simp]
theorem spanPoints_nonempty (s : Set P) : (spanPoints k s).Nonempty ↔ s.Nonempty := by
constructor
· contrapose
rw [Set.not_nonempty_iff_eq_empty, Set.not_nonempty_iff_eq_empty]
intro h
simp [h, spanPoints]
· exact fun h => h.mono (subset_spanPoints _ _)
#align span_points_nonempty spanPoints_nonempty
| Mathlib/LinearAlgebra/AffineSpace/AffineSubspace.lean | 128 | 132 | theorem vadd_mem_spanPoints_of_mem_spanPoints_of_mem_vectorSpan {s : Set P} {p : P} {v : V}
(hp : p ∈ spanPoints k s) (hv : v ∈ vectorSpan k s) : v +ᵥ p ∈ spanPoints k s := by |
rcases hp with ⟨p2, ⟨hp2, ⟨v2, ⟨hv2, hv2p⟩⟩⟩⟩
rw [hv2p, vadd_vadd]
exact ⟨p2, hp2, v + v2, (vectorSpan k s).add_mem hv hv2, rfl⟩
| false |
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.GroupTheory.GroupAction.Hom
open Set Pointwise
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 33 | 41 | theorem MulAction.smul_bijective_of_is_unit
{M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) :
Function.Bijective (fun (a : α) ↦ m • a) := by |
lift m to Mˣ using hm
rw [Function.bijective_iff_has_inverse]
use fun a ↦ m⁻¹ • a
constructor
· intro x; simp [← Units.smul_def]
· intro x; simp [← Units.smul_def]
| false |
import Mathlib.Data.List.Forall2
import Mathlib.Data.Set.Pairwise.Basic
import Mathlib.Init.Data.Fin.Basic
#align_import data.list.nodup from "leanprover-community/mathlib"@"c227d107bbada5d0d9d20287e3282c0a7f1651a0"
universe u v
open Nat Function
variable {α : Type u} {β : Type v} {l l₁ l₂ : List α} {r : α → α → Prop} {a b : α}
namespace List
@[simp]
theorem forall_mem_ne {a : α} {l : List α} : (∀ a' : α, a' ∈ l → ¬a = a') ↔ a ∉ l :=
⟨fun h m => h _ m rfl, fun h _ m e => h (e.symm ▸ m)⟩
#align list.forall_mem_ne List.forall_mem_ne
@[simp]
theorem nodup_nil : @Nodup α [] :=
Pairwise.nil
#align list.nodup_nil List.nodup_nil
@[simp]
| Mathlib/Data/List/Nodup.lean | 39 | 40 | theorem nodup_cons {a : α} {l : List α} : Nodup (a :: l) ↔ a ∉ l ∧ Nodup l := by |
simp only [Nodup, pairwise_cons, forall_mem_ne]
| false |
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.Monoidal.Free.Coherence
#align_import category_theory.monoidal.coherence_lemmas from "leanprover-community/mathlib"@"b8b8bf3ea0c625fa1f950034a184e07c67f7bcfe"
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ 𝟙 Y := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor' CategoryTheory.MonoidalCategory.leftUnitor_tensor''
@[reassoc]
theorem leftUnitor_tensor' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ 𝟙 Y) := by
coherence
#align category_theory.monoidal_category.left_unitor_tensor CategoryTheory.MonoidalCategory.leftUnitor_tensor'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by coherence
#align category_theory.monoidal_category.left_unitor_tensor_inv CategoryTheory.MonoidalCategory.leftUnitor_tensor_inv'
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
coherence
#align category_theory.monoidal_category.id_tensor_right_unitor_inv CategoryTheory.MonoidalCategory.id_tensor_rightUnitor_inv
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
coherence
#align category_theory.monoidal_category.left_unitor_inv_tensor_id CategoryTheory.MonoidalCategory.leftUnitor_inv_tensor_id
@[reassoc]
theorem pentagon_inv_inv_hom (W X Y Z : C) :
(α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom =
(𝟙 W ⊗ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by
coherence
#align category_theory.monoidal_category.pentagon_inv_inv_hom CategoryTheory.MonoidalCategory.pentagon_inv_inv_hom
theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom := by
coherence
#align category_theory.monoidal_category.unitors_equal CategoryTheory.MonoidalCategory.unitors_equal
| Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | 67 | 68 | theorem unitors_inv_equal : (λ_ (𝟙_ C)).inv = (ρ_ (𝟙_ C)).inv := by |
coherence
| false |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Data.ENat.Basic
#align_import data.polynomial.degree.trailing_degree from "leanprover-community/mathlib"@"302eab4f46abb63de520828de78c04cb0f9b5836"
noncomputable section
open Function Polynomial Finsupp Finset
open scoped Polynomial
namespace Polynomial
universe u v
variable {R : Type u} {S : Type v} {a b : R} {n m : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
def trailingDegree (p : R[X]) : ℕ∞ :=
p.support.min
#align polynomial.trailing_degree Polynomial.trailingDegree
theorem trailingDegree_lt_wf : WellFounded fun p q : R[X] => trailingDegree p < trailingDegree q :=
InvImage.wf trailingDegree wellFounded_lt
#align polynomial.trailing_degree_lt_wf Polynomial.trailingDegree_lt_wf
def natTrailingDegree (p : R[X]) : ℕ :=
(trailingDegree p).getD 0
#align polynomial.nat_trailing_degree Polynomial.natTrailingDegree
def trailingCoeff (p : R[X]) : R :=
coeff p (natTrailingDegree p)
#align polynomial.trailing_coeff Polynomial.trailingCoeff
def TrailingMonic (p : R[X]) :=
trailingCoeff p = (1 : R)
#align polynomial.trailing_monic Polynomial.TrailingMonic
theorem TrailingMonic.def : TrailingMonic p ↔ trailingCoeff p = 1 :=
Iff.rfl
#align polynomial.trailing_monic.def Polynomial.TrailingMonic.def
instance TrailingMonic.decidable [DecidableEq R] : Decidable (TrailingMonic p) :=
inferInstanceAs <| Decidable (trailingCoeff p = (1 : R))
#align polynomial.trailing_monic.decidable Polynomial.TrailingMonic.decidable
@[simp]
theorem TrailingMonic.trailingCoeff {p : R[X]} (hp : p.TrailingMonic) : trailingCoeff p = 1 :=
hp
#align polynomial.trailing_monic.trailing_coeff Polynomial.TrailingMonic.trailingCoeff
@[simp]
theorem trailingDegree_zero : trailingDegree (0 : R[X]) = ⊤ :=
rfl
#align polynomial.trailing_degree_zero Polynomial.trailingDegree_zero
@[simp]
theorem trailingCoeff_zero : trailingCoeff (0 : R[X]) = 0 :=
rfl
#align polynomial.trailing_coeff_zero Polynomial.trailingCoeff_zero
@[simp]
theorem natTrailingDegree_zero : natTrailingDegree (0 : R[X]) = 0 :=
rfl
#align polynomial.nat_trailing_degree_zero Polynomial.natTrailingDegree_zero
theorem trailingDegree_eq_top : trailingDegree p = ⊤ ↔ p = 0 :=
⟨fun h => support_eq_empty.1 (Finset.min_eq_top.1 h), fun h => by simp [h]⟩
#align polynomial.trailing_degree_eq_top Polynomial.trailingDegree_eq_top
theorem trailingDegree_eq_natTrailingDegree (hp : p ≠ 0) :
trailingDegree p = (natTrailingDegree p : ℕ∞) := by
let ⟨n, hn⟩ :=
not_forall.1 (mt Option.eq_none_iff_forall_not_mem.2 (mt trailingDegree_eq_top.1 hp))
have hn : trailingDegree p = n := Classical.not_not.1 hn
rw [natTrailingDegree, hn]
rfl
#align polynomial.trailing_degree_eq_nat_trailing_degree Polynomial.trailingDegree_eq_natTrailingDegree
| Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean | 111 | 114 | theorem trailingDegree_eq_iff_natTrailingDegree_eq {p : R[X]} {n : ℕ} (hp : p ≠ 0) :
p.trailingDegree = n ↔ p.natTrailingDegree = n := by |
rw [trailingDegree_eq_natTrailingDegree hp]
exact WithTop.coe_eq_coe
| false |
import Mathlib.Topology.Bases
import Mathlib.Topology.DenseEmbedding
#align_import topology.stone_cech from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
noncomputable section
open Filter Set
open Topology
universe u v
section Ultrafilter
def ultrafilterBasis (α : Type u) : Set (Set (Ultrafilter α)) :=
range fun s : Set α => { u | s ∈ u }
#align ultrafilter_basis ultrafilterBasis
variable {α : Type u}
instance Ultrafilter.topologicalSpace : TopologicalSpace (Ultrafilter α) :=
TopologicalSpace.generateFrom (ultrafilterBasis α)
#align ultrafilter.topological_space Ultrafilter.topologicalSpace
theorem ultrafilterBasis_is_basis : TopologicalSpace.IsTopologicalBasis (ultrafilterBasis α) :=
⟨by
rintro _ ⟨a, rfl⟩ _ ⟨b, rfl⟩ u ⟨ua, ub⟩
refine ⟨_, ⟨a ∩ b, rfl⟩, inter_mem ua ub, fun v hv => ⟨?_, ?_⟩⟩ <;> apply mem_of_superset hv <;>
simp [inter_subset_right],
eq_univ_of_univ_subset <| subset_sUnion_of_mem <| ⟨univ, eq_univ_of_forall fun u => univ_mem⟩,
rfl⟩
#align ultrafilter_basis_is_basis ultrafilterBasis_is_basis
theorem ultrafilter_isOpen_basic (s : Set α) : IsOpen { u : Ultrafilter α | s ∈ u } :=
ultrafilterBasis_is_basis.isOpen ⟨s, rfl⟩
#align ultrafilter_is_open_basic ultrafilter_isOpen_basic
theorem ultrafilter_isClosed_basic (s : Set α) : IsClosed { u : Ultrafilter α | s ∈ u } := by
rw [← isOpen_compl_iff]
convert ultrafilter_isOpen_basic sᶜ using 1
ext u
exact Ultrafilter.compl_mem_iff_not_mem.symm
#align ultrafilter_is_closed_basic ultrafilter_isClosed_basic
| Mathlib/Topology/StoneCech.lean | 67 | 77 | theorem ultrafilter_converges_iff {u : Ultrafilter (Ultrafilter α)} {x : Ultrafilter α} :
↑u ≤ 𝓝 x ↔ x = joinM u := by |
rw [eq_comm, ← Ultrafilter.coe_le_coe]
change ↑u ≤ 𝓝 x ↔ ∀ s ∈ x, { v : Ultrafilter α | s ∈ v } ∈ u
simp only [TopologicalSpace.nhds_generateFrom, le_iInf_iff, ultrafilterBasis, le_principal_iff,
mem_setOf_eq]
constructor
· intro h a ha
exact h _ ⟨ha, a, rfl⟩
· rintro h a ⟨xi, a, rfl⟩
exact h _ xi
| false |
import Mathlib.Analysis.InnerProductSpace.Basic
import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex
#align_import measure_theory.function.special_functions.inner from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
variable {α : Type*} {𝕜 : Type*} {E : Type*}
variable [RCLike 𝕜] [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
@[aesop safe 20 apply (rule_sets := [Measurable])]
theorem Measurable.inner {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {f g : α → E} (hf : Measurable f)
(hg : Measurable g) : Measurable fun t => ⟪f t, g t⟫ :=
Continuous.measurable2 continuous_inner hf hg
#align measurable.inner Measurable.inner
@[measurability]
theorem Measurable.const_inner {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {c : E} {f : α → E} (hf : Measurable f) :
Measurable fun t => ⟪c, f t⟫ :=
Measurable.inner measurable_const hf
@[measurability]
theorem Measurable.inner_const {_ : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {c : E} {f : α → E} (hf : Measurable f) :
Measurable fun t => ⟪f t, c⟫ :=
Measurable.inner hf measurable_const
@[aesop safe 20 apply (rule_sets := [Measurable])]
| Mathlib/MeasureTheory/Function/SpecialFunctions/Inner.lean | 41 | 47 | theorem AEMeasurable.inner {m : MeasurableSpace α} [MeasurableSpace E] [OpensMeasurableSpace E]
[SecondCountableTopology E] {μ : MeasureTheory.Measure α} {f g : α → E}
(hf : AEMeasurable f μ) (hg : AEMeasurable g μ) : AEMeasurable (fun x => ⟪f x, g x⟫) μ := by |
refine ⟨fun x => ⟪hf.mk f x, hg.mk g x⟫, hf.measurable_mk.inner hg.measurable_mk, ?_⟩
refine hf.ae_eq_mk.mp (hg.ae_eq_mk.mono fun x hxg hxf => ?_)
dsimp only
congr
| false |
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Tactic.Ring
#align_import data.nat.hyperoperation from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
def hyperoperation : ℕ → ℕ → ℕ → ℕ
| 0, _, k => k + 1
| 1, m, 0 => m
| 2, _, 0 => 0
| _ + 3, _, 0 => 1
| n + 1, m, k + 1 => hyperoperation n m (hyperoperation (n + 1) m k)
#align hyperoperation hyperoperation
-- Basic hyperoperation lemmas
@[simp]
theorem hyperoperation_zero (m : ℕ) : hyperoperation 0 m = Nat.succ :=
funext fun k => by rw [hyperoperation, Nat.succ_eq_add_one]
#align hyperoperation_zero hyperoperation_zero
theorem hyperoperation_ge_three_eq_one (n m : ℕ) : hyperoperation (n + 3) m 0 = 1 := by
rw [hyperoperation]
#align hyperoperation_ge_three_eq_one hyperoperation_ge_three_eq_one
theorem hyperoperation_recursion (n m k : ℕ) :
hyperoperation (n + 1) m (k + 1) = hyperoperation n m (hyperoperation (n + 1) m k) := by
rw [hyperoperation]
#align hyperoperation_recursion hyperoperation_recursion
-- Interesting hyperoperation lemmas
@[simp]
theorem hyperoperation_one : hyperoperation 1 = (· + ·) := by
ext m k
induction' k with bn bih
· rw [Nat.add_zero m, hyperoperation]
· rw [hyperoperation_recursion, bih, hyperoperation_zero]
exact Nat.add_assoc m bn 1
#align hyperoperation_one hyperoperation_one
@[simp]
| Mathlib/Data/Nat/Hyperoperation.lean | 69 | 78 | theorem hyperoperation_two : hyperoperation 2 = (· * ·) := by |
ext m k
induction' k with bn bih
· rw [hyperoperation]
exact (Nat.mul_zero m).symm
· rw [hyperoperation_recursion, hyperoperation_one, bih]
-- Porting note: was `ring`
dsimp only
nth_rewrite 1 [← mul_one m]
rw [← mul_add, add_comm]
| false |
import Mathlib.Data.Fintype.Basic
import Mathlib.ModelTheory.Substructures
#align_import model_theory.elementary_maps from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open FirstOrder
namespace FirstOrder
namespace Language
open Structure
variable (L : Language) (M : Type*) (N : Type*) {P : Type*} {Q : Type*}
variable [L.Structure M] [L.Structure N] [L.Structure P] [L.Structure Q]
structure ElementaryEmbedding where
toFun : M → N
-- Porting note:
-- The autoparam here used to be `obviously`. We would like to replace it with `aesop`
-- but that isn't currently sufficient.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
-- If that can be improved, we should change this to `by aesop` and remove the proofs below.
map_formula' :
∀ ⦃n⦄ (φ : L.Formula (Fin n)) (x : Fin n → M), φ.Realize (toFun ∘ x) ↔ φ.Realize x := by
intros; trivial
#align first_order.language.elementary_embedding FirstOrder.Language.ElementaryEmbedding
#align first_order.language.elementary_embedding.to_fun FirstOrder.Language.ElementaryEmbedding.toFun
#align first_order.language.elementary_embedding.map_formula' FirstOrder.Language.ElementaryEmbedding.map_formula'
@[inherit_doc FirstOrder.Language.ElementaryEmbedding]
scoped[FirstOrder] notation:25 A " ↪ₑ[" L "] " B => FirstOrder.Language.ElementaryEmbedding L A B
variable {L} {M} {N}
namespace ElementaryEmbedding
attribute [coe] toFun
instance instFunLike : FunLike (M ↪ₑ[L] N) M N where
coe f := f.toFun
coe_injective' f g h := by
cases f
cases g
simp only [ElementaryEmbedding.mk.injEq]
ext x
exact Function.funext_iff.1 h x
#align first_order.language.elementary_embedding.fun_like FirstOrder.Language.ElementaryEmbedding.instFunLike
instance : CoeFun (M ↪ₑ[L] N) fun _ => M → N :=
DFunLike.hasCoeToFun
@[simp]
| Mathlib/ModelTheory/ElementaryMaps.lean | 78 | 94 | theorem map_boundedFormula (f : M ↪ₑ[L] N) {α : Type*} {n : ℕ} (φ : L.BoundedFormula α n)
(v : α → M) (xs : Fin n → M) : φ.Realize (f ∘ v) (f ∘ xs) ↔ φ.Realize v xs := by |
classical
rw [← BoundedFormula.realize_restrictFreeVar Set.Subset.rfl, Set.inclusion_eq_id, iff_eq_eq]
have h :=
f.map_formula' ((φ.restrictFreeVar id).toFormula.relabel (Fintype.equivFin _))
(Sum.elim (v ∘ (↑)) xs ∘ (Fintype.equivFin _).symm)
simp only [Formula.realize_relabel, BoundedFormula.realize_toFormula, iff_eq_eq] at h
rw [← Function.comp.assoc _ _ (Fintype.equivFin _).symm,
Function.comp.assoc _ (Fintype.equivFin _).symm (Fintype.equivFin _),
_root_.Equiv.symm_comp_self, Function.comp_id, Function.comp.assoc, Sum.elim_comp_inl,
Function.comp.assoc _ _ Sum.inr, Sum.elim_comp_inr, ← Function.comp.assoc] at h
refine h.trans ?_
erw [Function.comp.assoc _ _ (Fintype.equivFin _), _root_.Equiv.symm_comp_self,
Function.comp_id, Sum.elim_comp_inl, Sum.elim_comp_inr (v ∘ Subtype.val) xs,
← Set.inclusion_eq_id (s := (BoundedFormula.freeVarFinset φ : Set α)) Set.Subset.rfl,
BoundedFormula.realize_restrictFreeVar Set.Subset.rfl]
| false |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.Order.Interval.Set.Group
import Mathlib.Analysis.Convex.Segment
import Mathlib.LinearAlgebra.AffineSpace.FiniteDimensional
import Mathlib.Tactic.FieldSimp
#align_import analysis.convex.between from "leanprover-community/mathlib"@"571e13cacbed7bf042fd3058ce27157101433842"
variable (R : Type*) {V V' P P' : Type*}
open AffineEquiv AffineMap
section OrderedRing
variable [OrderedRing R] [AddCommGroup V] [Module R V] [AddTorsor V P]
variable [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def affineSegment (x y : P) :=
lineMap x y '' Set.Icc (0 : R) 1
#align affine_segment affineSegment
theorem affineSegment_eq_segment (x y : V) : affineSegment R x y = segment R x y := by
rw [segment_eq_image_lineMap, affineSegment]
#align affine_segment_eq_segment affineSegment_eq_segment
theorem affineSegment_comm (x y : P) : affineSegment R x y = affineSegment R y x := by
refine Set.ext fun z => ?_
constructor <;>
· rintro ⟨t, ht, hxy⟩
refine ⟨1 - t, ?_, ?_⟩
· rwa [Set.sub_mem_Icc_iff_right, sub_self, sub_zero]
· rwa [lineMap_apply_one_sub]
#align affine_segment_comm affineSegment_comm
theorem left_mem_affineSegment (x y : P) : x ∈ affineSegment R x y :=
⟨0, Set.left_mem_Icc.2 zero_le_one, lineMap_apply_zero _ _⟩
#align left_mem_affine_segment left_mem_affineSegment
theorem right_mem_affineSegment (x y : P) : y ∈ affineSegment R x y :=
⟨1, Set.right_mem_Icc.2 zero_le_one, lineMap_apply_one _ _⟩
#align right_mem_affine_segment right_mem_affineSegment
@[simp]
theorem affineSegment_same (x : P) : affineSegment R x x = {x} := by
-- Porting note: added as this doesn't do anything in `simp_rw` any more
rw [affineSegment]
-- Note: when adding "simp made no progress" in lean4#2336,
-- had to change `lineMap_same` to `lineMap_same _`. Not sure why?
-- Porting note: added `_ _` and `Function.const`
simp_rw [lineMap_same _, AffineMap.coe_const _ _, Function.const,
(Set.nonempty_Icc.mpr zero_le_one).image_const]
#align affine_segment_same affineSegment_same
variable {R}
@[simp]
| Mathlib/Analysis/Convex/Between.lean | 80 | 83 | theorem affineSegment_image (f : P →ᵃ[R] P') (x y : P) :
f '' affineSegment R x y = affineSegment R (f x) (f y) := by |
rw [affineSegment, affineSegment, Set.image_image, ← comp_lineMap]
rfl
| false |
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.CharZero.Lemmas
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Nat.Choose.Central
import Mathlib.Data.Tree.Basic
import Mathlib.Tactic.FieldSimp
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Positivity
#align_import combinatorics.catalan from "leanprover-community/mathlib"@"26b40791e4a5772a4e53d0e28e4df092119dc7da"
open Finset
open Finset.antidiagonal (fst_le snd_le)
def catalan : ℕ → ℕ
| 0 => 1
| n + 1 =>
∑ i : Fin n.succ,
catalan i * catalan (n - i)
#align catalan catalan
@[simp]
theorem catalan_zero : catalan 0 = 1 := by rw [catalan]
#align catalan_zero catalan_zero
theorem catalan_succ (n : ℕ) : catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) := by
rw [catalan]
#align catalan_succ catalan_succ
theorem catalan_succ' (n : ℕ) :
catalan (n + 1) = ∑ ij ∈ antidiagonal n, catalan ij.1 * catalan ij.2 := by
rw [catalan_succ, Nat.sum_antidiagonal_eq_sum_range_succ (fun x y => catalan x * catalan y) n,
sum_range]
#align catalan_succ' catalan_succ'
@[simp]
theorem catalan_one : catalan 1 = 1 := by simp [catalan_succ]
#align catalan_one catalan_one
private def gosperCatalan (n j : ℕ) : ℚ :=
Nat.centralBinom j * Nat.centralBinom (n - j) * (2 * j - n) / (2 * n * (n + 1))
private theorem gosper_trick {n i : ℕ} (h : i ≤ n) :
gosperCatalan (n + 1) (i + 1) - gosperCatalan (n + 1) i =
Nat.centralBinom i / (i + 1) * Nat.centralBinom (n - i) / (n - i + 1) := by
have l₁ : (i : ℚ) + 1 ≠ 0 := by norm_cast
have l₂ : (n : ℚ) - i + 1 ≠ 0 := by norm_cast
have h₁ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (i + 1))) l₁).symm
have h₂ := (mul_div_cancel_left₀ (↑(Nat.centralBinom (n - i + 1))) l₂).symm
have h₃ : ((i : ℚ) + 1) * (i + 1).centralBinom = 2 * (2 * i + 1) * i.centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ i
have h₄ :
((n : ℚ) - i + 1) * (n - i + 1).centralBinom = 2 * (2 * (n - i) + 1) * (n - i).centralBinom :=
mod_cast Nat.succ_mul_centralBinom_succ (n - i)
simp only [gosperCatalan]
push_cast
rw [show n + 1 - i = n - i + 1 by rw [Nat.add_comm (n - i) 1, ← (Nat.add_sub_assoc h 1),
add_comm]]
rw [h₁, h₂, h₃, h₄]
field_simp
ring
private theorem gosper_catalan_sub_eq_central_binom_div (n : ℕ) : gosperCatalan (n + 1) (n + 1) -
gosperCatalan (n + 1) 0 = Nat.centralBinom (n + 1) / (n + 2) := by
have : (n : ℚ) + 1 ≠ 0 := by norm_cast
have : (n : ℚ) + 1 + 1 ≠ 0 := by norm_cast
have h : (n : ℚ) + 2 ≠ 0 := by norm_cast
simp only [gosperCatalan, Nat.sub_zero, Nat.centralBinom_zero, Nat.sub_self]
field_simp
ring
theorem catalan_eq_centralBinom_div (n : ℕ) : catalan n = n.centralBinom / (n + 1) := by
suffices (catalan n : ℚ) = Nat.centralBinom n / (n + 1) by
have h := Nat.succ_dvd_centralBinom n
exact mod_cast this
induction' n using Nat.case_strong_induction_on with d hd
· simp
· simp_rw [catalan_succ, Nat.cast_sum, Nat.cast_mul]
trans (∑ i : Fin d.succ, Nat.centralBinom i / (i + 1) *
(Nat.centralBinom (d - i) / (d - i + 1)) : ℚ)
· congr
ext1 x
have m_le_d : x.val ≤ d := by apply Nat.le_of_lt_succ; apply x.2
have d_minus_x_le_d : (d - x.val) ≤ d := tsub_le_self
rw [hd _ m_le_d, hd _ d_minus_x_le_d]
norm_cast
· trans (∑ i : Fin d.succ, (gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i))
· refine sum_congr rfl fun i _ => ?_
rw [gosper_trick i.is_le, mul_div]
· rw [← sum_range fun i => gosperCatalan (d + 1) (i + 1) - gosperCatalan (d + 1) i,
sum_range_sub, Nat.succ_eq_add_one]
rw [gosper_catalan_sub_eq_central_binom_div d]
norm_cast
#align catalan_eq_central_binom_div catalan_eq_centralBinom_div
theorem succ_mul_catalan_eq_centralBinom (n : ℕ) : (n + 1) * catalan n = n.centralBinom :=
(Nat.eq_mul_of_div_eq_right n.succ_dvd_centralBinom (catalan_eq_centralBinom_div n).symm).symm
#align succ_mul_catalan_eq_central_binom succ_mul_catalan_eq_centralBinom
theorem catalan_two : catalan 2 = 2 := by
norm_num [catalan_eq_centralBinom_div, Nat.centralBinom, Nat.choose]
#align catalan_two catalan_two
| Mathlib/Combinatorics/Enumerative/Catalan.lean | 148 | 149 | theorem catalan_three : catalan 3 = 5 := by |
norm_num [catalan_eq_centralBinom_div, Nat.centralBinom, Nat.choose]
| false |
import Mathlib.Algebra.FreeMonoid.Basic
import Mathlib.Algebra.Group.Submonoid.MulOpposite
import Mathlib.Algebra.Group.Submonoid.Operations
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.Finset.NoncommProd
import Mathlib.Data.Int.Order.Lemmas
#align_import group_theory.submonoid.membership from "leanprover-community/mathlib"@"e655e4ea5c6d02854696f97494997ba4c31be802"
variable {M A B : Type*}
section Assoc
variable [Monoid M] [SetLike B M] [SubmonoidClass B M] {S : B}
section NonAssoc
variable [MulOneClass M]
open Set
namespace Submonoid
-- TODO: this section can be generalized to `[SubmonoidClass B M] [CompleteLattice B]`
-- such that `CompleteLattice.LE` coincides with `SetLike.LE`
@[to_additive]
theorem mem_iSup_of_directed {ι} [hι : Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S)
{x : M} : (x ∈ ⨆ i, S i) ↔ ∃ i, x ∈ S i := by
refine ⟨?_, fun ⟨i, hi⟩ ↦ le_iSup S i hi⟩
suffices x ∈ closure (⋃ i, (S i : Set M)) → ∃ i, x ∈ S i by
simpa only [closure_iUnion, closure_eq (S _)] using this
refine fun hx ↦ closure_induction hx (fun _ ↦ mem_iUnion.1) ?_ ?_
· exact hι.elim fun i ↦ ⟨i, (S i).one_mem⟩
· rintro x y ⟨i, hi⟩ ⟨j, hj⟩
rcases hS i j with ⟨k, hki, hkj⟩
exact ⟨k, (S k).mul_mem (hki hi) (hkj hj)⟩
#align submonoid.mem_supr_of_directed Submonoid.mem_iSup_of_directed
#align add_submonoid.mem_supr_of_directed AddSubmonoid.mem_iSup_of_directed
@[to_additive]
theorem coe_iSup_of_directed {ι} [Nonempty ι] {S : ι → Submonoid M} (hS : Directed (· ≤ ·) S) :
((⨆ i, S i : Submonoid M) : Set M) = ⋃ i, S i :=
Set.ext fun x ↦ by simp [mem_iSup_of_directed hS]
#align submonoid.coe_supr_of_directed Submonoid.coe_iSup_of_directed
#align add_submonoid.coe_supr_of_directed AddSubmonoid.coe_iSup_of_directed
@[to_additive]
theorem mem_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (· ≤ ·) S) {x : M} : x ∈ sSup S ↔ ∃ s ∈ S, x ∈ s := by
haveI : Nonempty S := Sne.to_subtype
simp [sSup_eq_iSup', mem_iSup_of_directed hS.directed_val, SetCoe.exists, Subtype.coe_mk]
#align submonoid.mem_Sup_of_directed_on Submonoid.mem_sSup_of_directedOn
#align add_submonoid.mem_Sup_of_directed_on AddSubmonoid.mem_sSup_of_directedOn
@[to_additive]
theorem coe_sSup_of_directedOn {S : Set (Submonoid M)} (Sne : S.Nonempty)
(hS : DirectedOn (· ≤ ·) S) : (↑(sSup S) : Set M) = ⋃ s ∈ S, ↑s :=
Set.ext fun x => by simp [mem_sSup_of_directedOn Sne hS]
#align submonoid.coe_Sup_of_directed_on Submonoid.coe_sSup_of_directedOn
#align add_submonoid.coe_Sup_of_directed_on AddSubmonoid.coe_sSup_of_directedOn
@[to_additive]
theorem mem_sup_left {S T : Submonoid M} : ∀ {x : M}, x ∈ S → x ∈ S ⊔ T := by
rw [← SetLike.le_def]
exact le_sup_left
#align submonoid.mem_sup_left Submonoid.mem_sup_left
#align add_submonoid.mem_sup_left AddSubmonoid.mem_sup_left
@[to_additive]
theorem mem_sup_right {S T : Submonoid M} : ∀ {x : M}, x ∈ T → x ∈ S ⊔ T := by
rw [← SetLike.le_def]
exact le_sup_right
#align submonoid.mem_sup_right Submonoid.mem_sup_right
#align add_submonoid.mem_sup_right AddSubmonoid.mem_sup_right
@[to_additive]
theorem mul_mem_sup {S T : Submonoid M} {x y : M} (hx : x ∈ S) (hy : y ∈ T) : x * y ∈ S ⊔ T :=
(S ⊔ T).mul_mem (mem_sup_left hx) (mem_sup_right hy)
#align submonoid.mul_mem_sup Submonoid.mul_mem_sup
#align add_submonoid.add_mem_sup AddSubmonoid.add_mem_sup
@[to_additive]
theorem mem_iSup_of_mem {ι : Sort*} {S : ι → Submonoid M} (i : ι) :
∀ {x : M}, x ∈ S i → x ∈ iSup S := by
rw [← SetLike.le_def]
exact le_iSup _ _
#align submonoid.mem_supr_of_mem Submonoid.mem_iSup_of_mem
#align add_submonoid.mem_supr_of_mem AddSubmonoid.mem_iSup_of_mem
@[to_additive]
| Mathlib/Algebra/Group/Submonoid/Membership.lean | 262 | 265 | theorem mem_sSup_of_mem {S : Set (Submonoid M)} {s : Submonoid M} (hs : s ∈ S) :
∀ {x : M}, x ∈ s → x ∈ sSup S := by |
rw [← SetLike.le_def]
exact le_sSup hs
| false |
import Mathlib.Data.List.Cycle
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.List
#align_import group_theory.perm.cycle.concrete from "leanprover-community/mathlib"@"00638177efd1b2534fc5269363ebf42a7871df9a"
open Equiv Equiv.Perm List
variable {α : Type*}
namespace Equiv.Perm
section Fintype
variable [Fintype α] [DecidableEq α] (p : Equiv.Perm α) (x : α)
def toList : List α :=
(List.range (cycleOf p x).support.card).map fun k => (p ^ k) x
#align equiv.perm.to_list Equiv.Perm.toList
@[simp]
theorem toList_one : toList (1 : Perm α) x = [] := by simp [toList, cycleOf_one]
#align equiv.perm.to_list_one Equiv.Perm.toList_one
@[simp]
theorem toList_eq_nil_iff {p : Perm α} {x} : toList p x = [] ↔ x ∉ p.support := by simp [toList]
#align equiv.perm.to_list_eq_nil_iff Equiv.Perm.toList_eq_nil_iff
@[simp]
theorem length_toList : length (toList p x) = (cycleOf p x).support.card := by simp [toList]
#align equiv.perm.length_to_list Equiv.Perm.length_toList
theorem toList_ne_singleton (y : α) : toList p x ≠ [y] := by
intro H
simpa [card_support_ne_one] using congr_arg length H
#align equiv.perm.to_list_ne_singleton Equiv.Perm.toList_ne_singleton
theorem two_le_length_toList_iff_mem_support {p : Perm α} {x : α} :
2 ≤ length (toList p x) ↔ x ∈ p.support := by simp
#align equiv.perm.two_le_length_to_list_iff_mem_support Equiv.Perm.two_le_length_toList_iff_mem_support
theorem length_toList_pos_of_mem_support (h : x ∈ p.support) : 0 < length (toList p x) :=
zero_lt_two.trans_le (two_le_length_toList_iff_mem_support.mpr h)
#align equiv.perm.length_to_list_pos_of_mem_support Equiv.Perm.length_toList_pos_of_mem_support
theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by simp [toList]
theorem toList_get_zero (h : x ∈ p.support) :
(toList p x).get ⟨0, (length_toList_pos_of_mem_support _ _ h)⟩ = x := by simp [toList]
set_option linter.deprecated false in
@[deprecated get_toList (since := "2024-05-08")]
theorem nthLe_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).nthLe n hn = (p ^ n) x := by simp [toList]
#align equiv.perm.nth_le_to_list Equiv.Perm.nthLe_toList
set_option linter.deprecated false in
@[deprecated toList_get_zero (since := "2024-05-08")]
theorem toList_nthLe_zero (h : x ∈ p.support) :
(toList p x).nthLe 0 (length_toList_pos_of_mem_support _ _ h) = x := by simp [toList]
#align equiv.perm.to_list_nth_le_zero Equiv.Perm.toList_nthLe_zero
variable {p} {x}
theorem mem_toList_iff {y : α} : y ∈ toList p x ↔ SameCycle p x y ∧ x ∈ p.support := by
simp only [toList, mem_range, mem_map]
constructor
· rintro ⟨n, hx, rfl⟩
refine ⟨⟨n, rfl⟩, ?_⟩
contrapose! hx
rw [← support_cycleOf_eq_nil_iff] at hx
simp [hx]
· rintro ⟨h, hx⟩
simpa using h.exists_pow_eq_of_mem_support hx
#align equiv.perm.mem_to_list_iff Equiv.Perm.mem_toList_iff
set_option linter.deprecated false in
theorem nodup_toList (p : Perm α) (x : α) : Nodup (toList p x) := by
by_cases hx : p x = x
· rw [← not_mem_support, ← toList_eq_nil_iff] at hx
simp [hx]
have hc : IsCycle (cycleOf p x) := isCycle_cycleOf p hx
rw [nodup_iff_nthLe_inj]
rintro n m hn hm
rw [length_toList, ← hc.orderOf] at hm hn
rw [← cycleOf_apply_self, ← Ne, ← mem_support] at hx
rw [nthLe_toList, nthLe_toList, ← cycleOf_pow_apply_self p x n, ←
cycleOf_pow_apply_self p x m]
cases' n with n <;> cases' m with m
· simp
· rw [← hc.support_pow_of_pos_of_lt_orderOf m.zero_lt_succ hm, mem_support,
cycleOf_pow_apply_self] at hx
simp [hx.symm]
· rw [← hc.support_pow_of_pos_of_lt_orderOf n.zero_lt_succ hn, mem_support,
cycleOf_pow_apply_self] at hx
simp [hx]
intro h
have hn' : ¬orderOf (p.cycleOf x) ∣ n.succ := Nat.not_dvd_of_pos_of_lt n.zero_lt_succ hn
have hm' : ¬orderOf (p.cycleOf x) ∣ m.succ := Nat.not_dvd_of_pos_of_lt m.zero_lt_succ hm
rw [← hc.support_pow_eq_iff] at hn' hm'
rw [← Nat.mod_eq_of_lt hn, ← Nat.mod_eq_of_lt hm, ← pow_inj_mod]
refine support_congr ?_ ?_
· rw [hm', hn']
· rw [hm']
intro y hy
obtain ⟨k, rfl⟩ := hc.exists_pow_eq (mem_support.mp hx) (mem_support.mp hy)
rw [← mul_apply, (Commute.pow_pow_self _ _ _).eq, mul_apply, h, ← mul_apply, ← mul_apply,
(Commute.pow_pow_self _ _ _).eq]
#align equiv.perm.nodup_to_list Equiv.Perm.nodup_toList
set_option linter.deprecated false in
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 312 | 320 | theorem next_toList_eq_apply (p : Perm α) (x y : α) (hy : y ∈ toList p x) :
next (toList p x) y hy = p y := by |
rw [mem_toList_iff] at hy
obtain ⟨k, hk, hk'⟩ := hy.left.exists_pow_eq_of_mem_support hy.right
rw [← nthLe_toList p x k (by simpa using hk)] at hk'
simp_rw [← hk']
rw [next_nthLe _ (nodup_toList _ _), nthLe_toList, nthLe_toList, ← mul_apply, ← pow_succ',
length_toList, ← pow_mod_orderOf_cycleOf_apply p (k + 1), IsCycle.orderOf]
exact isCycle_cycleOf _ (mem_support.mp hy.right)
| false |
import Mathlib.Analysis.SpecialFunctions.Trigonometric.Complex
#align_import analysis.special_functions.trigonometric.arctan from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
namespace Real
open Set Filter
open scoped Topology Real
theorem tan_add {x y : ℝ}
(h : ((∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) ∨
(∃ k : ℤ, x = (2 * k + 1) * π / 2) ∧ ∃ l : ℤ, y = (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) := by
simpa only [← Complex.ofReal_inj, Complex.ofReal_sub, Complex.ofReal_add, Complex.ofReal_div,
Complex.ofReal_mul, Complex.ofReal_tan] using
@Complex.tan_add (x : ℂ) (y : ℂ) (by convert h <;> norm_cast)
#align real.tan_add Real.tan_add
theorem tan_add' {x y : ℝ}
(h : (∀ k : ℤ, x ≠ (2 * k + 1) * π / 2) ∧ ∀ l : ℤ, y ≠ (2 * l + 1) * π / 2) :
tan (x + y) = (tan x + tan y) / (1 - tan x * tan y) :=
tan_add (Or.inl h)
#align real.tan_add' Real.tan_add'
| Mathlib/Analysis/SpecialFunctions/Trigonometric/Arctan.lean | 47 | 49 | theorem tan_two_mul {x : ℝ} : tan (2 * x) = 2 * tan x / (1 - tan x ^ 2) := by |
have := @Complex.tan_two_mul x
norm_cast at *
| false |
import Mathlib.Algebra.Order.Floor
import Mathlib.Algebra.ContinuedFractions.Basic
#align_import algebra.continued_fractions.computation.basic from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
-- Fix a carrier `K`.
variable (K : Type*)
structure IntFractPair where
b : ℤ
fr : K
#align generalized_continued_fraction.int_fract_pair GeneralizedContinuedFraction.IntFractPair
variable {K}
namespace IntFractPair
instance [Repr K] : Repr (IntFractPair K) :=
⟨fun p _ => "(b : " ++ repr p.b ++ ", fract : " ++ repr p.fr ++ ")"⟩
instance inhabited [Inhabited K] : Inhabited (IntFractPair K) :=
⟨⟨0, default⟩⟩
#align generalized_continued_fraction.int_fract_pair.inhabited GeneralizedContinuedFraction.IntFractPair.inhabited
def mapFr {β : Type*} (f : K → β) (gp : IntFractPair K) : IntFractPair β :=
⟨gp.b, f gp.fr⟩
set_option linter.uppercaseLean3 false in
#align generalized_continued_fraction.int_fract_pair.mapFr GeneralizedContinuedFraction.IntFractPair.mapFr
-- Note: this could be relaxed to something like `LinearOrderedDivisionRing` in the future.
-- Fix a discrete linear ordered field with `floor` function.
variable [LinearOrderedField K] [FloorRing K]
protected def of (v : K) : IntFractPair K :=
⟨⌊v⌋, Int.fract v⟩
#align generalized_continued_fraction.int_fract_pair.of GeneralizedContinuedFraction.IntFractPair.of
protected def stream (v : K) : Stream' <| Option (IntFractPair K)
| 0 => some (IntFractPair.of v)
| n + 1 =>
(IntFractPair.stream v n).bind fun ap_n =>
if ap_n.fr = 0 then none else some (IntFractPair.of ap_n.fr⁻¹)
#align generalized_continued_fraction.int_fract_pair.stream GeneralizedContinuedFraction.IntFractPair.stream
| Mathlib/Algebra/ContinuedFractions/Computation/Basic.lean | 159 | 161 | theorem stream_isSeq (v : K) : (IntFractPair.stream v).IsSeq := by |
intro _ hyp
simp [IntFractPair.stream, hyp]
| false |
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 mulOrdinals
| Mathlib/SetTheory/Cardinal/Ordinal.lean | 500 | 543 | theorem mul_eq_self {c : Cardinal} (h : ℵ₀ ≤ c) : c * c = c := by |
refine le_antisymm ?_ (by simpa only [mul_one] using mul_le_mul_left' (one_le_aleph0.trans h) c)
-- the only nontrivial part is `c * c ≤ c`. We prove it inductively.
refine Acc.recOn (Cardinal.lt_wf.apply c) (fun c _ => Quotient.inductionOn c fun α IH ol => ?_) h
-- consider the minimal well-order `r` on `α` (a type with cardinality `c`).
rcases ord_eq α with ⟨r, wo, e⟩
letI := linearOrderOfSTO r
haveI : IsWellOrder α (· < ·) := wo
-- Define an order `s` on `α × α` by writing `(a, b) < (c, d)` if `max a b < max c d`, or
-- the max are equal and `a < c`, or the max are equal and `a = c` and `b < d`.
let g : α × α → α := fun p => max p.1 p.2
let f : α × α ↪ Ordinal × α × α :=
⟨fun p : α × α => (typein (· < ·) (g p), p), fun p q => congr_arg Prod.snd⟩
let s := f ⁻¹'o Prod.Lex (· < ·) (Prod.Lex (· < ·) (· < ·))
-- this is a well order on `α × α`.
haveI : IsWellOrder _ s := (RelEmbedding.preimage _ _).isWellOrder
/- it suffices to show that this well order is smaller than `r`
if it were larger, then `r` would be a strict prefix of `s`. It would be contained in
`β × β` for some `β` of cardinality `< c`. By the inductive assumption, this set has the
same cardinality as `β` (or it is finite if `β` is finite), so it is `< c`, which is a
contradiction. -/
suffices type s ≤ type r by exact card_le_card this
refine le_of_forall_lt fun o h => ?_
rcases typein_surj s h with ⟨p, rfl⟩
rw [← e, lt_ord]
refine lt_of_le_of_lt
(?_ : _ ≤ card (succ (typein (· < ·) (g p))) * card (succ (typein (· < ·) (g p)))) ?_
· have : { q | s q p } ⊆ insert (g p) { x | x < g p } ×ˢ insert (g p) { x | x < g p } := by
intro q h
simp only [s, f, Preimage, ge_iff_le, Embedding.coeFn_mk, Prod.lex_def, typein_lt_typein,
typein_inj, mem_setOf_eq] at h
exact max_le_iff.1 (le_iff_lt_or_eq.2 <| h.imp_right And.left)
suffices H : (insert (g p) { x | r x (g p) } : Set α) ≃ Sum { x | r x (g p) } PUnit from
⟨(Set.embeddingOfSubset _ _ this).trans
((Equiv.Set.prod _ _).trans (H.prodCongr H)).toEmbedding⟩
refine (Equiv.Set.insert ?_).trans ((Equiv.refl _).sumCongr punitEquivPUnit)
apply @irrefl _ r
cases' lt_or_le (card (succ (typein (· < ·) (g p)))) ℵ₀ with qo qo
· exact (mul_lt_aleph0 qo qo).trans_le ol
· suffices (succ (typein LT.lt (g p))).card < ⟦α⟧ from (IH _ this qo).trans_lt this
rw [← lt_ord]
apply (ord_isLimit ol).2
rw [mk'_def, e]
apply typein_lt_type
| false |
import Mathlib.Algebra.Group.Support
import Mathlib.Algebra.Order.Monoid.WithTop
import Mathlib.Data.Nat.Cast.Field
#align_import algebra.char_zero.lemmas from "leanprover-community/mathlib"@"acee671f47b8e7972a1eb6f4eed74b4b3abce829"
open Function Set
section AddMonoidWithOne
variable {α M : Type*} [AddMonoidWithOne M] [CharZero M] {n : ℕ}
instance CharZero.NeZero.two : NeZero (2 : M) :=
⟨by
have : ((2 : ℕ) : M) ≠ 0 := Nat.cast_ne_zero.2 (by decide)
rwa [Nat.cast_two] at this⟩
#align char_zero.ne_zero.two CharZero.NeZero.two
section
variable {R : Type*} [NonAssocSemiring R] [NoZeroDivisors R] [CharZero R] {a : R}
@[simp]
theorem add_self_eq_zero {a : R} : a + a = 0 ↔ a = 0 := by
simp only [(two_mul a).symm, mul_eq_zero, two_ne_zero, false_or_iff]
#align add_self_eq_zero add_self_eq_zero
set_option linter.deprecated false
@[simp]
theorem bit0_eq_zero {a : R} : bit0 a = 0 ↔ a = 0 :=
add_self_eq_zero
#align bit0_eq_zero bit0_eq_zero
@[simp]
theorem zero_eq_bit0 {a : R} : 0 = bit0 a ↔ a = 0 := by
rw [eq_comm]
exact bit0_eq_zero
#align zero_eq_bit0 zero_eq_bit0
theorem bit0_ne_zero : bit0 a ≠ 0 ↔ a ≠ 0 :=
bit0_eq_zero.not
#align bit0_ne_zero bit0_ne_zero
theorem zero_ne_bit0 : 0 ≠ bit0 a ↔ a ≠ 0 :=
zero_eq_bit0.not
#align zero_ne_bit0 zero_ne_bit0
end
section
variable {R : Type*} [NonAssocRing R] [NoZeroDivisors R] [CharZero R]
@[simp] theorem neg_eq_self_iff {a : R} : -a = a ↔ a = 0 :=
neg_eq_iff_add_eq_zero.trans add_self_eq_zero
#align neg_eq_self_iff neg_eq_self_iff
@[simp] theorem eq_neg_self_iff {a : R} : a = -a ↔ a = 0 :=
eq_neg_iff_add_eq_zero.trans add_self_eq_zero
#align eq_neg_self_iff eq_neg_self_iff
theorem nat_mul_inj {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) : n = 0 ∨ a = b := by
rw [← sub_eq_zero, ← mul_sub, mul_eq_zero, sub_eq_zero] at h
exact mod_cast h
#align nat_mul_inj nat_mul_inj
theorem nat_mul_inj' {n : ℕ} {a b : R} (h : (n : R) * a = (n : R) * b) (w : n ≠ 0) : a = b := by
simpa [w] using nat_mul_inj h
#align nat_mul_inj' nat_mul_inj'
set_option linter.deprecated false
theorem bit0_injective : Function.Injective (bit0 : R → R) := fun a b h => by
dsimp [bit0] at h
simp only [(two_mul a).symm, (two_mul b).symm] at h
refine nat_mul_inj' ?_ two_ne_zero
exact mod_cast h
#align bit0_injective bit0_injective
theorem bit1_injective : Function.Injective (bit1 : R → R) := fun a b h => by
simp only [bit1, add_left_inj] at h
exact bit0_injective h
#align bit1_injective bit1_injective
@[simp]
theorem bit0_eq_bit0 {a b : R} : bit0 a = bit0 b ↔ a = b :=
bit0_injective.eq_iff
#align bit0_eq_bit0 bit0_eq_bit0
@[simp]
theorem bit1_eq_bit1 {a b : R} : bit1 a = bit1 b ↔ a = b :=
bit1_injective.eq_iff
#align bit1_eq_bit1 bit1_eq_bit1
@[simp]
theorem bit1_eq_one {a : R} : bit1 a = 1 ↔ a = 0 := by
rw [show (1 : R) = bit1 0 by simp, bit1_eq_bit1]
#align bit1_eq_one bit1_eq_one
@[simp]
theorem one_eq_bit1 {a : R} : 1 = bit1 a ↔ a = 0 := by
rw [eq_comm]
exact bit1_eq_one
#align one_eq_bit1 one_eq_bit1
end
section
variable {R : Type*} [DivisionRing R] [CharZero R]
@[simp] lemma half_add_self (a : R) : (a + a) / 2 = a := by
rw [← mul_two, mul_div_cancel_right₀ a two_ne_zero]
#align half_add_self half_add_self
@[simp]
theorem add_halves' (a : R) : a / 2 + a / 2 = a := by rw [← add_div, half_add_self]
#align add_halves' add_halves'
theorem sub_half (a : R) : a - a / 2 = a / 2 := by rw [sub_eq_iff_eq_add, add_halves']
#align sub_half sub_half
| Mathlib/Algebra/CharZero/Lemmas.lean | 188 | 188 | theorem half_sub (a : R) : a / 2 - a = -(a / 2) := by | rw [← neg_sub, sub_half]
| false |
import Mathlib.LinearAlgebra.Quotient
#align_import linear_algebra.isomorphisms from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
universe u v
variable {R M M₂ M₃ : Type*}
variable [Ring R] [AddCommGroup M] [AddCommGroup M₂] [AddCommGroup M₃]
variable [Module R M] [Module R M₂] [Module R M₃]
variable (f : M →ₗ[R] M₂)
namespace LinearMap
open Submodule
section IsomorphismLaws
noncomputable def quotKerEquivRange : (M ⧸ LinearMap.ker f) ≃ₗ[R] LinearMap.range f :=
(LinearEquiv.ofInjective (f.ker.liftQ f <| le_rfl) <|
ker_eq_bot.mp <| Submodule.ker_liftQ_eq_bot _ _ _ (le_refl (LinearMap.ker f))).trans
(LinearEquiv.ofEq _ _ <| Submodule.range_liftQ _ _ _)
#align linear_map.quot_ker_equiv_range LinearMap.quotKerEquivRange
noncomputable def quotKerEquivOfSurjective (f : M →ₗ[R] M₂) (hf : Function.Surjective f) :
(M ⧸ LinearMap.ker f) ≃ₗ[R] M₂ :=
f.quotKerEquivRange.trans (LinearEquiv.ofTop (LinearMap.range f) (LinearMap.range_eq_top.2 hf))
#align linear_map.quot_ker_equiv_of_surjective LinearMap.quotKerEquivOfSurjective
@[simp]
theorem quotKerEquivRange_apply_mk (x : M) :
(f.quotKerEquivRange (Submodule.Quotient.mk x) : M₂) = f x :=
rfl
#align linear_map.quot_ker_equiv_range_apply_mk LinearMap.quotKerEquivRange_apply_mk
@[simp]
theorem quotKerEquivRange_symm_apply_image (x : M) (h : f x ∈ LinearMap.range f) :
f.quotKerEquivRange.symm ⟨f x, h⟩ = f.ker.mkQ x :=
f.quotKerEquivRange.symm_apply_apply (f.ker.mkQ x)
#align linear_map.quot_ker_equiv_range_symm_apply_image LinearMap.quotKerEquivRange_symm_apply_image
-- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out
abbrev subToSupQuotient (p p' : Submodule R M) :
{ x // x ∈ p } →ₗ[R] { x // x ∈ p ⊔ p' } ⧸ comap (Submodule.subtype (p ⊔ p')) p' :=
(comap (p ⊔ p').subtype p').mkQ.comp (Submodule.inclusion le_sup_left)
-- Porting note: breaking up original definition of quotientInfToSupQuotient to avoid timing out
theorem comap_leq_ker_subToSupQuotient (p p' : Submodule R M) :
comap (Submodule.subtype p) (p ⊓ p') ≤ ker (subToSupQuotient p p') := by
rw [LinearMap.ker_comp, Submodule.inclusion, comap_codRestrict, ker_mkQ, map_comap_subtype]
exact comap_mono (inf_le_inf_right _ le_sup_left)
def quotientInfToSupQuotient (p p' : Submodule R M) :
(↥p) ⧸ (comap p.subtype (p ⊓ p')) →ₗ[R] (↥(p ⊔ p')) ⧸ (comap (p ⊔ p').subtype p') :=
(comap p.subtype (p ⊓ p')).liftQ (subToSupQuotient p p') (comap_leq_ker_subToSupQuotient p p')
#align linear_map.quotient_inf_to_sup_quotient LinearMap.quotientInfToSupQuotient
-- Porting note: breaking up original definition of quotientInfEquivSupQuotient to avoid timing out
| Mathlib/LinearAlgebra/Isomorphisms.lean | 81 | 85 | theorem quotientInfEquivSupQuotient_injective (p p' : Submodule R M) :
Function.Injective (quotientInfToSupQuotient p p') := by |
rw [← ker_eq_bot, quotientInfToSupQuotient, ker_liftQ_eq_bot]
rw [ker_comp, ker_mkQ]
exact fun ⟨x, hx1⟩ hx2 => ⟨hx1, hx2⟩
| false |
import Mathlib.Order.Antichain
import Mathlib.Order.UpperLower.Basic
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.RelIso.Set
#align_import order.minimal from "leanprover-community/mathlib"@"59694bd07f0a39c5beccba34bd9f413a160782bf"
open Function Set
variable {α : Type*} (r r₁ r₂ : α → α → Prop) (s t : Set α) (a b : α)
def maximals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r a b → r b a }
#align maximals maximals
def minimals : Set α :=
{ a ∈ s | ∀ ⦃b⦄, b ∈ s → r b a → r a b }
#align minimals minimals
theorem maximals_subset : maximals r s ⊆ s :=
sep_subset _ _
#align maximals_subset maximals_subset
theorem minimals_subset : minimals r s ⊆ s :=
sep_subset _ _
#align minimals_subset minimals_subset
@[simp]
theorem maximals_empty : maximals r ∅ = ∅ :=
sep_empty _
#align maximals_empty maximals_empty
@[simp]
theorem minimals_empty : minimals r ∅ = ∅ :=
sep_empty _
#align minimals_empty minimals_empty
@[simp]
theorem maximals_singleton : maximals r {a} = {a} :=
(maximals_subset _ _).antisymm <|
singleton_subset_iff.2 <|
⟨rfl, by
rintro b (rfl : b = a)
exact id⟩
#align maximals_singleton maximals_singleton
@[simp]
theorem minimals_singleton : minimals r {a} = {a} :=
maximals_singleton _ _
#align minimals_singleton minimals_singleton
theorem maximals_swap : maximals (swap r) s = minimals r s :=
rfl
#align maximals_swap maximals_swap
theorem minimals_swap : minimals (swap r) s = maximals r s :=
rfl
#align minimals_swap minimals_swap
section IsAntisymm
variable {r s t a b} [IsAntisymm α r]
theorem eq_of_mem_maximals (ha : a ∈ maximals r s) (hb : b ∈ s) (h : r a b) : a = b :=
antisymm h <| ha.2 hb h
#align eq_of_mem_maximals eq_of_mem_maximals
theorem eq_of_mem_minimals (ha : a ∈ minimals r s) (hb : b ∈ s) (h : r b a) : a = b :=
antisymm (ha.2 hb h) h
#align eq_of_mem_minimals eq_of_mem_minimals
set_option autoImplicit true
theorem mem_maximals_iff : x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r x y → x = y := by
simp only [maximals, Set.mem_sep_iff, and_congr_right_iff]
refine fun _ ↦ ⟨fun h y hys hxy ↦ antisymm hxy (h hys hxy), fun h y hys hxy ↦ ?_⟩
convert hxy <;> rw [h hys hxy]
theorem mem_maximals_setOf_iff : x ∈ maximals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r x y → x = y :=
mem_maximals_iff
theorem mem_minimals_iff : x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, y ∈ s → r y x → x = y :=
@mem_maximals_iff _ _ _ (IsAntisymm.swap r) _
theorem mem_minimals_setOf_iff : x ∈ minimals r (setOf P) ↔ P x ∧ ∀ ⦃y⦄, P y → r y x → x = y :=
mem_minimals_iff
theorem mem_minimals_iff_forall_lt_not_mem' (rlt : α → α → Prop) [IsNonstrictStrictOrder α r rlt] :
x ∈ minimals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, rlt y x → y ∉ s := by
simp [minimals, right_iff_left_not_left_of r rlt, not_imp_not, imp.swap (a := _ ∈ _)]
theorem mem_maximals_iff_forall_lt_not_mem' (rlt : α → α → Prop) [IsNonstrictStrictOrder α r rlt] :
x ∈ maximals r s ↔ x ∈ s ∧ ∀ ⦃y⦄, rlt x y → y ∉ s := by
simp [maximals, right_iff_left_not_left_of r rlt, not_imp_not, imp.swap (a := _ ∈ _)]
| Mathlib/Order/Minimal.lean | 121 | 128 | theorem minimals_eq_minimals_of_subset_of_forall [IsTrans α r] (hts : t ⊆ s)
(h : ∀ x ∈ s, ∃ y ∈ t, r y x) : minimals r s = minimals r t := by |
refine Set.ext fun a ↦ ⟨fun ⟨has, hmin⟩ ↦ ⟨?_,fun b hbt ↦ hmin (hts hbt)⟩,
fun ⟨hat, hmin⟩ ↦ ⟨hts hat, fun b hbs hba ↦ ?_⟩⟩
· obtain ⟨a', ha', haa'⟩ := h _ has
rwa [antisymm (hmin (hts ha') haa') haa']
obtain ⟨b', hb't, hb'b⟩ := h b hbs
rwa [antisymm (hmin hb't (Trans.trans hb'b hba)) (Trans.trans hb'b hba)]
| false |
import Mathlib.Topology.PartialHomeomorph
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.Analysis.NormedSpace.Pointwise
import Mathlib.Data.Real.Sqrt
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Set Metric Pointwise
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
noncomputable section
@[simps (config := .lemmasOnly)]
def PartialHomeomorph.univUnitBall : PartialHomeomorph E E where
toFun x := (√(1 + ‖x‖ ^ 2))⁻¹ • x
invFun y := (√(1 - ‖(y : E)‖ ^ 2))⁻¹ • (y : E)
source := univ
target := ball 0 1
map_source' x _ := by
have : 0 < 1 + ‖x‖ ^ 2 := by positivity
rw [mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv, ← _root_.div_eq_inv_mul,
div_lt_one (abs_pos.mpr <| Real.sqrt_ne_zero'.mpr this), ← abs_norm x, ← sq_lt_sq,
abs_norm, Real.sq_sqrt this.le]
exact lt_one_add _
map_target' _ _ := trivial
left_inv' x _ := by
field_simp [norm_smul, smul_smul, (zero_lt_one_add_norm_sq x).ne', sq_abs,
Real.sq_sqrt (zero_lt_one_add_norm_sq x).le, ← Real.sqrt_div (zero_lt_one_add_norm_sq x).le]
right_inv' y hy := by
have : 0 < 1 - ‖y‖ ^ 2 := by nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
field_simp [norm_smul, smul_smul, this.ne', sq_abs, Real.sq_sqrt this.le,
← Real.sqrt_div this.le]
open_source := isOpen_univ
open_target := isOpen_ball
continuousOn_toFun := by
suffices Continuous fun (x:E) => (√(1 + ‖x‖ ^ 2))⁻¹
from (this.smul continuous_id).continuousOn
refine Continuous.inv₀ ?_ fun x => Real.sqrt_ne_zero'.mpr (by positivity)
continuity
continuousOn_invFun := by
have : ∀ y ∈ ball (0 : E) 1, √(1 - ‖(y : E)‖ ^ 2) ≠ 0 := fun y hy ↦ by
rw [Real.sqrt_ne_zero']
nlinarith [norm_nonneg y, mem_ball_zero_iff.1 hy]
exact ContinuousOn.smul (ContinuousOn.inv₀
(continuousOn_const.sub (continuous_norm.continuousOn.pow _)).sqrt this) continuousOn_id
@[simp]
theorem PartialHomeomorph.univUnitBall_apply_zero : univUnitBall (0 : E) = 0 := by
simp [PartialHomeomorph.univUnitBall_apply]
@[simp]
theorem PartialHomeomorph.univUnitBall_symm_apply_zero : univUnitBall.symm (0 : E) = 0 := by
simp [PartialHomeomorph.univUnitBall_symm_apply]
@[simps! (config := .lemmasOnly)]
def Homeomorph.unitBall : E ≃ₜ ball (0 : E) 1 :=
(Homeomorph.Set.univ _).symm.trans PartialHomeomorph.univUnitBall.toHomeomorphSourceTarget
#align homeomorph_unit_ball Homeomorph.unitBall
@[simp]
theorem Homeomorph.coe_unitBall_apply_zero :
(Homeomorph.unitBall (0 : E) : E) = 0 :=
PartialHomeomorph.univUnitBall_apply_zero
#align coe_homeomorph_unit_ball_apply_zero Homeomorph.coe_unitBall_apply_zero
variable {P : Type*} [PseudoMetricSpace P] [NormedAddTorsor E P]
namespace PartialHomeomorph
@[simps!]
def unitBallBall (c : P) (r : ℝ) (hr : 0 < r) : PartialHomeomorph E P :=
((Homeomorph.smulOfNeZero r hr.ne').trans
(IsometryEquiv.vaddConst c).toHomeomorph).toPartialHomeomorphOfImageEq
(ball 0 1) isOpen_ball (ball c r) <| by
change (IsometryEquiv.vaddConst c) ∘ (r • ·) '' ball (0 : E) 1 = ball c r
rw [image_comp, image_smul, smul_unitBall hr.ne', IsometryEquiv.image_ball]
simp [abs_of_pos hr]
def univBall (c : P) (r : ℝ) : PartialHomeomorph E P :=
if h : 0 < r then univUnitBall.trans' (unitBallBall c r h) rfl
else (IsometryEquiv.vaddConst c).toHomeomorph.toPartialHomeomorph
@[simp]
theorem univBall_source (c : P) (r : ℝ) : (univBall c r).source = univ := by
unfold univBall; split_ifs <;> rfl
| Mathlib/Analysis/NormedSpace/HomeomorphBall.lean | 130 | 131 | theorem univBall_target (c : P) {r : ℝ} (hr : 0 < r) : (univBall c r).target = ball c r := by |
rw [univBall, dif_pos hr]; rfl
| false |
import Mathlib.Logic.Encodable.Lattice
import Mathlib.MeasureTheory.MeasurableSpace.Defs
#align_import measure_theory.pi_system from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
open MeasurableSpace Set
open scoped Classical
open MeasureTheory
def IsPiSystem {α} (C : Set (Set α)) : Prop :=
∀ᵉ (s ∈ C) (t ∈ C), (s ∩ t : Set α).Nonempty → s ∩ t ∈ C
#align is_pi_system IsPiSystem
theorem IsPiSystem.singleton {α} (S : Set α) : IsPiSystem ({S} : Set (Set α)) := by
intro s h_s t h_t _
rw [Set.mem_singleton_iff.1 h_s, Set.mem_singleton_iff.1 h_t, Set.inter_self,
Set.mem_singleton_iff]
#align is_pi_system.singleton IsPiSystem.singleton
theorem IsPiSystem.insert_empty {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert ∅ S) := by
intro s hs t ht hst
cases' hs with hs hs
· simp [hs]
· cases' ht with ht ht
· simp [ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_empty IsPiSystem.insert_empty
theorem IsPiSystem.insert_univ {α} {S : Set (Set α)} (h_pi : IsPiSystem S) :
IsPiSystem (insert Set.univ S) := by
intro s hs t ht hst
cases' hs with hs hs
· cases' ht with ht ht <;> simp [hs, ht]
· cases' ht with ht ht
· simp [hs, ht]
· exact Set.mem_insert_of_mem _ (h_pi s hs t ht hst)
#align is_pi_system.insert_univ IsPiSystem.insert_univ
theorem IsPiSystem.comap {α β} {S : Set (Set β)} (h_pi : IsPiSystem S) (f : α → β) :
IsPiSystem { s : Set α | ∃ t ∈ S, f ⁻¹' t = s } := by
rintro _ ⟨s, hs_mem, rfl⟩ _ ⟨t, ht_mem, rfl⟩ hst
rw [← Set.preimage_inter] at hst ⊢
exact ⟨s ∩ t, h_pi s hs_mem t ht_mem (nonempty_of_nonempty_preimage hst), rfl⟩
#align is_pi_system.comap IsPiSystem.comap
theorem isPiSystem_iUnion_of_directed_le {α ι} (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_directed : Directed (· ≤ ·) p) :
IsPiSystem (⋃ n, p n) := by
intro t1 ht1 t2 ht2 h
rw [Set.mem_iUnion] at ht1 ht2 ⊢
cases' ht1 with n ht1
cases' ht2 with m ht2
obtain ⟨k, hpnk, hpmk⟩ : ∃ k, p n ≤ p k ∧ p m ≤ p k := hp_directed n m
exact ⟨k, hp_pi k t1 (hpnk ht1) t2 (hpmk ht2) h⟩
#align is_pi_system_Union_of_directed_le isPiSystem_iUnion_of_directed_le
theorem isPiSystem_iUnion_of_monotone {α ι} [SemilatticeSup ι] (p : ι → Set (Set α))
(hp_pi : ∀ n, IsPiSystem (p n)) (hp_mono : Monotone p) : IsPiSystem (⋃ n, p n) :=
isPiSystem_iUnion_of_directed_le p hp_pi (Monotone.directed_le hp_mono)
#align is_pi_system_Union_of_monotone isPiSystem_iUnion_of_monotone
inductive generatePiSystem {α} (S : Set (Set α)) : Set (Set α)
| base {s : Set α} (h_s : s ∈ S) : generatePiSystem S s
| inter {s t : Set α} (h_s : generatePiSystem S s) (h_t : generatePiSystem S t)
(h_nonempty : (s ∩ t).Nonempty) : generatePiSystem S (s ∩ t)
#align generate_pi_system generatePiSystem
theorem isPiSystem_generatePiSystem {α} (S : Set (Set α)) : IsPiSystem (generatePiSystem S) :=
fun _ h_s _ h_t h_nonempty => generatePiSystem.inter h_s h_t h_nonempty
#align is_pi_system_generate_pi_system isPiSystem_generatePiSystem
theorem subset_generatePiSystem_self {α} (S : Set (Set α)) : S ⊆ generatePiSystem S := fun _ =>
generatePiSystem.base
#align subset_generate_pi_system_self subset_generatePiSystem_self
theorem generatePiSystem_subset_self {α} {S : Set (Set α)} (h_S : IsPiSystem S) :
generatePiSystem S ⊆ S := fun x h => by
induction' h with _ h_s s u _ _ h_nonempty h_s h_u
· exact h_s
· exact h_S _ h_s _ h_u h_nonempty
#align generate_pi_system_subset_self generatePiSystem_subset_self
theorem generatePiSystem_eq {α} {S : Set (Set α)} (h_pi : IsPiSystem S) : generatePiSystem S = S :=
Set.Subset.antisymm (generatePiSystem_subset_self h_pi) (subset_generatePiSystem_self S)
#align generate_pi_system_eq generatePiSystem_eq
theorem generatePiSystem_mono {α} {S T : Set (Set α)} (hST : S ⊆ T) :
generatePiSystem S ⊆ generatePiSystem T := fun t ht => by
induction' ht with s h_s s u _ _ h_nonempty h_s h_u
· exact generatePiSystem.base (Set.mem_of_subset_of_mem hST h_s)
· exact isPiSystem_generatePiSystem T _ h_s _ h_u h_nonempty
#align generate_pi_system_mono generatePiSystem_mono
| Mathlib/MeasureTheory/PiSystem.lean | 256 | 261 | theorem generatePiSystem_measurableSet {α} [M : MeasurableSpace α] {S : Set (Set α)}
(h_meas_S : ∀ s ∈ S, MeasurableSet s) (t : Set α) (h_in_pi : t ∈ generatePiSystem S) :
MeasurableSet t := by |
induction' h_in_pi with s h_s s u _ _ _ h_s h_u
· apply h_meas_S _ h_s
· apply MeasurableSet.inter h_s h_u
| false |
import Mathlib.Analysis.SpecificLimits.Basic
import Mathlib.Order.Interval.Set.IsoIoo
import Mathlib.Topology.Order.MonotoneContinuity
import Mathlib.Topology.UrysohnsBounded
#align_import topology.tietze_extension from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [NormalSpace Y]
open Metric Set Filter
open BoundedContinuousFunction Topology
noncomputable section
namespace BoundedContinuousFunction
theorem tietze_extension_step (f : X →ᵇ ℝ) (e : C(X, Y)) (he : ClosedEmbedding e) :
∃ g : Y →ᵇ ℝ, ‖g‖ ≤ ‖f‖ / 3 ∧ dist (g.compContinuous e) f ≤ 2 / 3 * ‖f‖ := by
have h3 : (0 : ℝ) < 3 := by norm_num1
have h23 : 0 < (2 / 3 : ℝ) := by norm_num1
-- In the trivial case `f = 0`, we take `g = 0`
rcases eq_or_ne f 0 with (rfl | hf)
· use 0
simp
replace hf : 0 < ‖f‖ := norm_pos_iff.2 hf
have hf3 : -‖f‖ / 3 < ‖f‖ / 3 := (div_lt_div_right h3).2 (Left.neg_lt_self hf)
have hc₁ : IsClosed (e '' (f ⁻¹' Iic (-‖f‖ / 3))) :=
he.isClosedMap _ (isClosed_Iic.preimage f.continuous)
have hc₂ : IsClosed (e '' (f ⁻¹' Ici (‖f‖ / 3))) :=
he.isClosedMap _ (isClosed_Ici.preimage f.continuous)
have hd : Disjoint (e '' (f ⁻¹' Iic (-‖f‖ / 3))) (e '' (f ⁻¹' Ici (‖f‖ / 3))) := by
refine disjoint_image_of_injective he.inj (Disjoint.preimage _ ?_)
rwa [Iic_disjoint_Ici, not_le]
rcases exists_bounded_mem_Icc_of_closed_of_le hc₁ hc₂ hd hf3.le with ⟨g, hg₁, hg₂, hgf⟩
refine ⟨g, ?_, ?_⟩
· refine (norm_le <| div_nonneg hf.le h3.le).mpr fun y => ?_
simpa [abs_le, neg_div] using hgf y
· refine (dist_le <| mul_nonneg h23.le hf.le).mpr fun x => ?_
have hfx : -‖f‖ ≤ f x ∧ f x ≤ ‖f‖ := by
simpa only [Real.norm_eq_abs, abs_le] using f.norm_coe_le_norm x
rcases le_total (f x) (-‖f‖ / 3) with hle₁ | hle₁
· calc
|g (e x) - f x| = -‖f‖ / 3 - f x := by
rw [hg₁ (mem_image_of_mem _ hle₁), Function.const_apply,
abs_of_nonneg (sub_nonneg.2 hle₁)]
_ ≤ 2 / 3 * ‖f‖ := by linarith
· rcases le_total (f x) (‖f‖ / 3) with hle₂ | hle₂
· simp only [neg_div] at *
calc
dist (g (e x)) (f x) ≤ |g (e x)| + |f x| := dist_le_norm_add_norm _ _
_ ≤ ‖f‖ / 3 + ‖f‖ / 3 := (add_le_add (abs_le.2 <| hgf _) (abs_le.2 ⟨hle₁, hle₂⟩))
_ = 2 / 3 * ‖f‖ := by linarith
· calc
|g (e x) - f x| = f x - ‖f‖ / 3 := by
rw [hg₂ (mem_image_of_mem _ hle₂), abs_sub_comm, Function.const_apply,
abs_of_nonneg (sub_nonneg.2 hle₂)]
_ ≤ 2 / 3 * ‖f‖ := by linarith
#align bounded_continuous_function.tietze_extension_step BoundedContinuousFunction.tietze_extension_step
| Mathlib/Topology/TietzeExtension.lean | 220 | 262 | theorem exists_extension_norm_eq_of_closedEmbedding' (f : X →ᵇ ℝ) (e : C(X, Y))
(he : ClosedEmbedding e) : ∃ g : Y →ᵇ ℝ, ‖g‖ = ‖f‖ ∧ g.compContinuous e = f := by |
/- For the proof, we iterate `tietze_extension_step`. Each time we apply it to the difference
between the previous approximation and `f`. -/
choose F hF_norm hF_dist using fun f : X →ᵇ ℝ => tietze_extension_step f e he
set g : ℕ → Y →ᵇ ℝ := fun n => (fun g => g + F (f - g.compContinuous e))^[n] 0
have g0 : g 0 = 0 := rfl
have g_succ : ∀ n, g (n + 1) = g n + F (f - (g n).compContinuous e) := fun n =>
Function.iterate_succ_apply' _ _ _
have hgf : ∀ n, dist ((g n).compContinuous e) f ≤ (2 / 3) ^ n * ‖f‖ := by
intro n
induction' n with n ihn
· simp [g0]
· rw [g_succ n, add_compContinuous, ← dist_sub_right, add_sub_cancel_left, pow_succ', mul_assoc]
refine (hF_dist _).trans (mul_le_mul_of_nonneg_left ?_ (by norm_num1))
rwa [← dist_eq_norm']
have hg_dist : ∀ n, dist (g n) (g (n + 1)) ≤ 1 / 3 * ‖f‖ * (2 / 3) ^ n := by
intro n
calc
dist (g n) (g (n + 1)) = ‖F (f - (g n).compContinuous e)‖ := by
rw [g_succ, dist_eq_norm', add_sub_cancel_left]
_ ≤ ‖f - (g n).compContinuous e‖ / 3 := hF_norm _
_ = 1 / 3 * dist ((g n).compContinuous e) f := by rw [dist_eq_norm', one_div, div_eq_inv_mul]
_ ≤ 1 / 3 * ((2 / 3) ^ n * ‖f‖) := mul_le_mul_of_nonneg_left (hgf n) (by norm_num1)
_ = 1 / 3 * ‖f‖ * (2 / 3) ^ n := by ac_rfl
have hg_cau : CauchySeq g := cauchySeq_of_le_geometric _ _ (by norm_num1) hg_dist
have :
Tendsto (fun n => (g n).compContinuous e) atTop
(𝓝 <| (limUnder atTop g).compContinuous e) :=
((continuous_compContinuous e).tendsto _).comp hg_cau.tendsto_limUnder
have hge : (limUnder atTop g).compContinuous e = f := by
refine tendsto_nhds_unique this (tendsto_iff_dist_tendsto_zero.2 ?_)
refine squeeze_zero (fun _ => dist_nonneg) hgf ?_
rw [← zero_mul ‖f‖]
refine (tendsto_pow_atTop_nhds_zero_of_lt_one ?_ ?_).mul tendsto_const_nhds <;> norm_num1
refine ⟨limUnder atTop g, le_antisymm ?_ ?_, hge⟩
· rw [← dist_zero_left, ← g0]
refine
(dist_le_of_le_geometric_of_tendsto₀ _ _ (by norm_num1)
hg_dist hg_cau.tendsto_limUnder).trans_eq ?_
field_simp [show (3 - 2 : ℝ) = 1 by norm_num1]
· rw [← hge]
exact norm_compContinuous_le _ _
| false |
import Mathlib.Analysis.RCLike.Lemmas
import Mathlib.MeasureTheory.Constructions.BorelSpace.Complex
#align_import measure_theory.function.special_functions.is_R_or_C from "leanprover-community/mathlib"@"83a66c8775fa14ee5180c85cab98e970956401ad"
noncomputable section
open NNReal ENNReal
namespace RCLike
variable {𝕜 : Type*} [RCLike 𝕜]
@[measurability]
theorem measurable_re : Measurable (re : 𝕜 → ℝ) :=
continuous_re.measurable
#align is_R_or_C.measurable_re RCLike.measurable_re
@[measurability]
theorem measurable_im : Measurable (im : 𝕜 → ℝ) :=
continuous_im.measurable
#align is_R_or_C.measurable_im RCLike.measurable_im
end RCLike
section
variable {α 𝕜 : Type*} [RCLike 𝕜] [MeasurableSpace α] {f : α → 𝕜} {μ : MeasureTheory.Measure α}
@[measurability]
theorem RCLike.measurable_ofReal : Measurable ((↑) : ℝ → 𝕜) :=
RCLike.continuous_ofReal.measurable
#align is_R_or_C.measurable_of_real RCLike.measurable_ofReal
theorem measurable_of_re_im (hre : Measurable fun x => RCLike.re (f x))
(him : Measurable fun x => RCLike.im (f x)) : Measurable f := by
convert Measurable.add (M := 𝕜) (RCLike.measurable_ofReal.comp hre)
((RCLike.measurable_ofReal.comp him).mul_const RCLike.I)
exact (RCLike.re_add_im _).symm
#align measurable_of_re_im measurable_of_re_im
| Mathlib/MeasureTheory/Function/SpecialFunctions/RCLike.lean | 80 | 84 | theorem aemeasurable_of_re_im (hre : AEMeasurable (fun x => RCLike.re (f x)) μ)
(him : AEMeasurable (fun x => RCLike.im (f x)) μ) : AEMeasurable f μ := by |
convert AEMeasurable.add (M := 𝕜) (RCLike.measurable_ofReal.comp_aemeasurable hre)
((RCLike.measurable_ofReal.comp_aemeasurable him).mul_const RCLike.I)
exact (RCLike.re_add_im _).symm
| false |
import Mathlib.RingTheory.GradedAlgebra.Basic
import Mathlib.Algebra.GradedMulAction
import Mathlib.Algebra.DirectSum.Decomposition
import Mathlib.Algebra.Module.BigOperators
#align_import algebra.module.graded_module from "leanprover-community/mathlib"@"59cdeb0da2480abbc235b7e611ccd9a7e5603d7c"
section
open DirectSum
variable {ιA ιB : Type*} (A : ιA → Type*) (M : ιB → Type*)
namespace DirectSum
open GradedMonoid
class GdistribMulAction [AddMonoid ιA] [VAdd ιA ιB] [GMonoid A] [∀ i, AddMonoid (M i)]
extends GMulAction A M where
smul_add {i j} (a : A i) (b c : M j) : smul a (b + c) = smul a b + smul a c
smul_zero {i j} (a : A i) : smul a (0 : M j) = 0
#align direct_sum.gdistrib_mul_action DirectSum.GdistribMulAction
class Gmodule [AddMonoid ιA] [VAdd ιA ιB] [∀ i, AddMonoid (A i)] [∀ i, AddMonoid (M i)] [GMonoid A]
extends GdistribMulAction A M where
add_smul {i j} (a a' : A i) (b : M j) : smul (a + a') b = smul a b + smul a' b
zero_smul {i j} (b : M j) : smul (0 : A i) b = 0
#align direct_sum.gmodule DirectSum.Gmodule
instance GSemiring.toGmodule [AddMonoid ιA] [∀ i : ιA, AddCommMonoid (A i)]
[h : GSemiring A] : Gmodule A A :=
{ GMonoid.toGMulAction A with
smul_add := fun _ _ _ => h.mul_add _ _ _
smul_zero := fun _ => h.mul_zero _
add_smul := fun _ _ => h.add_mul _ _
zero_smul := fun _ => h.zero_mul _ }
#align direct_sum.gsemiring.to_gmodule DirectSum.GSemiring.toGmodule
variable [AddMonoid ιA] [VAdd ιA ιB] [∀ i : ιA, AddCommMonoid (A i)] [∀ i, AddCommMonoid (M i)]
@[simps]
def gsmulHom [GMonoid A] [Gmodule A M] {i j} : A i →+ M j →+ M (i +ᵥ j) where
toFun a :=
{ toFun := fun b => GSMul.smul a b
map_zero' := GdistribMulAction.smul_zero _
map_add' := GdistribMulAction.smul_add _ }
map_zero' := AddMonoidHom.ext fun a => Gmodule.zero_smul a
map_add' _a₁ _a₂ := AddMonoidHom.ext fun _b => Gmodule.add_smul _ _ _
#align direct_sum.gsmul_hom DirectSum.gsmulHom
namespace Gmodule
def smulAddMonoidHom [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M] :
(⨁ i, A i) →+ (⨁ i, M i) →+ ⨁ i, M i :=
toAddMonoid fun _i =>
AddMonoidHom.flip <|
toAddMonoid fun _j => AddMonoidHom.flip <| (of M _).compHom.comp <| gsmulHom A M
#align direct_sum.gmodule.smul_add_monoid_hom DirectSum.Gmodule.smulAddMonoidHom
section
open GradedMonoid DirectSum Gmodule
instance [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M] :
SMul (⨁ i, A i) (⨁ i, M i) where
smul x y := smulAddMonoidHom A M x y
@[simp]
theorem smul_def [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M]
(x : ⨁ i, A i) (y : ⨁ i, M i) :
x • y = smulAddMonoidHom _ _ x y := rfl
#align direct_sum.gmodule.smul_def DirectSum.Gmodule.smul_def
@[simp]
| Mathlib/Algebra/Module/GradedModule.lean | 99 | 102 | theorem smulAddMonoidHom_apply_of_of [DecidableEq ιA] [DecidableEq ιB] [GMonoid A] [Gmodule A M]
{i j} (x : A i) (y : M j) :
smulAddMonoidHom A M (DirectSum.of A i x) (of M j y) = of M (i +ᵥ j) (GSMul.smul x y) := by |
simp [smulAddMonoidHom]
| false |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm]
#align symm_diff_comm symmDiff_comm
instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) :=
⟨symmDiff_comm⟩
#align symm_diff_is_comm symmDiff_isCommutative
@[simp]
theorem symmDiff_self : a ∆ a = ⊥ := by rw [symmDiff, sup_idem, sdiff_self]
#align symm_diff_self symmDiff_self
@[simp]
| Mathlib/Order/SymmDiff.lean | 125 | 125 | theorem symmDiff_bot : a ∆ ⊥ = a := by | rw [symmDiff, sdiff_bot, bot_sdiff, sup_bot_eq]
| false |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
| Mathlib/Order/SymmDiff.lean | 113 | 113 | theorem symmDiff_comm : a ∆ b = b ∆ a := by | simp only [symmDiff, sup_comm]
| false |
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.Factors
import Mathlib.Order.Interval.Finset.Nat
#align_import number_theory.divisors from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
open scoped Classical
open Finset
namespace Nat
variable (n : ℕ)
def divisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 (n + 1))
#align nat.divisors Nat.divisors
def properDivisors : Finset ℕ :=
Finset.filter (fun x : ℕ => x ∣ n) (Finset.Ico 1 n)
#align nat.proper_divisors Nat.properDivisors
def divisorsAntidiagonal : Finset (ℕ × ℕ) :=
Finset.filter (fun x => x.fst * x.snd = n) (Ico 1 (n + 1) ×ˢ Ico 1 (n + 1))
#align nat.divisors_antidiagonal Nat.divisorsAntidiagonal
variable {n}
@[simp]
theorem filter_dvd_eq_divisors (h : n ≠ 0) : (Finset.range n.succ).filter (· ∣ n) = n.divisors := by
ext
simp only [divisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_divisors Nat.filter_dvd_eq_divisors
@[simp]
theorem filter_dvd_eq_properDivisors (h : n ≠ 0) :
(Finset.range n).filter (· ∣ n) = n.properDivisors := by
ext
simp only [properDivisors, mem_filter, mem_range, mem_Ico, and_congr_left_iff, iff_and_self]
exact fun ha _ => succ_le_iff.mpr (pos_of_dvd_of_pos ha h.bot_lt)
#align nat.filter_dvd_eq_proper_divisors Nat.filter_dvd_eq_properDivisors
theorem properDivisors.not_self_mem : ¬n ∈ properDivisors n := by simp [properDivisors]
#align nat.proper_divisors.not_self_mem Nat.properDivisors.not_self_mem
@[simp]
theorem mem_properDivisors {m : ℕ} : n ∈ properDivisors m ↔ n ∣ m ∧ n < m := by
rcases eq_or_ne m 0 with (rfl | hm); · simp [properDivisors]
simp only [and_comm, ← filter_dvd_eq_properDivisors hm, mem_filter, mem_range]
#align nat.mem_proper_divisors Nat.mem_properDivisors
theorem insert_self_properDivisors (h : n ≠ 0) : insert n (properDivisors n) = divisors n := by
rw [divisors, properDivisors, Ico_succ_right_eq_insert_Ico (one_le_iff_ne_zero.2 h),
Finset.filter_insert, if_pos (dvd_refl n)]
#align nat.insert_self_proper_divisors Nat.insert_self_properDivisors
theorem cons_self_properDivisors (h : n ≠ 0) :
cons n (properDivisors n) properDivisors.not_self_mem = divisors n := by
rw [cons_eq_insert, insert_self_properDivisors h]
#align nat.cons_self_proper_divisors Nat.cons_self_properDivisors
@[simp]
| Mathlib/NumberTheory/Divisors.lean | 95 | 99 | theorem mem_divisors {m : ℕ} : n ∈ divisors m ↔ n ∣ m ∧ m ≠ 0 := by |
rcases eq_or_ne m 0 with (rfl | hm); · simp [divisors]
simp only [hm, Ne, not_false_iff, and_true_iff, ← filter_dvd_eq_divisors hm, mem_filter,
mem_range, and_iff_right_iff_imp, Nat.lt_succ_iff]
exact le_of_dvd hm.bot_lt
| false |
import Mathlib.CategoryTheory.Action
import Mathlib.Combinatorics.Quiver.Arborescence
import Mathlib.Combinatorics.Quiver.ConnectedComponent
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
#align_import group_theory.nielsen_schreier from "leanprover-community/mathlib"@"1bda4fc53de6ade5ab9da36f2192e24e2084a2ce"
noncomputable section
open scoped Classical
universe v u
open CategoryTheory CategoryTheory.ActionCategory CategoryTheory.SingleObj Quiver FreeGroup
-- Porting note(#5171): @[nolint has_nonempty_instance]
@[nolint unusedArguments]
def IsFreeGroupoid.Generators (G) [Groupoid G] :=
G
#align is_free_groupoid.generators IsFreeGroupoid.Generators
class IsFreeGroupoid (G) [Groupoid.{v} G] where
quiverGenerators : Quiver.{v + 1} (IsFreeGroupoid.Generators G)
of : ∀ {a b : IsFreeGroupoid.Generators G}, (a ⟶ b) → ((show G from a) ⟶ b)
unique_lift :
∀ {X : Type v} [Group X] (f : Labelling (IsFreeGroupoid.Generators G) X),
∃! F : G ⥤ CategoryTheory.SingleObj X, ∀ (a b) (g : a ⟶ b), F.map (of g) = f g
#align is_free_groupoid IsFreeGroupoid
attribute [nolint docBlame] IsFreeGroupoid.of IsFreeGroupoid.unique_lift
namespace IsFreeGroupoid
attribute [instance] quiverGenerators
@[ext]
theorem ext_functor {G} [Groupoid.{v} G] [IsFreeGroupoid G] {X : Type v} [Group X]
(f g : G ⥤ CategoryTheory.SingleObj X) (h : ∀ (a b) (e : a ⟶ b), f.map (of e) = g.map (of e)) :
f = g :=
let ⟨_, _, u⟩ := @unique_lift G _ _ X _ fun (a b : Generators G) (e : a ⟶ b) => g.map (of e)
_root_.trans (u _ h) (u _ fun _ _ _ => rfl).symm
#align is_free_groupoid.ext_functor IsFreeGroupoid.ext_functor
instance actionGroupoidIsFree {G A : Type u} [Group G] [IsFreeGroup G] [MulAction G A] :
IsFreeGroupoid (ActionCategory G A) where
quiverGenerators :=
⟨fun a b => { e : IsFreeGroup.Generators G // IsFreeGroup.of e • a.back = b.back }⟩
of := fun (e : { e // _}) => ⟨IsFreeGroup.of e, e.property⟩
unique_lift := by
intro X _ f
let f' : IsFreeGroup.Generators G → (A → X) ⋊[mulAutArrow] G := fun e =>
⟨fun b => @f ⟨(), _⟩ ⟨(), b⟩ ⟨e, smul_inv_smul _ b⟩, IsFreeGroup.of e⟩
rcases IsFreeGroup.unique_lift f' with ⟨F', hF', uF'⟩
refine ⟨uncurry F' ?_, ?_, ?_⟩
· suffices SemidirectProduct.rightHom.comp F' = MonoidHom.id _ by
-- Porting note: `MonoidHom.ext_iff` has been deprecated.
exact DFunLike.ext_iff.mp this
apply IsFreeGroup.ext_hom (fun x ↦ ?_)
rw [MonoidHom.comp_apply, hF']
rfl
· rintro ⟨⟨⟩, a : A⟩ ⟨⟨⟩, b⟩ ⟨e, h : IsFreeGroup.of e • a = b⟩
change (F' (IsFreeGroup.of _)).left _ = _
rw [hF']
cases inv_smul_eq_iff.mpr h.symm
rfl
· intro E hE
have : curry E = F' := by
apply uF'
intro e
ext
· convert hE _ _ _
rfl
· rfl
apply Functor.hext
· intro
apply Unit.ext
· refine ActionCategory.cases ?_
intros
simp only [← this, uncurry_map, curry_apply_left, coe_back, homOfPair.val]
rfl
#align is_free_groupoid.action_groupoid_is_free IsFreeGroupoid.actionGroupoidIsFree
private def symgen {G : Type u} [Groupoid.{v} G] [IsFreeGroupoid G] :
G → Symmetrify (Generators G) :=
id
-- #align is_free_groupoid.symgen IsFreeGroupoid.symgen
| Mathlib/GroupTheory/FreeGroup/NielsenSchreier.lean | 275 | 288 | theorem path_nonempty_of_hom {G} [Groupoid.{u, u} G] [IsFreeGroupoid G] {a b : G} :
Nonempty (a ⟶ b) → Nonempty (Path (symgen a) (symgen b)) := by |
rintro ⟨p⟩
rw [← @WeaklyConnectedComponent.eq (Generators G), eq_comm, ← FreeGroup.of_injective.eq_iff, ←
mul_inv_eq_one]
let X := FreeGroup (WeaklyConnectedComponent <| Generators G)
let f : G → X := fun g => FreeGroup.of (WeaklyConnectedComponent.mk g)
let F : G ⥤ CategoryTheory.SingleObj.{u} (X : Type u) := SingleObj.differenceFunctor f
change (F.map p) = ((@CategoryTheory.Functor.const G _ _ (SingleObj.category X)).obj ()).map p
congr; ext
rw [Functor.const_obj_map, id_as_one, differenceFunctor_map, @mul_inv_eq_one _ _ (f _)]
apply congr_arg FreeGroup.of
apply (WeaklyConnectedComponent.eq _ _).mpr
exact ⟨Hom.toPath (Sum.inr (by assumption))⟩
| false |
import Mathlib.RingTheory.Polynomial.Cyclotomic.Roots
import Mathlib.Tactic.ByContra
import Mathlib.Topology.Algebra.Polynomial
import Mathlib.NumberTheory.Padics.PadicVal
import Mathlib.Analysis.Complex.Arg
#align_import ring_theory.polynomial.cyclotomic.eval from "leanprover-community/mathlib"@"5bfbcca0a7ffdd21cf1682e59106d6c942434a32"
namespace Polynomial
open Finset Nat
@[simp]
| Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean | 29 | 32 | theorem eval_one_cyclotomic_prime {R : Type*} [CommRing R] {p : ℕ} [hn : Fact p.Prime] :
eval 1 (cyclotomic p R) = p := by |
simp only [cyclotomic_prime, eval_X, one_pow, Finset.sum_const, eval_pow, eval_finset_sum,
Finset.card_range, smul_one_eq_cast]
| false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.