Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | num_lines int64 1 150 |
|---|---|---|---|---|---|---|
import Mathlib.MeasureTheory.Integral.Bochner
import Mathlib.MeasureTheory.Measure.GiryMonad
#align_import probability.kernel.basic from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
open MeasureTheory
open scoped MeasureTheory ENNReal NNReal
namespace ProbabilityTheory
noncomputable def kernel (α β : Type*) [MeasurableSpace α] [MeasurableSpace β] :
AddSubmonoid (α → Measure β) where
carrier := Measurable
zero_mem' := measurable_zero
add_mem' hf hg := Measurable.add hf hg
#align probability_theory.kernel ProbabilityTheory.kernel
-- Porting note: using `FunLike` instead of `CoeFun` to use `DFunLike.coe`
instance {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] :
FunLike (kernel α β) α (Measure β) where
coe := Subtype.val
coe_injective' := Subtype.val_injective
instance kernel.instCovariantAddLE {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] :
CovariantClass (kernel α β) (kernel α β) (· + ·) (· ≤ ·) :=
⟨fun _ _ _ hμ a ↦ add_le_add_left (hμ a) _⟩
noncomputable
instance kernel.instOrderBot {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] :
OrderBot (kernel α β) where
bot := 0
bot_le κ a := by simp only [ZeroMemClass.coe_zero, Pi.zero_apply, Measure.zero_le]
variable {α β ι : Type*} {mα : MeasurableSpace α} {mβ : MeasurableSpace β}
namespace kernel
@[simp]
theorem coeFn_zero : ⇑(0 : kernel α β) = 0 :=
rfl
#align probability_theory.kernel.coe_fn_zero ProbabilityTheory.kernel.coeFn_zero
@[simp]
theorem coeFn_add (κ η : kernel α β) : ⇑(κ + η) = κ + η :=
rfl
#align probability_theory.kernel.coe_fn_add ProbabilityTheory.kernel.coeFn_add
def coeAddHom (α β : Type*) [MeasurableSpace α] [MeasurableSpace β] :
kernel α β →+ α → Measure β :=
AddSubmonoid.subtype _
#align probability_theory.kernel.coe_add_hom ProbabilityTheory.kernel.coeAddHom
@[simp]
theorem zero_apply (a : α) : (0 : kernel α β) a = 0 :=
rfl
#align probability_theory.kernel.zero_apply ProbabilityTheory.kernel.zero_apply
@[simp]
theorem coe_finset_sum (I : Finset ι) (κ : ι → kernel α β) : ⇑(∑ i ∈ I, κ i) = ∑ i ∈ I, ⇑(κ i) :=
map_sum (coeAddHom α β) _ _
#align probability_theory.kernel.coe_finset_sum ProbabilityTheory.kernel.coe_finset_sum
| Mathlib/Probability/Kernel/Basic.lean | 113 | 114 | theorem finset_sum_apply (I : Finset ι) (κ : ι → kernel α β) (a : α) :
(∑ i ∈ I, κ i) a = ∑ i ∈ I, κ i a := by | rw [coe_finset_sum, Finset.sum_apply]
| 1 |
import Mathlib.Data.Set.Lattice
#align_import data.set.intervals.disjoint from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
universe u v w
variable {ι : Sort u} {α : Type v} {β : Type w}
open Set
open OrderDual (toDual)
namespace Set
section Preorder
variable [Preorder α] {a b c : α}
@[simp]
theorem Iic_disjoint_Ioi (h : a ≤ b) : Disjoint (Iic a) (Ioi b) :=
disjoint_left.mpr fun _ ha hb => (h.trans_lt hb).not_le ha
#align set.Iic_disjoint_Ioi Set.Iic_disjoint_Ioi
@[simp]
theorem Iio_disjoint_Ici (h : a ≤ b) : Disjoint (Iio a) (Ici b) :=
disjoint_left.mpr fun _ ha hb => (h.trans_lt' ha).not_le hb
@[simp]
theorem Iic_disjoint_Ioc (h : a ≤ b) : Disjoint (Iic a) (Ioc b c) :=
(Iic_disjoint_Ioi h).mono le_rfl Ioc_subset_Ioi_self
#align set.Iic_disjoint_Ioc Set.Iic_disjoint_Ioc
@[simp]
theorem Ioc_disjoint_Ioc_same : Disjoint (Ioc a b) (Ioc b c) :=
(Iic_disjoint_Ioc le_rfl).mono Ioc_subset_Iic_self le_rfl
#align set.Ioc_disjoint_Ioc_same Set.Ioc_disjoint_Ioc_same
@[simp]
theorem Ico_disjoint_Ico_same : Disjoint (Ico a b) (Ico b c) :=
disjoint_left.mpr fun _ hab hbc => hab.2.not_le hbc.1
#align set.Ico_disjoint_Ico_same Set.Ico_disjoint_Ico_same
@[simp]
theorem Ici_disjoint_Iic : Disjoint (Ici a) (Iic b) ↔ ¬a ≤ b := by
rw [Set.disjoint_iff_inter_eq_empty, Ici_inter_Iic, Icc_eq_empty_iff]
#align set.Ici_disjoint_Iic Set.Ici_disjoint_Iic
@[simp]
theorem Iic_disjoint_Ici : Disjoint (Iic a) (Ici b) ↔ ¬b ≤ a :=
disjoint_comm.trans Ici_disjoint_Iic
#align set.Iic_disjoint_Ici Set.Iic_disjoint_Ici
@[simp]
theorem Ioc_disjoint_Ioi (h : b ≤ c) : Disjoint (Ioc a b) (Ioi c) :=
disjoint_left.mpr (fun _ hx hy ↦ (hx.2.trans h).not_lt hy)
theorem Ioc_disjoint_Ioi_same : Disjoint (Ioc a b) (Ioi b) :=
Ioc_disjoint_Ioi le_rfl
@[simp]
theorem iUnion_Iic : ⋃ a : α, Iic a = univ :=
iUnion_eq_univ_iff.2 fun x => ⟨x, right_mem_Iic⟩
#align set.Union_Iic Set.iUnion_Iic
@[simp]
theorem iUnion_Ici : ⋃ a : α, Ici a = univ :=
iUnion_eq_univ_iff.2 fun x => ⟨x, left_mem_Ici⟩
#align set.Union_Ici Set.iUnion_Ici
@[simp]
theorem iUnion_Icc_right (a : α) : ⋃ b, Icc a b = Ici a := by
simp only [← Ici_inter_Iic, ← inter_iUnion, iUnion_Iic, inter_univ]
#align set.Union_Icc_right Set.iUnion_Icc_right
@[simp]
theorem iUnion_Ioc_right (a : α) : ⋃ b, Ioc a b = Ioi a := by
simp only [← Ioi_inter_Iic, ← inter_iUnion, iUnion_Iic, inter_univ]
#align set.Union_Ioc_right Set.iUnion_Ioc_right
@[simp]
theorem iUnion_Icc_left (b : α) : ⋃ a, Icc a b = Iic b := by
simp only [← Ici_inter_Iic, ← iUnion_inter, iUnion_Ici, univ_inter]
#align set.Union_Icc_left Set.iUnion_Icc_left
@[simp]
| Mathlib/Order/Interval/Set/Disjoint.lean | 102 | 103 | theorem iUnion_Ico_left (b : α) : ⋃ a, Ico a b = Iio b := by |
simp only [← Ici_inter_Iio, ← iUnion_inter, iUnion_Ici, univ_inter]
| 1 |
import Mathlib.Order.Filter.Ultrafilter
import Mathlib.Order.Filter.Germ
#align_import order.filter.filter_product from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
universe u v
variable {α : Type u} {β : Type v} {φ : Ultrafilter α}
open scoped Classical
namespace Filter
local notation3 "∀* "(...)", "r:(scoped p => Filter.Eventually p (Ultrafilter.toFilter φ)) => r
namespace Germ
open Ultrafilter
local notation "β*" => Germ (φ : Filter α) β
instance instGroupWithZero [GroupWithZero β] : GroupWithZero β* where
__ := instDivInvMonoid
__ := instMonoidWithZero
mul_inv_cancel f := inductionOn f fun f hf ↦ coe_eq.2 <| (φ.em fun y ↦ f y = 0).elim
(fun H ↦ (hf <| coe_eq.2 H).elim) fun H ↦ H.mono fun x ↦ mul_inv_cancel
inv_zero := coe_eq.2 <| by simp only [Function.comp, inv_zero, EventuallyEq.rfl]
instance instDivisionSemiring [DivisionSemiring β] : DivisionSemiring β* where
toSemiring := instSemiring
__ := instGroupWithZero
nnqsmul := _
instance instDivisionRing [DivisionRing β] : DivisionRing β* where
__ := instRing
__ := instDivisionSemiring
qsmul := _
instance instSemifield [Semifield β] : Semifield β* where
__ := instCommSemiring
__ := instDivisionSemiring
instance instField [Field β] : Field β* where
__ := instCommRing
__ := instDivisionRing
| Mathlib/Order/Filter/FilterProduct.lean | 65 | 66 | theorem coe_lt [Preorder β] {f g : α → β} : (f : β*) < g ↔ ∀* x, f x < g x := by |
simp only [lt_iff_le_not_le, eventually_and, coe_le, eventually_not, EventuallyLE]
| 1 |
import Mathlib.Analysis.Convex.Hull
import Mathlib.LinearAlgebra.AffineSpace.Independent
#align_import analysis.convex.simplicial_complex.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open Finset Set
variable (𝕜 E : Type*) {ι : Type*} [OrderedRing 𝕜] [AddCommGroup E] [Module 𝕜 E]
namespace Geometry
-- TODO: update to new binder order? not sure what binder order is correct for `down_closed`.
@[ext]
structure SimplicialComplex where
faces : Set (Finset E)
not_empty_mem : ∅ ∉ faces
indep : ∀ {s}, s ∈ faces → AffineIndependent 𝕜 ((↑) : s → E)
down_closed : ∀ {s t}, s ∈ faces → t ⊆ s → t ≠ ∅ → t ∈ faces
inter_subset_convexHull : ∀ {s t}, s ∈ faces → t ∈ faces →
convexHull 𝕜 ↑s ∩ convexHull 𝕜 ↑t ⊆ convexHull 𝕜 (s ∩ t : Set E)
#align geometry.simplicial_complex Geometry.SimplicialComplex
namespace SimplicialComplex
variable {𝕜 E}
variable {K : SimplicialComplex 𝕜 E} {s t : Finset E} {x : E}
instance : Membership (Finset E) (SimplicialComplex 𝕜 E) :=
⟨fun s K => s ∈ K.faces⟩
def space (K : SimplicialComplex 𝕜 E) : Set E :=
⋃ s ∈ K.faces, convexHull 𝕜 (s : Set E)
#align geometry.simplicial_complex.space Geometry.SimplicialComplex.space
-- Porting note: Expanded `∃ s ∈ K.faces` to get the type to match more closely with Lean 3
| Mathlib/Analysis/Convex/SimplicialComplex/Basic.lean | 86 | 87 | theorem mem_space_iff : x ∈ K.space ↔ ∃ s ∈ K.faces, x ∈ convexHull 𝕜 (s : Set E) := by |
simp [space]
| 1 |
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Data.Nat.Totient
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.GroupTheory.Subgroup.Simple
import Mathlib.Tactic.Group
import Mathlib.GroupTheory.Exponent
#align_import group_theory.specific_groups.cyclic from "leanprover-community/mathlib"@"0f6670b8af2dff699de1c0b4b49039b31bc13c46"
universe u
variable {α : Type u} {a : α}
section Cyclic
attribute [local instance] setFintype
open Subgroup
class IsAddCyclic (α : Type u) [AddGroup α] : Prop where
exists_generator : ∃ g : α, ∀ x, x ∈ AddSubgroup.zmultiples g
#align is_add_cyclic IsAddCyclic
@[to_additive]
class IsCyclic (α : Type u) [Group α] : Prop where
exists_generator : ∃ g : α, ∀ x, x ∈ zpowers g
#align is_cyclic IsCyclic
@[to_additive]
instance (priority := 100) isCyclic_of_subsingleton [Group α] [Subsingleton α] : IsCyclic α :=
⟨⟨1, fun x => by
rw [Subsingleton.elim x 1]
exact mem_zpowers 1⟩⟩
#align is_cyclic_of_subsingleton isCyclic_of_subsingleton
#align is_add_cyclic_of_subsingleton isAddCyclic_of_subsingleton
@[simp]
theorem isCyclic_multiplicative_iff [AddGroup α] : IsCyclic (Multiplicative α) ↔ IsAddCyclic α :=
⟨fun H ↦ ⟨H.1⟩, fun H ↦ ⟨H.1⟩⟩
instance isCyclic_multiplicative [AddGroup α] [IsAddCyclic α] : IsCyclic (Multiplicative α) :=
isCyclic_multiplicative_iff.mpr inferInstance
@[simp]
theorem isAddCyclic_additive_iff [Group α] : IsAddCyclic (Additive α) ↔ IsCyclic α :=
⟨fun H ↦ ⟨H.1⟩, fun H ↦ ⟨H.1⟩⟩
instance isAddCyclic_additive [Group α] [IsCyclic α] : IsAddCyclic (Additive α) :=
isAddCyclic_additive_iff.mpr inferInstance
@[to_additive
"A cyclic group is always commutative. This is not an `instance` because often we have
a better proof of `AddCommGroup`."]
def IsCyclic.commGroup [hg : Group α] [IsCyclic α] : CommGroup α :=
{ hg with
mul_comm := fun x y =>
let ⟨_, hg⟩ := IsCyclic.exists_generator (α := α)
let ⟨_, hn⟩ := hg x
let ⟨_, hm⟩ := hg y
hm ▸ hn ▸ zpow_mul_comm _ _ _ }
#align is_cyclic.comm_group IsCyclic.commGroup
#align is_add_cyclic.add_comm_group IsAddCyclic.addCommGroup
variable [Group α]
@[to_additive "A non-cyclic additive group is non-trivial."]
theorem Nontrivial.of_not_isCyclic (nc : ¬IsCyclic α) : Nontrivial α := by
contrapose! nc
exact @isCyclic_of_subsingleton _ _ (not_nontrivial_iff_subsingleton.mp nc)
@[to_additive]
theorem MonoidHom.map_cyclic {G : Type*} [Group G] [h : IsCyclic G] (σ : G →* G) :
∃ m : ℤ, ∀ g : G, σ g = g ^ m := by
obtain ⟨h, hG⟩ := IsCyclic.exists_generator (α := G)
obtain ⟨m, hm⟩ := hG (σ h)
refine ⟨m, fun g => ?_⟩
obtain ⟨n, rfl⟩ := hG g
rw [MonoidHom.map_zpow, ← hm, ← zpow_mul, ← zpow_mul']
#align monoid_hom.map_cyclic MonoidHom.map_cyclic
#align monoid_add_hom.map_add_cyclic AddMonoidHom.map_addCyclic
@[deprecated (since := "2024-02-21")] alias
MonoidAddHom.map_add_cyclic := AddMonoidHom.map_addCyclic
@[to_additive]
theorem isCyclic_of_orderOf_eq_card [Fintype α] (x : α) (hx : orderOf x = Fintype.card α) :
IsCyclic α := by
classical
use x
simp_rw [← SetLike.mem_coe, ← Set.eq_univ_iff_forall]
rw [← Fintype.card_congr (Equiv.Set.univ α), ← Fintype.card_zpowers] at hx
exact Set.eq_of_subset_of_card_le (Set.subset_univ _) (ge_of_eq hx)
#align is_cyclic_of_order_of_eq_card isCyclic_of_orderOf_eq_card
#align is_add_cyclic_of_order_of_eq_card isAddCyclic_of_addOrderOf_eq_card
@[deprecated (since := "2024-02-21")]
alias isAddCyclic_of_orderOf_eq_card := isAddCyclic_of_addOrderOf_eq_card
@[to_additive]
theorem Subgroup.eq_bot_or_eq_top_of_prime_card {G : Type*} [Group G] {_ : Fintype G}
(H : Subgroup G) [hp : Fact (Fintype.card G).Prime] : H = ⊥ ∨ H = ⊤ := by
classical
have := card_subgroup_dvd_card H
rwa [Nat.card_eq_fintype_card (α := G), Nat.dvd_prime hp.1, ← Nat.card_eq_fintype_card,
← eq_bot_iff_card, card_eq_iff_eq_top] at this
@[to_additive "Any non-identity element of a finite group of prime order generates the group."]
theorem zpowers_eq_top_of_prime_card {G : Type*} [Group G] {_ : Fintype G} {p : ℕ}
[hp : Fact p.Prime] (h : Fintype.card G = p) {g : G} (hg : g ≠ 1) : zpowers g = ⊤ := by
subst h
have := (zpowers g).eq_bot_or_eq_top_of_prime_card
rwa [zpowers_eq_bot, or_iff_right hg] at this
@[to_additive]
| Mathlib/GroupTheory/SpecificGroups/Cyclic.lean | 152 | 154 | theorem mem_zpowers_of_prime_card {G : Type*} [Group G] {_ : Fintype G} {p : ℕ} [hp : Fact p.Prime]
(h : Fintype.card G = p) {g g' : G} (hg : g ≠ 1) : g' ∈ zpowers g := by |
simp_rw [zpowers_eq_top_of_prime_card h hg, Subgroup.mem_top]
| 1 |
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
| Mathlib/GroupTheory/Perm/Cycle/Concrete.lean | 245 | 246 | theorem get_toList (n : ℕ) (hn : n < length (toList p x)) :
(toList p x).get ⟨n, hn⟩ = (p ^ n) x := by | simp [toList]
| 1 |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.NormedSpace.LinearIsometry
import Mathlib.Algebra.Star.SelfAdjoint
import Mathlib.Algebra.Star.Subalgebra
import Mathlib.Algebra.Star.Unitary
import Mathlib.Topology.Algebra.Module.Star
#align_import analysis.normed_space.star.basic from "leanprover-community/mathlib"@"aa6669832974f87406a3d9d70fc5707a60546207"
open Topology
local postfix:max "⋆" => star
class NormedStarGroup (E : Type*) [SeminormedAddCommGroup E] [StarAddMonoid E] : Prop where
norm_star : ∀ x : E, ‖x⋆‖ = ‖x‖
#align normed_star_group NormedStarGroup
export NormedStarGroup (norm_star)
attribute [simp] norm_star
variable {𝕜 E α : Type*}
instance RingHomIsometric.starRingEnd [NormedCommRing E] [StarRing E] [NormedStarGroup E] :
RingHomIsometric (starRingEnd E) :=
⟨@norm_star _ _ _ _⟩
#align ring_hom_isometric.star_ring_end RingHomIsometric.starRingEnd
class CstarRing (E : Type*) [NonUnitalNormedRing E] [StarRing E] : Prop where
norm_star_mul_self : ∀ {x : E}, ‖x⋆ * x‖ = ‖x‖ * ‖x‖
#align cstar_ring CstarRing
instance : CstarRing ℝ where norm_star_mul_self {x} := by simp only [star, id, norm_mul]
namespace CstarRing
section NonUnital
variable [NonUnitalNormedRing E] [StarRing E] [CstarRing E]
-- see Note [lower instance priority]
instance (priority := 100) to_normedStarGroup : NormedStarGroup E :=
⟨by
intro x
by_cases htriv : x = 0
· simp only [htriv, star_zero]
· have hnt : 0 < ‖x‖ := norm_pos_iff.mpr htriv
have hnt_star : 0 < ‖x⋆‖ :=
norm_pos_iff.mpr ((AddEquiv.map_ne_zero_iff starAddEquiv (M := E)).mpr htriv)
have h₁ :=
calc
‖x‖ * ‖x‖ = ‖x⋆ * x‖ := norm_star_mul_self.symm
_ ≤ ‖x⋆‖ * ‖x‖ := norm_mul_le _ _
have h₂ :=
calc
‖x⋆‖ * ‖x⋆‖ = ‖x * x⋆‖ := by rw [← norm_star_mul_self, star_star]
_ ≤ ‖x‖ * ‖x⋆‖ := norm_mul_le _ _
exact le_antisymm (le_of_mul_le_mul_right h₂ hnt_star) (le_of_mul_le_mul_right h₁ hnt)⟩
#align cstar_ring.to_normed_star_group CstarRing.to_normedStarGroup
theorem norm_self_mul_star {x : E} : ‖x * x⋆‖ = ‖x‖ * ‖x‖ := by
nth_rw 1 [← star_star x]
simp only [norm_star_mul_self, norm_star]
#align cstar_ring.norm_self_mul_star CstarRing.norm_self_mul_star
theorem norm_star_mul_self' {x : E} : ‖x⋆ * x‖ = ‖x⋆‖ * ‖x‖ := by rw [norm_star_mul_self, norm_star]
#align cstar_ring.norm_star_mul_self' CstarRing.norm_star_mul_self'
theorem nnnorm_self_mul_star {x : E} : ‖x * x⋆‖₊ = ‖x‖₊ * ‖x‖₊ :=
Subtype.ext norm_self_mul_star
#align cstar_ring.nnnorm_self_mul_star CstarRing.nnnorm_self_mul_star
theorem nnnorm_star_mul_self {x : E} : ‖x⋆ * x‖₊ = ‖x‖₊ * ‖x‖₊ :=
Subtype.ext norm_star_mul_self
#align cstar_ring.nnnorm_star_mul_self CstarRing.nnnorm_star_mul_self
@[simp]
theorem star_mul_self_eq_zero_iff (x : E) : x⋆ * x = 0 ↔ x = 0 := by
rw [← norm_eq_zero, norm_star_mul_self]
exact mul_self_eq_zero.trans norm_eq_zero
#align cstar_ring.star_mul_self_eq_zero_iff CstarRing.star_mul_self_eq_zero_iff
| Mathlib/Analysis/NormedSpace/Star/Basic.lean | 140 | 141 | theorem star_mul_self_ne_zero_iff (x : E) : x⋆ * x ≠ 0 ↔ x ≠ 0 := by |
simp only [Ne, star_mul_self_eq_zero_iff]
| 1 |
import Mathlib.Data.List.Range
import Mathlib.Algebra.Order.Ring.Nat
variable {α : Type*}
namespace List
@[simp]
theorem length_iterate (f : α → α) (a : α) (n : ℕ) : length (iterate f a n) = n := by
induction n generalizing a <;> simp [*]
@[simp]
theorem iterate_eq_nil {f : α → α} {a : α} {n : ℕ} : iterate f a n = [] ↔ n = 0 := by
rw [← length_eq_zero, length_iterate]
theorem get?_iterate (f : α → α) (a : α) :
∀ (n i : ℕ), i < n → get? (iterate f a n) i = f^[i] a
| n + 1, 0 , _ => rfl
| n + 1, i + 1, h => by simp [get?_iterate f (f a) n i (by simpa using h)]
@[simp]
theorem get_iterate (f : α → α) (a : α) (n : ℕ) (i : Fin (iterate f a n).length) :
get (iterate f a n) i = f^[↑i] a :=
(get?_eq_some.1 <| get?_iterate f a n i.1 (by simpa using i.2)).2
@[simp]
theorem mem_iterate {f : α → α} {a : α} {n : ℕ} {b : α} :
b ∈ iterate f a n ↔ ∃ m < n, b = f^[m] a := by
simp [List.mem_iff_get, Fin.exists_iff, eq_comm (b := b)]
@[simp]
| Mathlib/Data/List/Iterate.lean | 44 | 46 | theorem range_map_iterate (n : ℕ) (f : α → α) (a : α) :
(List.range n).map (f^[·] a) = List.iterate f a n := by |
apply List.ext_get <;> simp
| 1 |
import Mathlib.Data.Fintype.Card
import Mathlib.Computability.Language
import Mathlib.Tactic.NormNum
#align_import computability.DFA from "leanprover-community/mathlib"@"32253a1a1071173b33dc7d6a218cf722c6feb514"
open Computability
universe u v
-- Porting note: Required as `DFA` is used in mathlib3
set_option linter.uppercaseLean3 false
structure DFA (α : Type u) (σ : Type v) where
step : σ → α → σ
start : σ
accept : Set σ
#align DFA DFA
namespace DFA
variable {α : Type u} {σ : Type v} (M : DFA α σ)
instance [Inhabited σ] : Inhabited (DFA α σ) :=
⟨DFA.mk (fun _ _ => default) default ∅⟩
def evalFrom (start : σ) : List α → σ :=
List.foldl M.step start
#align DFA.eval_from DFA.evalFrom
@[simp]
theorem evalFrom_nil (s : σ) : M.evalFrom s [] = s :=
rfl
#align DFA.eval_from_nil DFA.evalFrom_nil
@[simp]
theorem evalFrom_singleton (s : σ) (a : α) : M.evalFrom s [a] = M.step s a :=
rfl
#align DFA.eval_from_singleton DFA.evalFrom_singleton
@[simp]
| Mathlib/Computability/DFA.lean | 64 | 66 | theorem evalFrom_append_singleton (s : σ) (x : List α) (a : α) :
M.evalFrom s (x ++ [a]) = M.step (M.evalFrom s x) a := by |
simp only [evalFrom, List.foldl_append, List.foldl_cons, List.foldl_nil]
| 1 |
import Mathlib.Algebra.Order.Floor
import Mathlib.Topology.Algebra.Order.Group
import Mathlib.Topology.Order.Basic
#align_import topology.algebra.order.floor from "leanprover-community/mathlib"@"84dc0bd6619acaea625086d6f53cb35cdd554219"
open Filter Function Int Set Topology
variable {α β γ : Type*} [LinearOrderedRing α] [FloorRing α]
theorem tendsto_floor_atTop : Tendsto (floor : α → ℤ) atTop atTop :=
floor_mono.tendsto_atTop_atTop fun b =>
⟨(b + 1 : ℤ), by rw [floor_intCast]; exact (lt_add_one _).le⟩
#align tendsto_floor_at_top tendsto_floor_atTop
theorem tendsto_floor_atBot : Tendsto (floor : α → ℤ) atBot atBot :=
floor_mono.tendsto_atBot_atBot fun b => ⟨b, (floor_intCast _).le⟩
#align tendsto_floor_at_bot tendsto_floor_atBot
theorem tendsto_ceil_atTop : Tendsto (ceil : α → ℤ) atTop atTop :=
ceil_mono.tendsto_atTop_atTop fun b => ⟨b, (ceil_intCast _).ge⟩
#align tendsto_ceil_at_top tendsto_ceil_atTop
theorem tendsto_ceil_atBot : Tendsto (ceil : α → ℤ) atBot atBot :=
ceil_mono.tendsto_atBot_atBot fun b =>
⟨(b - 1 : ℤ), by rw [ceil_intCast]; exact (sub_one_lt _).le⟩
#align tendsto_ceil_at_bot tendsto_ceil_atBot
variable [TopologicalSpace α]
theorem continuousOn_floor (n : ℤ) :
ContinuousOn (fun x => floor x : α → α) (Ico n (n + 1) : Set α) :=
(continuousOn_congr <| floor_eq_on_Ico' n).mpr continuousOn_const
#align continuous_on_floor continuousOn_floor
theorem continuousOn_ceil (n : ℤ) :
ContinuousOn (fun x => ceil x : α → α) (Ioc (n - 1) n : Set α) :=
(continuousOn_congr <| ceil_eq_on_Ioc' n).mpr continuousOn_const
#align continuous_on_ceil continuousOn_ceil
section OrderClosedTopology
variable [OrderClosedTopology α]
-- Porting note (#10756): new theorem
theorem tendsto_floor_right_pure_floor (x : α) : Tendsto (floor : α → ℤ) (𝓝[≥] x) (pure ⌊x⌋) :=
tendsto_pure.2 <| mem_of_superset (Ico_mem_nhdsWithin_Ici' <| lt_floor_add_one x) fun _y hy =>
floor_eq_on_Ico _ _ ⟨(floor_le x).trans hy.1, hy.2⟩
-- Porting note (#10756): new theorem
theorem tendsto_floor_right_pure (n : ℤ) : Tendsto (floor : α → ℤ) (𝓝[≥] n) (pure n) := by
simpa only [floor_intCast] using tendsto_floor_right_pure_floor (n : α)
-- Porting note (#10756): new theorem
theorem tendsto_ceil_left_pure_ceil (x : α) : Tendsto (ceil : α → ℤ) (𝓝[≤] x) (pure ⌈x⌉) :=
tendsto_pure.2 <| mem_of_superset
(Ioc_mem_nhdsWithin_Iic' <| sub_lt_iff_lt_add.2 <| ceil_lt_add_one _) fun _y hy =>
ceil_eq_on_Ioc _ _ ⟨hy.1, hy.2.trans (le_ceil _)⟩
-- Porting note (#10756): new theorem
| Mathlib/Topology/Algebra/Order/Floor.lean | 84 | 85 | theorem tendsto_ceil_left_pure (n : ℤ) : Tendsto (ceil : α → ℤ) (𝓝[≤] n) (pure n) := by |
simpa only [ceil_intCast] using tendsto_ceil_left_pure_ceil (n : α)
| 1 |
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.ordinal from "leanprover-community/mathlib"@"b90e72c7eebbe8de7c8293a80208ea2ba135c834"
universe u
open SetTheory PGame
open scoped NaturalOps PGame
namespace Ordinal
noncomputable def toPGame : Ordinal.{u} → PGame.{u}
| o =>
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
⟨o.out.α, PEmpty, fun x =>
have := Ordinal.typein_lt_self x
(typein (· < ·) x).toPGame,
PEmpty.elim⟩
termination_by x => x
#align ordinal.to_pgame Ordinal.toPGame
@[nolint unusedHavesSuffices]
theorem toPGame_def (o : Ordinal) :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
o.toPGame = ⟨o.out.α, PEmpty, fun x => (typein (· < ·) x).toPGame, PEmpty.elim⟩ := by
rw [toPGame]
#align ordinal.to_pgame_def Ordinal.toPGame_def
@[simp, nolint unusedHavesSuffices]
theorem toPGame_leftMoves (o : Ordinal) : o.toPGame.LeftMoves = o.out.α := by
rw [toPGame, LeftMoves]
#align ordinal.to_pgame_left_moves Ordinal.toPGame_leftMoves
@[simp, nolint unusedHavesSuffices]
theorem toPGame_rightMoves (o : Ordinal) : o.toPGame.RightMoves = PEmpty := by
rw [toPGame, RightMoves]
#align ordinal.to_pgame_right_moves Ordinal.toPGame_rightMoves
instance isEmpty_zero_toPGame_leftMoves : IsEmpty (toPGame 0).LeftMoves := by
rw [toPGame_leftMoves]; infer_instance
#align ordinal.is_empty_zero_to_pgame_left_moves Ordinal.isEmpty_zero_toPGame_leftMoves
instance isEmpty_toPGame_rightMoves (o : Ordinal) : IsEmpty o.toPGame.RightMoves := by
rw [toPGame_rightMoves]; infer_instance
#align ordinal.is_empty_to_pgame_right_moves Ordinal.isEmpty_toPGame_rightMoves
noncomputable def toLeftMovesToPGame {o : Ordinal} : Set.Iio o ≃ o.toPGame.LeftMoves :=
(enumIsoOut o).toEquiv.trans (Equiv.cast (toPGame_leftMoves o).symm)
#align ordinal.to_left_moves_to_pgame Ordinal.toLeftMovesToPGame
@[simp]
theorem toLeftMovesToPGame_symm_lt {o : Ordinal} (i : o.toPGame.LeftMoves) :
↑(toLeftMovesToPGame.symm i) < o :=
(toLeftMovesToPGame.symm i).prop
#align ordinal.to_left_moves_to_pgame_symm_lt Ordinal.toLeftMovesToPGame_symm_lt
@[nolint unusedHavesSuffices]
theorem toPGame_moveLeft_hEq {o : Ordinal} :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
HEq o.toPGame.moveLeft fun x : o.out.α => (typein (· < ·) x).toPGame := by
rw [toPGame]
rfl
#align ordinal.to_pgame_move_left_heq Ordinal.toPGame_moveLeft_hEq
@[simp]
theorem toPGame_moveLeft' {o : Ordinal} (i) :
o.toPGame.moveLeft i = (toLeftMovesToPGame.symm i).val.toPGame :=
(congr_heq toPGame_moveLeft_hEq.symm (cast_heq _ i)).symm
#align ordinal.to_pgame_move_left' Ordinal.toPGame_moveLeft'
theorem toPGame_moveLeft {o : Ordinal} (i) :
o.toPGame.moveLeft (toLeftMovesToPGame i) = i.val.toPGame := by simp
#align ordinal.to_pgame_move_left Ordinal.toPGame_moveLeft
noncomputable def zeroToPGameRelabelling : toPGame 0 ≡r 0 :=
Relabelling.isEmpty _
#align ordinal.zero_to_pgame_relabelling Ordinal.zeroToPGameRelabelling
noncomputable instance uniqueOneToPGameLeftMoves : Unique (toPGame 1).LeftMoves :=
(Equiv.cast <| toPGame_leftMoves 1).unique
#align ordinal.unique_one_to_pgame_left_moves Ordinal.uniqueOneToPGameLeftMoves
@[simp]
theorem one_toPGame_leftMoves_default_eq :
(default : (toPGame 1).LeftMoves) = @toLeftMovesToPGame 1 ⟨0, Set.mem_Iio.mpr zero_lt_one⟩ :=
rfl
#align ordinal.one_to_pgame_left_moves_default_eq Ordinal.one_toPGame_leftMoves_default_eq
@[simp]
theorem to_leftMoves_one_toPGame_symm (i) :
(@toLeftMovesToPGame 1).symm i = ⟨0, Set.mem_Iio.mpr zero_lt_one⟩ := by
simp [eq_iff_true_of_subsingleton]
#align ordinal.to_left_moves_one_to_pgame_symm Ordinal.to_leftMoves_one_toPGame_symm
theorem one_toPGame_moveLeft (x) : (toPGame 1).moveLeft x = toPGame 0 := by simp
#align ordinal.one_to_pgame_move_left Ordinal.one_toPGame_moveLeft
noncomputable def oneToPGameRelabelling : toPGame 1 ≡r 1 :=
⟨Equiv.equivOfUnique _ _, Equiv.equivOfIsEmpty _ _, fun i => by
simpa using zeroToPGameRelabelling, isEmptyElim⟩
#align ordinal.one_to_pgame_relabelling Ordinal.oneToPGameRelabelling
| Mathlib/SetTheory/Game/Ordinal.lean | 130 | 131 | theorem toPGame_lf {a b : Ordinal} (h : a < b) : a.toPGame ⧏ b.toPGame := by |
convert moveLeft_lf (toLeftMovesToPGame ⟨a, h⟩); rw [toPGame_moveLeft]
| 1 |
import Mathlib.Data.Set.Function
import Mathlib.Order.Interval.Set.OrdConnected
#align_import data.set.intervals.proj_Icc from "leanprover-community/mathlib"@"4e24c4bfcff371c71f7ba22050308aa17815626c"
variable {α β : Type*} [LinearOrder α]
open Function
namespace Set
def projIci (a x : α) : Ici a := ⟨max a x, le_max_left _ _⟩
#align set.proj_Ici Set.projIci
def projIic (b x : α) : Iic b := ⟨min b x, min_le_left _ _⟩
#align set.proj_Iic Set.projIic
def projIcc (a b : α) (h : a ≤ b) (x : α) : Icc a b :=
⟨max a (min b x), le_max_left _ _, max_le h (min_le_left _ _)⟩
#align set.proj_Icc Set.projIcc
variable {a b : α} (h : a ≤ b) {x : α}
@[norm_cast]
theorem coe_projIci (a x : α) : (projIci a x : α) = max a x := rfl
#align set.coe_proj_Ici Set.coe_projIci
@[norm_cast]
theorem coe_projIic (b x : α) : (projIic b x : α) = min b x := rfl
#align set.coe_proj_Iic Set.coe_projIic
@[norm_cast]
theorem coe_projIcc (a b : α) (h : a ≤ b) (x : α) : (projIcc a b h x : α) = max a (min b x) := rfl
#align set.coe_proj_Icc Set.coe_projIcc
theorem projIci_of_le (hx : x ≤ a) : projIci a x = ⟨a, le_rfl⟩ := Subtype.ext <| max_eq_left hx
#align set.proj_Ici_of_le Set.projIci_of_le
theorem projIic_of_le (hx : b ≤ x) : projIic b x = ⟨b, le_rfl⟩ := Subtype.ext <| min_eq_left hx
#align set.proj_Iic_of_le Set.projIic_of_le
theorem projIcc_of_le_left (hx : x ≤ a) : projIcc a b h x = ⟨a, left_mem_Icc.2 h⟩ := by
simp [projIcc, hx, hx.trans h]
#align set.proj_Icc_of_le_left Set.projIcc_of_le_left
theorem projIcc_of_right_le (hx : b ≤ x) : projIcc a b h x = ⟨b, right_mem_Icc.2 h⟩ := by
simp [projIcc, hx, h]
#align set.proj_Icc_of_right_le Set.projIcc_of_right_le
@[simp]
theorem projIci_self (a : α) : projIci a a = ⟨a, le_rfl⟩ := projIci_of_le le_rfl
#align set.proj_Ici_self Set.projIci_self
@[simp]
theorem projIic_self (b : α) : projIic b b = ⟨b, le_rfl⟩ := projIic_of_le le_rfl
#align set.proj_Iic_self Set.projIic_self
@[simp]
theorem projIcc_left : projIcc a b h a = ⟨a, left_mem_Icc.2 h⟩ :=
projIcc_of_le_left h le_rfl
#align set.proj_Icc_left Set.projIcc_left
@[simp]
theorem projIcc_right : projIcc a b h b = ⟨b, right_mem_Icc.2 h⟩ :=
projIcc_of_right_le h le_rfl
#align set.proj_Icc_right Set.projIcc_right
theorem projIci_eq_self : projIci a x = ⟨a, le_rfl⟩ ↔ x ≤ a := by simp [projIci, Subtype.ext_iff]
#align set.proj_Ici_eq_self Set.projIci_eq_self
theorem projIic_eq_self : projIic b x = ⟨b, le_rfl⟩ ↔ b ≤ x := by simp [projIic, Subtype.ext_iff]
#align set.proj_Iic_eq_self Set.projIic_eq_self
theorem projIcc_eq_left (h : a < b) : projIcc a b h.le x = ⟨a, left_mem_Icc.mpr h.le⟩ ↔ x ≤ a := by
simp [projIcc, Subtype.ext_iff, h.not_le]
#align set.proj_Icc_eq_left Set.projIcc_eq_left
theorem projIcc_eq_right (h : a < b) : projIcc a b h.le x = ⟨b, right_mem_Icc.2 h.le⟩ ↔ b ≤ x := by
simp [projIcc, Subtype.ext_iff, max_min_distrib_left, h.le, h.not_le]
#align set.proj_Icc_eq_right Set.projIcc_eq_right
theorem projIci_of_mem (hx : x ∈ Ici a) : projIci a x = ⟨x, hx⟩ := by simpa [projIci]
#align set.proj_Ici_of_mem Set.projIci_of_mem
theorem projIic_of_mem (hx : x ∈ Iic b) : projIic b x = ⟨x, hx⟩ := by simpa [projIic]
#align set.proj_Iic_of_mem Set.projIic_of_mem
theorem projIcc_of_mem (hx : x ∈ Icc a b) : projIcc a b h x = ⟨x, hx⟩ := by
simp [projIcc, hx.1, hx.2]
#align set.proj_Icc_of_mem Set.projIcc_of_mem
@[simp]
| Mathlib/Order/Interval/Set/ProjIcc.lean | 124 | 124 | theorem projIci_coe (x : Ici a) : projIci a x = x := by | cases x; apply projIci_of_mem
| 1 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Induction
#align_import data.polynomial.eval from "leanprover-community/mathlib"@"728baa2f54e6062c5879a3e397ac6bac323e506f"
set_option linter.uppercaseLean3 false
noncomputable section
open Finset AddMonoidAlgebra
open Polynomial
namespace Polynomial
universe u v w y
variable {R : Type u} {S : Type v} {T : Type w} {ι : Type y} {a b : R} {m n : ℕ}
section Semiring
variable [Semiring R] {p q r : R[X]}
section
variable [Semiring S]
variable (f : R →+* S) (x : S)
irreducible_def eval₂ (p : R[X]) : S :=
p.sum fun e a => f a * x ^ e
#align polynomial.eval₂ Polynomial.eval₂
theorem eval₂_eq_sum {f : R →+* S} {x : S} : p.eval₂ f x = p.sum fun e a => f a * x ^ e := by
rw [eval₂_def]
#align polynomial.eval₂_eq_sum Polynomial.eval₂_eq_sum
theorem eval₂_congr {R S : Type*} [Semiring R] [Semiring S] {f g : R →+* S} {s t : S}
{φ ψ : R[X]} : f = g → s = t → φ = ψ → eval₂ f s φ = eval₂ g t ψ := by
rintro rfl rfl rfl; rfl
#align polynomial.eval₂_congr Polynomial.eval₂_congr
@[simp]
theorem eval₂_at_zero : p.eval₂ f 0 = f (coeff p 0) := by
simp (config := { contextual := true }) only [eval₂_eq_sum, zero_pow_eq, mul_ite, mul_zero,
mul_one, sum, Classical.not_not, mem_support_iff, sum_ite_eq', ite_eq_left_iff,
RingHom.map_zero, imp_true_iff, eq_self_iff_true]
#align polynomial.eval₂_at_zero Polynomial.eval₂_at_zero
@[simp]
theorem eval₂_zero : (0 : R[X]).eval₂ f x = 0 := by simp [eval₂_eq_sum]
#align polynomial.eval₂_zero Polynomial.eval₂_zero
@[simp]
theorem eval₂_C : (C a).eval₂ f x = f a := by simp [eval₂_eq_sum]
#align polynomial.eval₂_C Polynomial.eval₂_C
@[simp]
| Mathlib/Algebra/Polynomial/Eval.lean | 73 | 73 | theorem eval₂_X : X.eval₂ f x = x := by | simp [eval₂_eq_sum]
| 1 |
import Mathlib.FieldTheory.SeparableClosure
import Mathlib.Algebra.CharP.IntermediateField
open FiniteDimensional Polynomial IntermediateField Field
noncomputable section
universe u v w
variable (F : Type u) (E : Type v) [Field F] [Field E] [Algebra F E]
variable (K : Type w) [Field K] [Algebra F K]
section perfectClosure
def perfectClosure : IntermediateField F E where
carrier := {x : E | ∃ n : ℕ, x ^ (ringExpChar F) ^ n ∈ (algebraMap F E).range}
add_mem' := by
rintro x y ⟨n, hx⟩ ⟨m, hy⟩
use n + m
have := expChar_of_injective_algebraMap (algebraMap F E).injective (ringExpChar F)
rw [add_pow_expChar_pow, pow_add, pow_mul, mul_comm (_ ^ n), pow_mul]
exact add_mem (pow_mem hx _) (pow_mem hy _)
mul_mem' := by
rintro x y ⟨n, hx⟩ ⟨m, hy⟩
use n + m
rw [mul_pow, pow_add, pow_mul, mul_comm (_ ^ n), pow_mul]
exact mul_mem (pow_mem hx _) (pow_mem hy _)
inv_mem' := by
rintro x ⟨n, hx⟩
use n; rw [inv_pow]
apply inv_mem (id hx : _ ∈ (⊥ : IntermediateField F E))
algebraMap_mem' := fun x ↦ ⟨0, by rw [pow_zero, pow_one]; exact ⟨x, rfl⟩⟩
variable {F E}
theorem mem_perfectClosure_iff {x : E} :
x ∈ perfectClosure F E ↔ ∃ n : ℕ, x ^ (ringExpChar F) ^ n ∈ (algebraMap F E).range := Iff.rfl
theorem mem_perfectClosure_iff_pow_mem (q : ℕ) [ExpChar F q] {x : E} :
x ∈ perfectClosure F E ↔ ∃ n : ℕ, x ^ q ^ n ∈ (algebraMap F E).range := by
rw [mem_perfectClosure_iff, ringExpChar.eq F q]
| Mathlib/FieldTheory/PurelyInseparable.lean | 287 | 289 | theorem mem_perfectClosure_iff_natSepDegree_eq_one {x : E} :
x ∈ perfectClosure F E ↔ (minpoly F x).natSepDegree = 1 := by |
rw [mem_perfectClosure_iff, minpoly.natSepDegree_eq_one_iff_pow_mem (ringExpChar F)]
| 1 |
import Mathlib.Algebra.Polynomial.Degree.TrailingDegree
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.Eval
#align_import data.polynomial.reverse from "leanprover-community/mathlib"@"44de64f183393284a16016dfb2a48ac97382f2bd"
namespace Polynomial
open Polynomial Finsupp Finset
open Polynomial
section Semiring
variable {R : Type*} [Semiring R] {f : R[X]}
def revAtFun (N i : ℕ) : ℕ :=
ite (i ≤ N) (N - i) i
#align polynomial.rev_at_fun Polynomial.revAtFun
theorem revAtFun_invol {N i : ℕ} : revAtFun N (revAtFun N i) = i := by
unfold revAtFun
split_ifs with h j
· exact tsub_tsub_cancel_of_le h
· exfalso
apply j
exact Nat.sub_le N i
· rfl
#align polynomial.rev_at_fun_invol Polynomial.revAtFun_invol
theorem revAtFun_inj {N : ℕ} : Function.Injective (revAtFun N) := by
intro a b hab
rw [← @revAtFun_invol N a, hab, revAtFun_invol]
#align polynomial.rev_at_fun_inj Polynomial.revAtFun_inj
def revAt (N : ℕ) : Function.Embedding ℕ ℕ where
toFun i := ite (i ≤ N) (N - i) i
inj' := revAtFun_inj
#align polynomial.rev_at Polynomial.revAt
@[simp]
theorem revAtFun_eq (N i : ℕ) : revAtFun N i = revAt N i :=
rfl
#align polynomial.rev_at_fun_eq Polynomial.revAtFun_eq
@[simp]
theorem revAt_invol {N i : ℕ} : (revAt N) (revAt N i) = i :=
revAtFun_invol
#align polynomial.rev_at_invol Polynomial.revAt_invol
@[simp]
theorem revAt_le {N i : ℕ} (H : i ≤ N) : revAt N i = N - i :=
if_pos H
#align polynomial.rev_at_le Polynomial.revAt_le
lemma revAt_eq_self_of_lt {N i : ℕ} (h : N < i) : revAt N i = i := by simp [revAt, Nat.not_le.mpr h]
theorem revAt_add {N O n o : ℕ} (hn : n ≤ N) (ho : o ≤ O) :
revAt (N + O) (n + o) = revAt N n + revAt O o := by
rcases Nat.le.dest hn with ⟨n', rfl⟩
rcases Nat.le.dest ho with ⟨o', rfl⟩
repeat' rw [revAt_le (le_add_right rfl.le)]
rw [add_assoc, add_left_comm n' o, ← add_assoc, revAt_le (le_add_right rfl.le)]
repeat' rw [add_tsub_cancel_left]
#align polynomial.rev_at_add Polynomial.revAt_add
-- @[simp] -- Porting note (#10618): simp can prove this
theorem revAt_zero (N : ℕ) : revAt N 0 = N := by simp
#align polynomial.rev_at_zero Polynomial.revAt_zero
noncomputable def reflect (N : ℕ) : R[X] → R[X]
| ⟨f⟩ => ⟨Finsupp.embDomain (revAt N) f⟩
#align polynomial.reflect Polynomial.reflect
theorem reflect_support (N : ℕ) (f : R[X]) :
(reflect N f).support = Finset.image (revAt N) f.support := by
rcases f with ⟨⟩
ext1
simp only [reflect, support_ofFinsupp, support_embDomain, Finset.mem_map, Finset.mem_image]
#align polynomial.reflect_support Polynomial.reflect_support
@[simp]
theorem coeff_reflect (N : ℕ) (f : R[X]) (i : ℕ) : coeff (reflect N f) i = f.coeff (revAt N i) := by
rcases f with ⟨f⟩
simp only [reflect, coeff]
calc
Finsupp.embDomain (revAt N) f i = Finsupp.embDomain (revAt N) f (revAt N (revAt N i)) := by
rw [revAt_invol]
_ = f (revAt N i) := Finsupp.embDomain_apply _ _ _
#align polynomial.coeff_reflect Polynomial.coeff_reflect
@[simp]
theorem reflect_zero {N : ℕ} : reflect N (0 : R[X]) = 0 :=
rfl
#align polynomial.reflect_zero Polynomial.reflect_zero
@[simp]
theorem reflect_eq_zero_iff {N : ℕ} {f : R[X]} : reflect N (f : R[X]) = 0 ↔ f = 0 := by
rw [ofFinsupp_eq_zero, reflect, embDomain_eq_zero, ofFinsupp_eq_zero]
#align polynomial.reflect_eq_zero_iff Polynomial.reflect_eq_zero_iff
@[simp]
theorem reflect_add (f g : R[X]) (N : ℕ) : reflect N (f + g) = reflect N f + reflect N g := by
ext
simp only [coeff_add, coeff_reflect]
#align polynomial.reflect_add Polynomial.reflect_add
@[simp]
theorem reflect_C_mul (f : R[X]) (r : R) (N : ℕ) : reflect N (C r * f) = C r * reflect N f := by
ext
simp only [coeff_reflect, coeff_C_mul]
set_option linter.uppercaseLean3 false in
#align polynomial.reflect_C_mul Polynomial.reflect_C_mul
-- @[simp] -- Porting note (#10618): simp can prove this (once `reflect_monomial` is in simp scope)
theorem reflect_C_mul_X_pow (N n : ℕ) {c : R} : reflect N (C c * X ^ n) = C c * X ^ revAt N n := by
ext
rw [reflect_C_mul, coeff_C_mul, coeff_C_mul, coeff_X_pow, coeff_reflect]
split_ifs with h
· rw [h, revAt_invol, coeff_X_pow_self]
· rw [not_mem_support_iff.mp]
intro a
rw [← one_mul (X ^ n), ← C_1] at a
apply h
rw [← mem_support_C_mul_X_pow a, revAt_invol]
set_option linter.uppercaseLean3 false in
#align polynomial.reflect_C_mul_X_pow Polynomial.reflect_C_mul_X_pow
@[simp]
theorem reflect_C (r : R) (N : ℕ) : reflect N (C r) = C r * X ^ N := by
conv_lhs => rw [← mul_one (C r), ← pow_zero X, reflect_C_mul_X_pow, revAt_zero]
set_option linter.uppercaseLean3 false in
#align polynomial.reflect_C Polynomial.reflect_C
@[simp]
| Mathlib/Algebra/Polynomial/Reverse.lean | 166 | 167 | theorem reflect_monomial (N n : ℕ) : reflect N ((X : R[X]) ^ n) = X ^ revAt N n := by |
rw [← one_mul (X ^ n), ← one_mul (X ^ revAt N n), ← C_1, reflect_C_mul_X_pow]
| 1 |
import Mathlib.Data.Matrix.Basis
import Mathlib.Data.Matrix.DMatrix
import Mathlib.LinearAlgebra.Matrix.Determinant.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.matrix.transvection from "leanprover-community/mathlib"@"0e2aab2b0d521f060f62a14d2cf2e2c54e8491d6"
universe u₁ u₂
namespace Matrix
open Matrix
variable (n p : Type*) (R : Type u₂) {𝕜 : Type*} [Field 𝕜]
variable [DecidableEq n] [DecidableEq p]
variable [CommRing R]
section Transvection
variable {R n} (i j : n)
def transvection (c : R) : Matrix n n R :=
1 + Matrix.stdBasisMatrix i j c
#align matrix.transvection Matrix.transvection
@[simp]
| Mathlib/LinearAlgebra/Matrix/Transvection.lean | 87 | 87 | theorem transvection_zero : transvection i j (0 : R) = 1 := by | simp [transvection]
| 1 |
import Mathlib.Data.Set.Pointwise.SMul
#align_import algebra.add_torsor from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
class AddTorsor (G : outParam Type*) (P : Type*) [AddGroup G] extends AddAction G P,
VSub G P where
[nonempty : Nonempty P]
vsub_vadd' : ∀ p₁ p₂ : P, (p₁ -ᵥ p₂ : G) +ᵥ p₂ = p₁
vadd_vsub' : ∀ (g : G) (p : P), g +ᵥ p -ᵥ p = g
#align add_torsor AddTorsor
-- Porting note(#12096): removed `nolint instance_priority`; lint not ported yet
attribute [instance 100] AddTorsor.nonempty
-- Porting note(#12094): removed nolint; dangerous_instance linter not ported yet
--attribute [nolint dangerous_instance] AddTorsor.toVSub
-- Porting note(#12096): linter not ported yet
--@[nolint instance_priority]
instance addGroupIsAddTorsor (G : Type*) [AddGroup G] : AddTorsor G G where
vsub := Sub.sub
vsub_vadd' := sub_add_cancel
vadd_vsub' := add_sub_cancel_right
#align add_group_is_add_torsor addGroupIsAddTorsor
@[simp]
theorem vsub_eq_sub {G : Type*} [AddGroup G] (g₁ g₂ : G) : g₁ -ᵥ g₂ = g₁ - g₂ :=
rfl
#align vsub_eq_sub vsub_eq_sub
section General
variable {G : Type*} {P : Type*} [AddGroup G] [T : AddTorsor G P]
@[simp]
theorem vsub_vadd (p₁ p₂ : P) : p₁ -ᵥ p₂ +ᵥ p₂ = p₁ :=
AddTorsor.vsub_vadd' p₁ p₂
#align vsub_vadd vsub_vadd
@[simp]
theorem vadd_vsub (g : G) (p : P) : g +ᵥ p -ᵥ p = g :=
AddTorsor.vadd_vsub' g p
#align vadd_vsub vadd_vsub
theorem vadd_right_cancel {g₁ g₂ : G} (p : P) (h : g₁ +ᵥ p = g₂ +ᵥ p) : g₁ = g₂ := by
-- Porting note: vadd_vsub g₁ → vadd_vsub g₁ p
rw [← vadd_vsub g₁ p, h, vadd_vsub]
#align vadd_right_cancel vadd_right_cancel
@[simp]
theorem vadd_right_cancel_iff {g₁ g₂ : G} (p : P) : g₁ +ᵥ p = g₂ +ᵥ p ↔ g₁ = g₂ :=
⟨vadd_right_cancel p, fun h => h ▸ rfl⟩
#align vadd_right_cancel_iff vadd_right_cancel_iff
theorem vadd_right_injective (p : P) : Function.Injective ((· +ᵥ p) : G → P) := fun _ _ =>
vadd_right_cancel p
#align vadd_right_injective vadd_right_injective
theorem vadd_vsub_assoc (g : G) (p₁ p₂ : P) : g +ᵥ p₁ -ᵥ p₂ = g + (p₁ -ᵥ p₂) := by
apply vadd_right_cancel p₂
rw [vsub_vadd, add_vadd, vsub_vadd]
#align vadd_vsub_assoc vadd_vsub_assoc
@[simp]
| Mathlib/Algebra/AddTorsor.lean | 124 | 125 | theorem vsub_self (p : P) : p -ᵥ p = (0 : G) := by |
rw [← zero_add (p -ᵥ p), ← vadd_vsub_assoc, vadd_vsub]
| 1 |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
section
variable {ι : Type*} [Fintype ι]
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)]
[∀ i, NormedSpace 𝕜 (E i)] :
IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G =>
p.1.prod p.2 where
map_add p₁ p₂ := by ext : 1; rfl
map_smul c p := by ext : 1; rfl
bound := by
refine ⟨1, zero_lt_one, fun p ↦ ?_⟩
rw [one_mul]
apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _
intro m
rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff]
constructor
· exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity)
· exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity)
#align is_bounded_linear_map_prod_multilinear isBoundedLinearMap_prod_multilinear
theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G →L[𝕜] E) :
IsBoundedLinearMap 𝕜 fun f : ContinuousMultilinearMap 𝕜 (fun _ : ι => E) F =>
f.compContinuousLinearMap fun _ => g := by
refine
IsLinearMap.with_bound
⟨fun f₁ f₂ => by ext; rfl,
fun c f => by ext; rfl⟩
(‖g‖ ^ Fintype.card ι) fun f => ?_
apply ContinuousMultilinearMap.opNorm_le_bound _ _ _
· apply_rules [mul_nonneg, pow_nonneg, norm_nonneg]
intro m
calc
‖f (g ∘ m)‖ ≤ ‖f‖ * ∏ i, ‖g (m i)‖ := f.le_opNorm _
_ ≤ ‖f‖ * ∏ i, ‖g‖ * ‖m i‖ := by
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
exact Finset.prod_le_prod (fun i _ => norm_nonneg _) fun i _ => g.le_opNorm _
_ = ‖g‖ ^ Fintype.card ι * ‖f‖ * ∏ i, ‖m i‖ := by
simp only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ]
ring
#align is_bounded_linear_map_continuous_multilinear_map_comp_linear isBoundedLinearMap_continuousMultilinearMap_comp_linear
end
section BilinearMap
namespace ContinuousLinearMap
variable {R : Type*}
variable {𝕜₂ 𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NontriviallyNormedField 𝕜₂]
variable {M : Type*} [TopologicalSpace M]
variable {σ₁₂ : 𝕜 →+* 𝕜₂}
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜₂ G'] [NormedSpace 𝕜' G']
variable [SMulCommClass 𝕜₂ 𝕜' G']
section Ring
variable [Ring R] [AddCommGroup M] [Module R M] {ρ₁₂ : R →+* 𝕜'}
theorem map_sub₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x x' : M) (y : F) :
f (x - x') y = f x y - f x' y := by rw [f.map_sub, sub_apply]
#align continuous_linear_map.map_sub₂ ContinuousLinearMap.map_sub₂
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 307 | 308 | theorem map_neg₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x : M) (y : F) : f (-x) y = -f x y := by |
rw [f.map_neg, neg_apply]
| 1 |
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Data.Nat.SuccPred
#align_import set_theory.ordinal.arithmetic from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7"
assert_not_exists Field
assert_not_exists Module
noncomputable section
open Function Cardinal Set Equiv Order
open scoped Classical
open Cardinal Ordinal
universe u v w
namespace Ordinal
variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop}
{t : γ → γ → Prop}
@[simp]
theorem lift_add (a b : Ordinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b :=
Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ =>
Quotient.sound
⟨(RelIso.preimage Equiv.ulift _).trans
(RelIso.sumLexCongr (RelIso.preimage Equiv.ulift _) (RelIso.preimage Equiv.ulift _)).symm⟩
#align ordinal.lift_add Ordinal.lift_add
@[simp]
theorem lift_succ (a : Ordinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a) := by
rw [← add_one_eq_succ, lift_add, lift_one]
rfl
#align ordinal.lift_succ Ordinal.lift_succ
instance add_contravariantClass_le : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· ≤ ·) :=
⟨fun a b c =>
inductionOn a fun α r hr =>
inductionOn b fun β₁ s₁ hs₁ =>
inductionOn c fun β₂ s₂ hs₂ ⟨f⟩ =>
⟨have fl : ∀ a, f (Sum.inl a) = Sum.inl a := fun a => by
simpa only [InitialSeg.trans_apply, InitialSeg.leAdd_apply] using
@InitialSeg.eq _ _ _ _ _
((InitialSeg.leAdd r s₁).trans f) (InitialSeg.leAdd r s₂) a
have : ∀ b, { b' // f (Sum.inr b) = Sum.inr b' } := by
intro b; cases e : f (Sum.inr b)
· rw [← fl] at e
have := f.inj' e
contradiction
· exact ⟨_, rfl⟩
let g (b) := (this b).1
have fr : ∀ b, f (Sum.inr b) = Sum.inr (g b) := fun b => (this b).2
⟨⟨⟨g, fun x y h => by
injection f.inj' (by rw [fr, fr, h] : f (Sum.inr x) = f (Sum.inr y))⟩,
@fun a b => by
-- Porting note:
-- `relEmbedding.coe_fn_to_embedding` & `initial_seg.coe_fn_to_rel_embedding`
-- → `InitialSeg.coe_coe_fn`
simpa only [Sum.lex_inr_inr, fr, InitialSeg.coe_coe_fn, Embedding.coeFn_mk] using
@RelEmbedding.map_rel_iff _ _ _ _ f.toRelEmbedding (Sum.inr a) (Sum.inr b)⟩,
fun a b H => by
rcases f.init (by rw [fr] <;> exact Sum.lex_inr_inr.2 H) with ⟨a' | a', h⟩
· rw [fl] at h
cases h
· rw [fr] at h
exact ⟨a', Sum.inr.inj h⟩⟩⟩⟩
#align ordinal.add_contravariant_class_le Ordinal.add_contravariantClass_le
| Mathlib/SetTheory/Ordinal/Arithmetic.lean | 119 | 120 | theorem add_left_cancel (a) {b c : Ordinal} : a + b = a + c ↔ b = c := by |
simp only [le_antisymm_iff, add_le_add_iff_left]
| 1 |
import Mathlib.Algebra.Polynomial.Splits
#align_import algebra.cubic_discriminant from "leanprover-community/mathlib"@"930133160e24036d5242039fe4972407cd4f1222"
noncomputable section
@[ext]
structure Cubic (R : Type*) where
(a b c d : R)
#align cubic Cubic
namespace Cubic
open Cubic Polynomial
open Polynomial
variable {R S F K : Type*}
instance [Inhabited R] : Inhabited (Cubic R) :=
⟨⟨default, default, default, default⟩⟩
instance [Zero R] : Zero (Cubic R) :=
⟨⟨0, 0, 0, 0⟩⟩
section Basic
variable {P Q : Cubic R} {a b c d a' b' c' d' : R} [Semiring R]
def toPoly (P : Cubic R) : R[X] :=
C P.a * X ^ 3 + C P.b * X ^ 2 + C P.c * X + C P.d
#align cubic.to_poly Cubic.toPoly
theorem C_mul_prod_X_sub_C_eq [CommRing S] {w x y z : S} :
C w * (X - C x) * (X - C y) * (X - C z) =
toPoly ⟨w, w * -(x + y + z), w * (x * y + x * z + y * z), w * -(x * y * z)⟩ := by
simp only [toPoly, C_neg, C_add, C_mul]
ring1
set_option linter.uppercaseLean3 false in
#align cubic.C_mul_prod_X_sub_C_eq Cubic.C_mul_prod_X_sub_C_eq
theorem prod_X_sub_C_eq [CommRing S] {x y z : S} :
(X - C x) * (X - C y) * (X - C z) =
toPoly ⟨1, -(x + y + z), x * y + x * z + y * z, -(x * y * z)⟩ := by
rw [← one_mul <| X - C x, ← C_1, C_mul_prod_X_sub_C_eq, one_mul, one_mul, one_mul]
set_option linter.uppercaseLean3 false in
#align cubic.prod_X_sub_C_eq Cubic.prod_X_sub_C_eq
section Coeff
private theorem coeffs : (∀ n > 3, P.toPoly.coeff n = 0) ∧ P.toPoly.coeff 3 = P.a ∧
P.toPoly.coeff 2 = P.b ∧ P.toPoly.coeff 1 = P.c ∧ P.toPoly.coeff 0 = P.d := by
simp only [toPoly, coeff_add, coeff_C, coeff_C_mul_X, coeff_C_mul_X_pow]
set_option tactic.skipAssignedInstances false in norm_num
intro n hn
repeat' rw [if_neg]
any_goals linarith only [hn]
repeat' rw [zero_add]
@[simp]
theorem coeff_eq_zero {n : ℕ} (hn : 3 < n) : P.toPoly.coeff n = 0 :=
coeffs.1 n hn
#align cubic.coeff_eq_zero Cubic.coeff_eq_zero
@[simp]
theorem coeff_eq_a : P.toPoly.coeff 3 = P.a :=
coeffs.2.1
#align cubic.coeff_eq_a Cubic.coeff_eq_a
@[simp]
theorem coeff_eq_b : P.toPoly.coeff 2 = P.b :=
coeffs.2.2.1
#align cubic.coeff_eq_b Cubic.coeff_eq_b
@[simp]
theorem coeff_eq_c : P.toPoly.coeff 1 = P.c :=
coeffs.2.2.2.1
#align cubic.coeff_eq_c Cubic.coeff_eq_c
@[simp]
theorem coeff_eq_d : P.toPoly.coeff 0 = P.d :=
coeffs.2.2.2.2
#align cubic.coeff_eq_d Cubic.coeff_eq_d
theorem a_of_eq (h : P.toPoly = Q.toPoly) : P.a = Q.a := by rw [← coeff_eq_a, h, coeff_eq_a]
#align cubic.a_of_eq Cubic.a_of_eq
theorem b_of_eq (h : P.toPoly = Q.toPoly) : P.b = Q.b := by rw [← coeff_eq_b, h, coeff_eq_b]
#align cubic.b_of_eq Cubic.b_of_eq
| Mathlib/Algebra/CubicDiscriminant.lean | 127 | 127 | theorem c_of_eq (h : P.toPoly = Q.toPoly) : P.c = Q.c := by | rw [← coeff_eq_c, h, coeff_eq_c]
| 1 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
theorem logb_zero : logb b 0 = 0 := by simp [logb]
#align real.logb_zero Real.logb_zero
@[simp]
theorem logb_one : logb b 1 = 0 := by simp [logb]
#align real.logb_one Real.logb_one
@[simp]
lemma logb_self_eq_one (hb : 1 < b) : logb b b = 1 :=
div_self (log_pos hb).ne'
lemma logb_self_eq_one_iff : logb b b = 1 ↔ b ≠ 0 ∧ b ≠ 1 ∧ b ≠ -1 :=
Iff.trans ⟨fun h h' => by simp [logb, h'] at h, div_self⟩ log_ne_zero
@[simp]
theorem logb_abs (x : ℝ) : logb b |x| = logb b x := by rw [logb, logb, log_abs]
#align real.logb_abs Real.logb_abs
@[simp]
theorem logb_neg_eq_logb (x : ℝ) : logb b (-x) = logb b x := by
rw [← logb_abs x, ← logb_abs (-x), abs_neg]
#align real.logb_neg_eq_logb Real.logb_neg_eq_logb
theorem logb_mul (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x * y) = logb b x + logb b y := by
simp_rw [logb, log_mul hx hy, add_div]
#align real.logb_mul Real.logb_mul
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 76 | 77 | theorem logb_div (hx : x ≠ 0) (hy : y ≠ 0) : logb b (x / y) = logb b x - logb b y := by |
simp_rw [logb, log_div hx hy, sub_div]
| 1 |
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace PosNum
variable {α : Type*}
@[simp, norm_cast]
theorem cast_one [One α] [Add α] : ((1 : PosNum) : α) = 1 :=
rfl
#align pos_num.cast_one PosNum.cast_one
@[simp]
theorem cast_one' [One α] [Add α] : (PosNum.one : α) = 1 :=
rfl
#align pos_num.cast_one' PosNum.cast_one'
@[simp, norm_cast]
theorem cast_bit0 [One α] [Add α] (n : PosNum) : (n.bit0 : α) = _root_.bit0 (n : α) :=
rfl
#align pos_num.cast_bit0 PosNum.cast_bit0
@[simp, norm_cast]
theorem cast_bit1 [One α] [Add α] (n : PosNum) : (n.bit1 : α) = _root_.bit1 (n : α) :=
rfl
#align pos_num.cast_bit1 PosNum.cast_bit1
@[simp, norm_cast]
theorem cast_to_nat [AddMonoidWithOne α] : ∀ n : PosNum, ((n : ℕ) : α) = n
| 1 => Nat.cast_one
| bit0 p => (Nat.cast_bit0 _).trans <| congr_arg _root_.bit0 p.cast_to_nat
| bit1 p => (Nat.cast_bit1 _).trans <| congr_arg _root_.bit1 p.cast_to_nat
#align pos_num.cast_to_nat PosNum.cast_to_nat
@[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem to_nat_to_int (n : PosNum) : ((n : ℕ) : ℤ) = n :=
cast_to_nat _
#align pos_num.to_nat_to_int PosNum.to_nat_to_int
@[simp, norm_cast]
theorem cast_to_int [AddGroupWithOne α] (n : PosNum) : ((n : ℤ) : α) = n := by
rw [← to_nat_to_int, Int.cast_natCast, cast_to_nat]
#align pos_num.cast_to_int PosNum.cast_to_int
theorem succ_to_nat : ∀ n, (succ n : ℕ) = n + 1
| 1 => rfl
| bit0 p => rfl
| bit1 p =>
(congr_arg _root_.bit0 (succ_to_nat p)).trans <|
show ↑p + 1 + ↑p + 1 = ↑p + ↑p + 1 + 1 by simp [add_left_comm]
#align pos_num.succ_to_nat PosNum.succ_to_nat
theorem one_add (n : PosNum) : 1 + n = succ n := by cases n <;> rfl
#align pos_num.one_add PosNum.one_add
| Mathlib/Data/Num/Lemmas.lean | 84 | 84 | theorem add_one (n : PosNum) : n + 1 = succ n := by | cases n <;> rfl
| 1 |
import Mathlib.Data.Setoid.Partition
import Mathlib.GroupTheory.GroupAction.Basic
import Mathlib.GroupTheory.GroupAction.Pointwise
import Mathlib.GroupTheory.GroupAction.SubMulAction
open scoped BigOperators Pointwise
namespace MulAction
section SMul
variable (G : Type*) {X : Type*} [SMul G X]
-- Change terminology : is_fully_invariant ?
def IsFixedBlock (B : Set X) := ∀ g : G, g • B = B
def IsInvariantBlock (B : Set X) := ∀ g : G, g • B ⊆ B
def IsTrivialBlock (B : Set X) := B.Subsingleton ∨ B = ⊤
def IsBlock (B : Set X) := (Set.range fun g : G => g • B).PairwiseDisjoint id
variable {G}
theorem IsBlock.def {B : Set X} :
IsBlock G B ↔ ∀ g g' : G, g • B = g' • B ∨ Disjoint (g • B) (g' • B) := by
apply Set.pairwiseDisjoint_range_iff
| Mathlib/GroupTheory/GroupAction/Blocks.lean | 90 | 92 | theorem IsBlock.mk_notempty {B : Set X} :
IsBlock G B ↔ ∀ g g' : G, g • B ∩ g' • B ≠ ∅ → g • B = g' • B := by |
simp_rw [IsBlock.def, or_iff_not_imp_right, Set.disjoint_iff_inter_eq_empty]
| 1 |
import Mathlib.Analysis.Analytic.Composition
#align_import analysis.analytic.inverse from "leanprover-community/mathlib"@"284fdd2962e67d2932fa3a79ce19fcf92d38e228"
open scoped Classical Topology
open Finset Filter
namespace FormalMultilinearSeries
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
noncomputable def leftInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
FormalMultilinearSeries 𝕜 F E
| 0 => 0
| 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm
| n + 2 =>
-∑ c : { c : Composition (n + 2) // c.length < n + 2 },
(leftInv p i (c : Composition (n + 2)).length).compAlongComposition
(p.compContinuousLinearMap i.symm) c
#align formal_multilinear_series.left_inv FormalMultilinearSeries.leftInv
@[simp]
theorem leftInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
p.leftInv i 0 = 0 := by rw [leftInv]
#align formal_multilinear_series.left_inv_coeff_zero FormalMultilinearSeries.leftInv_coeff_zero
@[simp]
theorem leftInv_coeff_one (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
p.leftInv i 1 = (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm := by rw [leftInv]
#align formal_multilinear_series.left_inv_coeff_one FormalMultilinearSeries.leftInv_coeff_one
theorem leftInv_removeZero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
p.removeZero.leftInv i = p.leftInv i := by
ext1 n
induction' n using Nat.strongRec' with n IH
match n with
| 0 => simp -- if one replaces `simp` with `refl`, the proof times out in the kernel.
| 1 => simp -- TODO: why?
| n + 2 =>
simp only [leftInv, neg_inj]
refine Finset.sum_congr rfl fun c cuniv => ?_
rcases c with ⟨c, hc⟩
ext v
dsimp
simp [IH _ hc]
#align formal_multilinear_series.left_inv_remove_zero FormalMultilinearSeries.leftInv_removeZero
theorem leftInv_comp (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F)
(h : p 1 = (continuousMultilinearCurryFin1 𝕜 E F).symm i) : (leftInv p i).comp p = id 𝕜 E := by
ext (n v)
match n with
| 0 =>
simp only [leftInv_coeff_zero, ContinuousMultilinearMap.zero_apply, id_apply_ne_one, Ne,
not_false_iff, zero_ne_one, comp_coeff_zero']
| 1 =>
simp only [leftInv_coeff_one, comp_coeff_one, h, id_apply_one, ContinuousLinearEquiv.coe_apply,
ContinuousLinearEquiv.symm_apply_apply, continuousMultilinearCurryFin1_symm_apply]
| n + 2 =>
have A :
(Finset.univ : Finset (Composition (n + 2))) =
{c | Composition.length c < n + 2}.toFinset ∪ {Composition.ones (n + 2)} := by
refine Subset.antisymm (fun c _ => ?_) (subset_univ _)
by_cases h : c.length < n + 2
· simp [h, Set.mem_toFinset (s := {c | Composition.length c < n + 2})]
· simp [Composition.eq_ones_iff_le_length.2 (not_lt.1 h)]
have B :
Disjoint ({c | Composition.length c < n + 2} : Set (Composition (n + 2))).toFinset
{Composition.ones (n + 2)} := by
simp [Set.mem_toFinset (s := {c | Composition.length c < n + 2})]
have C :
((p.leftInv i (Composition.ones (n + 2)).length)
fun j : Fin (Composition.ones n.succ.succ).length =>
p 1 fun _ => v ((Fin.castLE (Composition.length_le _)) j)) =
p.leftInv i (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j := by
apply FormalMultilinearSeries.congr _ (Composition.ones_length _) fun j hj1 hj2 => ?_
exact FormalMultilinearSeries.congr _ rfl fun k _ _ => by congr
have D :
(p.leftInv i (n + 2) fun j : Fin (n + 2) => p 1 fun _ => v j) =
-∑ c ∈ {c : Composition (n + 2) | c.length < n + 2}.toFinset,
(p.leftInv i c.length) (p.applyComposition c v) := by
simp only [leftInv, ContinuousMultilinearMap.neg_apply, neg_inj,
ContinuousMultilinearMap.sum_apply]
convert
(sum_toFinset_eq_subtype
(fun c : Composition (n + 2) => c.length < n + 2)
(fun c : Composition (n + 2) =>
(ContinuousMultilinearMap.compAlongComposition
(p.compContinuousLinearMap (i.symm : F →L[𝕜] E)) c (p.leftInv i c.length))
fun j : Fin (n + 2) => p 1 fun _ : Fin 1 => v j)).symm.trans
_
simp only [compContinuousLinearMap_applyComposition,
ContinuousMultilinearMap.compAlongComposition_apply]
congr
ext c
congr
ext k
simp [h, Function.comp]
simp [FormalMultilinearSeries.comp, show n + 2 ≠ 1 by omega, A, Finset.sum_union B,
applyComposition_ones, C, D, -Set.toFinset_setOf]
#align formal_multilinear_series.left_inv_comp FormalMultilinearSeries.leftInv_comp
noncomputable def rightInv (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
FormalMultilinearSeries 𝕜 F E
| 0 => 0
| 1 => (continuousMultilinearCurryFin1 𝕜 F E).symm i.symm
| n + 2 =>
let q : FormalMultilinearSeries 𝕜 F E := fun k => if k < n + 2 then rightInv p i k else 0;
-(i.symm : F →L[𝕜] E).compContinuousMultilinearMap ((p.comp q) (n + 2))
#align formal_multilinear_series.right_inv FormalMultilinearSeries.rightInv
@[simp]
| Mathlib/Analysis/Analytic/Inverse.lean | 177 | 178 | theorem rightInv_coeff_zero (p : FormalMultilinearSeries 𝕜 E F) (i : E ≃L[𝕜] F) :
p.rightInv i 0 = 0 := by | rw [rightInv]
| 1 |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Equalizer
variable (f g : X ⟶ Y) [HasEqualizer f g]
abbrev equalizerSubobject : Subobject X :=
Subobject.mk (equalizer.ι f g)
#align category_theory.limits.equalizer_subobject CategoryTheory.Limits.equalizerSubobject
def equalizerSubobjectIso : (equalizerSubobject f g : C) ≅ equalizer f g :=
Subobject.underlyingIso (equalizer.ι f g)
#align category_theory.limits.equalizer_subobject_iso CategoryTheory.Limits.equalizerSubobjectIso
@[reassoc (attr := simp)]
theorem equalizerSubobject_arrow :
(equalizerSubobjectIso f g).hom ≫ equalizer.ι f g = (equalizerSubobject f g).arrow := by
simp [equalizerSubobjectIso]
#align category_theory.limits.equalizer_subobject_arrow CategoryTheory.Limits.equalizerSubobject_arrow
@[reassoc (attr := simp)]
theorem equalizerSubobject_arrow' :
(equalizerSubobjectIso f g).inv ≫ (equalizerSubobject f g).arrow = equalizer.ι f g := by
simp [equalizerSubobjectIso]
#align category_theory.limits.equalizer_subobject_arrow' CategoryTheory.Limits.equalizerSubobject_arrow'
@[reassoc]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 62 | 64 | theorem equalizerSubobject_arrow_comp :
(equalizerSubobject f g).arrow ≫ f = (equalizerSubobject f g).arrow ≫ g := by |
rw [← equalizerSubobject_arrow, Category.assoc, Category.assoc, equalizer.condition]
| 1 |
import Mathlib.FieldTheory.SplittingField.IsSplittingField
import Mathlib.Algebra.CharP.Algebra
#align_import field_theory.splitting_field.construction from "leanprover-community/mathlib"@"e3f4be1fcb5376c4948d7f095bec45350bfb9d1a"
noncomputable section
open scoped Classical Polynomial
universe u v w
variable {F : Type u} {K : Type v} {L : Type w}
namespace Polynomial
variable [Field K] [Field L] [Field F]
open Polynomial
section SplittingField
def factor (f : K[X]) : K[X] :=
if H : ∃ g, Irreducible g ∧ g ∣ f then Classical.choose H else X
#align polynomial.factor Polynomial.factor
theorem irreducible_factor (f : K[X]) : Irreducible (factor f) := by
rw [factor]
split_ifs with H
· exact (Classical.choose_spec H).1
· exact irreducible_X
#align polynomial.irreducible_factor Polynomial.irreducible_factor
theorem fact_irreducible_factor (f : K[X]) : Fact (Irreducible (factor f)) :=
⟨irreducible_factor f⟩
#align polynomial.fact_irreducible_factor Polynomial.fact_irreducible_factor
attribute [local instance] fact_irreducible_factor
theorem factor_dvd_of_not_isUnit {f : K[X]} (hf1 : ¬IsUnit f) : factor f ∣ f := by
by_cases hf2 : f = 0; · rw [hf2]; exact dvd_zero _
rw [factor, dif_pos (WfDvdMonoid.exists_irreducible_factor hf1 hf2)]
exact (Classical.choose_spec <| WfDvdMonoid.exists_irreducible_factor hf1 hf2).2
#align polynomial.factor_dvd_of_not_is_unit Polynomial.factor_dvd_of_not_isUnit
theorem factor_dvd_of_degree_ne_zero {f : K[X]} (hf : f.degree ≠ 0) : factor f ∣ f :=
factor_dvd_of_not_isUnit (mt degree_eq_zero_of_isUnit hf)
#align polynomial.factor_dvd_of_degree_ne_zero Polynomial.factor_dvd_of_degree_ne_zero
theorem factor_dvd_of_natDegree_ne_zero {f : K[X]} (hf : f.natDegree ≠ 0) : factor f ∣ f :=
factor_dvd_of_degree_ne_zero (mt natDegree_eq_of_degree_eq_some hf)
#align polynomial.factor_dvd_of_nat_degree_ne_zero Polynomial.factor_dvd_of_natDegree_ne_zero
def removeFactor (f : K[X]) : Polynomial (AdjoinRoot <| factor f) :=
map (AdjoinRoot.of f.factor) f /ₘ (X - C (AdjoinRoot.root f.factor))
#align polynomial.remove_factor Polynomial.removeFactor
theorem X_sub_C_mul_removeFactor (f : K[X]) (hf : f.natDegree ≠ 0) :
(X - C (AdjoinRoot.root f.factor)) * f.removeFactor = map (AdjoinRoot.of f.factor) f := by
let ⟨g, hg⟩ := factor_dvd_of_natDegree_ne_zero hf
apply (mul_divByMonic_eq_iff_isRoot
(R := AdjoinRoot f.factor) (a := AdjoinRoot.root f.factor)).mpr
rw [IsRoot.def, eval_map, hg, eval₂_mul, ← hg, AdjoinRoot.eval₂_root, zero_mul]
set_option linter.uppercaseLean3 false in
#align polynomial.X_sub_C_mul_remove_factor Polynomial.X_sub_C_mul_removeFactor
theorem natDegree_removeFactor (f : K[X]) : f.removeFactor.natDegree = f.natDegree - 1 := by
-- Porting note: `(map (AdjoinRoot.of f.factor) f)` was `_`
rw [removeFactor, natDegree_divByMonic (map (AdjoinRoot.of f.factor) f) (monic_X_sub_C _),
natDegree_map, natDegree_X_sub_C]
#align polynomial.nat_degree_remove_factor Polynomial.natDegree_removeFactor
| Mathlib/FieldTheory/SplittingField/Construction.lean | 103 | 104 | theorem natDegree_removeFactor' {f : K[X]} {n : ℕ} (hfn : f.natDegree = n + 1) :
f.removeFactor.natDegree = n := by | rw [natDegree_removeFactor, hfn, n.add_sub_cancel]
| 1 |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
import Mathlib.Data.Int.Log
#align_import analysis.special_functions.log.base from "leanprover-community/mathlib"@"f23a09ce6d3f367220dc3cecad6b7eb69eb01690"
open Set Filter Function
open Topology
noncomputable section
namespace Real
variable {b x y : ℝ}
-- @[pp_nodot] -- Porting note: removed
noncomputable def logb (b x : ℝ) : ℝ :=
log x / log b
#align real.logb Real.logb
theorem log_div_log : log x / log b = logb b x :=
rfl
#align real.log_div_log Real.log_div_log
@[simp]
| Mathlib/Analysis/SpecialFunctions/Log/Base.lean | 49 | 49 | theorem logb_zero : logb b 0 = 0 := by | simp [logb]
| 1 |
import Mathlib.Order.Interval.Set.Disjoint
import Mathlib.MeasureTheory.Integral.SetIntegral
import Mathlib.MeasureTheory.Measure.Lebesgue.Basic
#align_import measure_theory.integral.interval_integral from "leanprover-community/mathlib"@"fd5edc43dc4f10b85abfe544b88f82cf13c5f844"
noncomputable section
open scoped Classical
open MeasureTheory Set Filter Function
open scoped Classical Topology Filter ENNReal Interval NNReal
variable {ι 𝕜 E F A : Type*} [NormedAddCommGroup E]
def IntervalIntegrable (f : ℝ → E) (μ : Measure ℝ) (a b : ℝ) : Prop :=
IntegrableOn f (Ioc a b) μ ∧ IntegrableOn f (Ioc b a) μ
#align interval_integrable IntervalIntegrable
section
variable {f : ℝ → E} {a b : ℝ} {μ : Measure ℝ}
theorem intervalIntegrable_iff : IntervalIntegrable f μ a b ↔ IntegrableOn f (Ι a b) μ := by
rw [uIoc_eq_union, integrableOn_union, IntervalIntegrable]
#align interval_integrable_iff intervalIntegrable_iff
theorem IntervalIntegrable.def' (h : IntervalIntegrable f μ a b) : IntegrableOn f (Ι a b) μ :=
intervalIntegrable_iff.mp h
#align interval_integrable.def IntervalIntegrable.def'
theorem intervalIntegrable_iff_integrableOn_Ioc_of_le (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioc a b) μ := by
rw [intervalIntegrable_iff, uIoc_of_le hab]
#align interval_integrable_iff_integrable_Ioc_of_le intervalIntegrable_iff_integrableOn_Ioc_of_le
theorem intervalIntegrable_iff' [NoAtoms μ] :
IntervalIntegrable f μ a b ↔ IntegrableOn f (uIcc a b) μ := by
rw [intervalIntegrable_iff, ← Icc_min_max, uIoc, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff' intervalIntegrable_iff'
theorem intervalIntegrable_iff_integrableOn_Icc_of_le {f : ℝ → E} {a b : ℝ} (hab : a ≤ b)
{μ : Measure ℝ} [NoAtoms μ] : IntervalIntegrable f μ a b ↔ IntegrableOn f (Icc a b) μ := by
rw [intervalIntegrable_iff_integrableOn_Ioc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioc]
#align interval_integrable_iff_integrable_Icc_of_le intervalIntegrable_iff_integrableOn_Icc_of_le
theorem intervalIntegrable_iff_integrableOn_Ico_of_le [NoAtoms μ] (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ico a b) μ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ico]
theorem intervalIntegrable_iff_integrableOn_Ioo_of_le [NoAtoms μ] (hab : a ≤ b) :
IntervalIntegrable f μ a b ↔ IntegrableOn f (Ioo a b) μ := by
rw [intervalIntegrable_iff_integrableOn_Icc_of_le hab, integrableOn_Icc_iff_integrableOn_Ioo]
theorem MeasureTheory.Integrable.intervalIntegrable (hf : Integrable f μ) :
IntervalIntegrable f μ a b :=
⟨hf.integrableOn, hf.integrableOn⟩
#align measure_theory.integrable.interval_integrable MeasureTheory.Integrable.intervalIntegrable
theorem MeasureTheory.IntegrableOn.intervalIntegrable (hf : IntegrableOn f [[a, b]] μ) :
IntervalIntegrable f μ a b :=
⟨MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc),
MeasureTheory.IntegrableOn.mono_set hf (Ioc_subset_Icc_self.trans Icc_subset_uIcc')⟩
#align measure_theory.integrable_on.interval_integrable MeasureTheory.IntegrableOn.intervalIntegrable
theorem intervalIntegrable_const_iff {c : E} :
IntervalIntegrable (fun _ => c) μ a b ↔ c = 0 ∨ μ (Ι a b) < ∞ := by
simp only [intervalIntegrable_iff, integrableOn_const]
#align interval_integrable_const_iff intervalIntegrable_const_iff
@[simp]
theorem intervalIntegrable_const [IsLocallyFiniteMeasure μ] {c : E} :
IntervalIntegrable (fun _ => c) μ a b :=
intervalIntegrable_const_iff.2 <| Or.inr measure_Ioc_lt_top
#align interval_integrable_const intervalIntegrable_const
end
namespace IntervalIntegrable
section
variable {f : ℝ → E} {a b c d : ℝ} {μ ν : Measure ℝ}
@[symm]
nonrec theorem symm (h : IntervalIntegrable f μ a b) : IntervalIntegrable f μ b a :=
h.symm
#align interval_integrable.symm IntervalIntegrable.symm
@[refl, simp] -- Porting note: added `simp`
| Mathlib/MeasureTheory/Integral/IntervalIntegral.lean | 161 | 161 | theorem refl : IntervalIntegrable f μ a a := by | constructor <;> simp
| 1 |
import Mathlib.Topology.MetricSpace.Basic
#align_import topology.metric_space.infsep from "leanprover-community/mathlib"@"5316314b553dcf8c6716541851517c1a9715e22b"
variable {α β : Type*}
namespace Set
section Einfsep
open ENNReal
open Function
noncomputable def einfsep [EDist α] (s : Set α) : ℝ≥0∞ :=
⨅ (x ∈ s) (y ∈ s) (_ : x ≠ y), edist x y
#align set.einfsep Set.einfsep
section EDist
variable [EDist α] {x y : α} {s t : Set α}
theorem le_einfsep_iff {d} :
d ≤ s.einfsep ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → d ≤ edist x y := by
simp_rw [einfsep, le_iInf_iff]
#align set.le_einfsep_iff Set.le_einfsep_iff
theorem einfsep_zero : s.einfsep = 0 ↔ ∀ C > 0, ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < C := by
simp_rw [einfsep, ← _root_.bot_eq_zero, iInf_eq_bot, iInf_lt_iff, exists_prop]
#align set.einfsep_zero Set.einfsep_zero
theorem einfsep_pos : 0 < s.einfsep ↔ ∃ C > 0, ∀ x ∈ s, ∀ y ∈ s, x ≠ y → C ≤ edist x y := by
rw [pos_iff_ne_zero, Ne, einfsep_zero]
simp only [not_forall, not_exists, not_lt, exists_prop, not_and]
#align set.einfsep_pos Set.einfsep_pos
theorem einfsep_top :
s.einfsep = ∞ ↔ ∀ x ∈ s, ∀ y ∈ s, x ≠ y → edist x y = ∞ := by
simp_rw [einfsep, iInf_eq_top]
#align set.einfsep_top Set.einfsep_top
theorem einfsep_lt_top :
s.einfsep < ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < ∞ := by
simp_rw [einfsep, iInf_lt_iff, exists_prop]
#align set.einfsep_lt_top Set.einfsep_lt_top
theorem einfsep_ne_top :
s.einfsep ≠ ∞ ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y ≠ ∞ := by
simp_rw [← lt_top_iff_ne_top, einfsep_lt_top]
#align set.einfsep_ne_top Set.einfsep_ne_top
| Mathlib/Topology/MetricSpace/Infsep.lean | 79 | 81 | theorem einfsep_lt_iff {d} :
s.einfsep < d ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y ∧ edist x y < d := by |
simp_rw [einfsep, iInf_lt_iff, exists_prop]
| 1 |
import Mathlib.MeasureTheory.Constructions.Pi
import Mathlib.MeasureTheory.Integral.Lebesgue
open scoped Classical ENNReal
open Set Function Equiv Finset
noncomputable section
namespace MeasureTheory
section LMarginal
variable {δ δ' : Type*} {π : δ → Type*} [∀ x, MeasurableSpace (π x)]
variable {μ : ∀ i, Measure (π i)} [∀ i, SigmaFinite (μ i)] [DecidableEq δ]
variable {s t : Finset δ} {f g : (∀ i, π i) → ℝ≥0∞} {x y : ∀ i, π i} {i : δ}
def lmarginal (μ : ∀ i, Measure (π i)) (s : Finset δ) (f : (∀ i, π i) → ℝ≥0∞)
(x : ∀ i, π i) : ℝ≥0∞ :=
∫⁻ y : ∀ i : s, π i, f (updateFinset x s y) ∂Measure.pi fun i : s => μ i
-- Note: this notation is not a binder. This is more convenient since it returns a function.
@[inherit_doc]
notation "∫⋯∫⁻_" s ", " f " ∂" μ:70 => lmarginal μ s f
@[inherit_doc]
notation "∫⋯∫⁻_" s ", " f => lmarginal (fun _ ↦ volume) s f
variable (μ)
theorem _root_.Measurable.lmarginal (hf : Measurable f) : Measurable (∫⋯∫⁻_s, f ∂μ) := by
refine Measurable.lintegral_prod_right ?_
refine hf.comp ?_
rw [measurable_pi_iff]; intro i
by_cases hi : i ∈ s
· simp [hi, updateFinset]
exact measurable_pi_iff.1 measurable_snd _
· simp [hi, updateFinset]
exact measurable_pi_iff.1 measurable_fst _
@[simp] theorem lmarginal_empty (f : (∀ i, π i) → ℝ≥0∞) : ∫⋯∫⁻_∅, f ∂μ = f := by
ext1 x
simp_rw [lmarginal, Measure.pi_of_empty fun i : (∅ : Finset δ) => μ i]
apply lintegral_dirac'
exact Subsingleton.measurable
| Mathlib/MeasureTheory/Integral/Marginal.lean | 105 | 108 | theorem lmarginal_congr {x y : ∀ i, π i} (f : (∀ i, π i) → ℝ≥0∞)
(h : ∀ i ∉ s, x i = y i) :
(∫⋯∫⁻_s, f ∂μ) x = (∫⋯∫⁻_s, f ∂μ) y := by |
dsimp [lmarginal, updateFinset_def]; rcongr; exact h _ ‹_›
| 1 |
import Mathlib.Topology.Order
#align_import topology.maps from "leanprover-community/mathlib"@"d91e7f7a7f1c7e9f0e18fdb6bde4f652004c735d"
open Set Filter Function
open TopologicalSpace Topology Filter
variable {X : Type*} {Y : Type*} {Z : Type*} {ι : Type*} {f : X → Y} {g : Y → Z}
section Inducing
variable [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z]
theorem inducing_induced (f : X → Y) : @Inducing X Y (TopologicalSpace.induced f ‹_›) _ f :=
@Inducing.mk _ _ (TopologicalSpace.induced f ‹_›) _ _ rfl
theorem inducing_id : Inducing (@id X) :=
⟨induced_id.symm⟩
#align inducing_id inducing_id
protected theorem Inducing.comp (hg : Inducing g) (hf : Inducing f) :
Inducing (g ∘ f) :=
⟨by rw [hf.induced, hg.induced, induced_compose]⟩
#align inducing.comp Inducing.comp
theorem Inducing.of_comp_iff (hg : Inducing g) :
Inducing (g ∘ f) ↔ Inducing f := by
refine ⟨fun h ↦ ?_, hg.comp⟩
rw [inducing_iff, hg.induced, induced_compose, h.induced]
#align inducing.inducing_iff Inducing.of_comp_iff
theorem inducing_of_inducing_compose
(hf : Continuous f) (hg : Continuous g) (hgf : Inducing (g ∘ f)) : Inducing f :=
⟨le_antisymm (by rwa [← continuous_iff_le_induced])
(by
rw [hgf.induced, ← induced_compose]
exact induced_mono hg.le_induced)⟩
#align inducing_of_inducing_compose inducing_of_inducing_compose
theorem inducing_iff_nhds : Inducing f ↔ ∀ x, 𝓝 x = comap f (𝓝 (f x)) :=
(inducing_iff _).trans (induced_iff_nhds_eq f)
#align inducing_iff_nhds inducing_iff_nhds
namespace Inducing
theorem nhds_eq_comap (hf : Inducing f) : ∀ x : X, 𝓝 x = comap f (𝓝 <| f x) :=
inducing_iff_nhds.1 hf
#align inducing.nhds_eq_comap Inducing.nhds_eq_comap
theorem basis_nhds {p : ι → Prop} {s : ι → Set Y} (hf : Inducing f) {x : X}
(h_basis : (𝓝 (f x)).HasBasis p s) : (𝓝 x).HasBasis p (preimage f ∘ s) :=
hf.nhds_eq_comap x ▸ h_basis.comap f
theorem nhdsSet_eq_comap (hf : Inducing f) (s : Set X) :
𝓝ˢ s = comap f (𝓝ˢ (f '' s)) := by
simp only [nhdsSet, sSup_image, comap_iSup, hf.nhds_eq_comap, iSup_image]
#align inducing.nhds_set_eq_comap Inducing.nhdsSet_eq_comap
theorem map_nhds_eq (hf : Inducing f) (x : X) : (𝓝 x).map f = 𝓝[range f] f x :=
hf.induced.symm ▸ map_nhds_induced_eq x
#align inducing.map_nhds_eq Inducing.map_nhds_eq
theorem map_nhds_of_mem (hf : Inducing f) (x : X) (h : range f ∈ 𝓝 (f x)) :
(𝓝 x).map f = 𝓝 (f x) :=
hf.induced.symm ▸ map_nhds_induced_of_mem h
#align inducing.map_nhds_of_mem Inducing.map_nhds_of_mem
-- Porting note (#10756): new lemma
theorem mapClusterPt_iff (hf : Inducing f) {x : X} {l : Filter X} :
MapClusterPt (f x) l f ↔ ClusterPt x l := by
delta MapClusterPt ClusterPt
rw [← Filter.push_pull', ← hf.nhds_eq_comap, map_neBot_iff]
theorem image_mem_nhdsWithin (hf : Inducing f) {x : X} {s : Set X} (hs : s ∈ 𝓝 x) :
f '' s ∈ 𝓝[range f] f x :=
hf.map_nhds_eq x ▸ image_mem_map hs
#align inducing.image_mem_nhds_within Inducing.image_mem_nhdsWithin
theorem tendsto_nhds_iff {f : ι → Y} {l : Filter ι} {y : Y} (hg : Inducing g) :
Tendsto f l (𝓝 y) ↔ Tendsto (g ∘ f) l (𝓝 (g y)) := by
rw [hg.nhds_eq_comap, tendsto_comap_iff]
#align inducing.tendsto_nhds_iff Inducing.tendsto_nhds_iff
theorem continuousAt_iff (hg : Inducing g) {x : X} :
ContinuousAt f x ↔ ContinuousAt (g ∘ f) x :=
hg.tendsto_nhds_iff
#align inducing.continuous_at_iff Inducing.continuousAt_iff
| Mathlib/Topology/Maps.lean | 132 | 134 | theorem continuous_iff (hg : Inducing g) :
Continuous f ↔ Continuous (g ∘ f) := by |
simp_rw [continuous_iff_continuousAt, hg.continuousAt_iff]
| 1 |
import Mathlib.CategoryTheory.Preadditive.Injective
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Algebra.Homology.QuasiIso
#align_import category_theory.preadditive.injective_resolution from "leanprover-community/mathlib"@"14b69e9f3c16630440a2cbd46f1ddad0d561dee7"
noncomputable section
universe v u
namespace CategoryTheory
open Limits HomologicalComplex CochainComplex
variable {C : Type u} [Category.{v} C] [HasZeroObject C] [HasZeroMorphisms C]
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure InjectiveResolution (Z : C) where
cocomplex : CochainComplex C ℕ
injective : ∀ n, Injective (cocomplex.X n) := by infer_instance
[hasHomology : ∀ i, cocomplex.HasHomology i]
ι : (single₀ C).obj Z ⟶ cocomplex
quasiIso : QuasiIso ι := by infer_instance
set_option linter.uppercaseLean3 false in
#align category_theory.InjectiveResolution CategoryTheory.InjectiveResolution
open InjectiveResolution in
attribute [instance] injective hasHomology InjectiveResolution.quasiIso
class HasInjectiveResolution (Z : C) : Prop where
out : Nonempty (InjectiveResolution Z)
#align category_theory.has_injective_resolution CategoryTheory.HasInjectiveResolution
attribute [inherit_doc HasInjectiveResolution] HasInjectiveResolution.out
section
variable (C)
class HasInjectiveResolutions : Prop where
out : ∀ Z : C, HasInjectiveResolution Z
#align category_theory.has_injective_resolutions CategoryTheory.HasInjectiveResolutions
attribute [instance 100] HasInjectiveResolutions.out
end
namespace InjectiveResolution
variable {Z : C} (I : InjectiveResolution Z)
lemma cocomplex_exactAt_succ (n : ℕ) :
I.cocomplex.ExactAt (n + 1) := by
rw [← quasiIsoAt_iff_exactAt I.ι (n + 1) (exactAt_succ_single_obj _ _)]
infer_instance
lemma exact_succ (n : ℕ):
(ShortComplex.mk _ _ (I.cocomplex.d_comp_d n (n + 1) (n + 2))).Exact :=
(HomologicalComplex.exactAt_iff' _ n (n + 1) (n + 2) (by simp)
(by simp only [CochainComplex.next]; rfl)).1 (I.cocomplex_exactAt_succ n)
@[simp]
theorem ι_f_succ (n : ℕ) : I.ι.f (n + 1) = 0 :=
(isZero_single_obj_X _ _ _ _ (by simp)).eq_of_src _ _
set_option linter.uppercaseLean3 false in
#align category_theory.InjectiveResolution.ι_f_succ CategoryTheory.InjectiveResolution.ι_f_succ
-- Porting note (#10618): removed @[simp] simp can prove this
@[reassoc]
theorem ι_f_zero_comp_complex_d :
I.ι.f 0 ≫ I.cocomplex.d 0 1 = 0 := by
simp
set_option linter.uppercaseLean3 false in
#align category_theory.InjectiveResolution.ι_f_zero_comp_complex_d CategoryTheory.InjectiveResolution.ι_f_zero_comp_complex_d
-- Porting note (#10618): removed @[simp] simp can prove this
| Mathlib/CategoryTheory/Preadditive/InjectiveResolution.lean | 111 | 113 | theorem complex_d_comp (n : ℕ) :
I.cocomplex.d n (n + 1) ≫ I.cocomplex.d (n + 1) (n + 2) = 0 := by |
simp
| 1 |
import Mathlib.ModelTheory.Syntax
import Mathlib.ModelTheory.Semantics
import Mathlib.Algebra.Ring.Equiv
variable {α : Type*}
namespace FirstOrder
open FirstOrder
inductive ringFunc : ℕ → Type
| add : ringFunc 2
| mul : ringFunc 2
| neg : ringFunc 1
| zero : ringFunc 0
| one : ringFunc 0
deriving DecidableEq
def Language.ring : Language :=
{ Functions := ringFunc
Relations := fun _ => Empty }
namespace Ring
open ringFunc Language
instance (n : ℕ) : DecidableEq (Language.ring.Functions n) := by
dsimp [Language.ring]; infer_instance
instance (n : ℕ) : DecidableEq (Language.ring.Relations n) := by
dsimp [Language.ring]; infer_instance
abbrev addFunc : Language.ring.Functions 2 := add
abbrev mulFunc : Language.ring.Functions 2 := mul
abbrev negFunc : Language.ring.Functions 1 := neg
abbrev zeroFunc : Language.ring.Functions 0 := zero
abbrev oneFunc : Language.ring.Functions 0 := one
instance (α : Type*) : Zero (Language.ring.Term α) :=
{ zero := Constants.term zeroFunc }
theorem zero_def (α : Type*) : (0 : Language.ring.Term α) = Constants.term zeroFunc := rfl
instance (α : Type*) : One (Language.ring.Term α) :=
{ one := Constants.term oneFunc }
theorem one_def (α : Type*) : (1 : Language.ring.Term α) = Constants.term oneFunc := rfl
instance (α : Type*) : Add (Language.ring.Term α) :=
{ add := addFunc.apply₂ }
theorem add_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
t₁ + t₂ = addFunc.apply₂ t₁ t₂ := rfl
instance (α : Type*) : Mul (Language.ring.Term α) :=
{ mul := mulFunc.apply₂ }
theorem mul_def (α : Type*) (t₁ t₂ : Language.ring.Term α) :
t₁ * t₂ = mulFunc.apply₂ t₁ t₂ := rfl
instance (α : Type*) : Neg (Language.ring.Term α) :=
{ neg := negFunc.apply₁ }
theorem neg_def (α : Type*) (t : Language.ring.Term α) :
-t = negFunc.apply₁ t := rfl
instance : Fintype Language.ring.Symbols :=
⟨⟨Multiset.ofList
[Sum.inl ⟨2, .add⟩,
Sum.inl ⟨2, .mul⟩,
Sum.inl ⟨1, .neg⟩,
Sum.inl ⟨0, .zero⟩,
Sum.inl ⟨0, .one⟩], by
dsimp [Language.Symbols]; decide⟩, by
intro x
dsimp [Language.Symbols]
rcases x with ⟨_, f⟩ | ⟨_, f⟩
· cases f <;> decide
· cases f ⟩
@[simp]
theorem card_ring : card Language.ring = 5 := by
have : Fintype.card Language.ring.Symbols = 5 := rfl
simp [Language.card, this]
open Language ring Structure
class CompatibleRing (R : Type*) [Add R] [Mul R] [Neg R] [One R] [Zero R]
extends Language.ring.Structure R where
funMap_add : ∀ x, funMap addFunc x = x 0 + x 1
funMap_mul : ∀ x, funMap mulFunc x = x 0 * x 1
funMap_neg : ∀ x, funMap negFunc x = -x 0
funMap_zero : ∀ x, funMap (zeroFunc : Language.ring.Constants) x = 0
funMap_one : ∀ x, funMap (oneFunc : Language.ring.Constants) x = 1
open CompatibleRing
attribute [simp] funMap_add funMap_mul funMap_neg funMap_zero funMap_one
section
variable {R : Type*} [Add R] [Mul R] [Neg R] [One R] [Zero R] [CompatibleRing R]
@[simp]
theorem realize_add (x y : ring.Term α) (v : α → R) :
Term.realize v (x + y) = Term.realize v x + Term.realize v y := by
simp [add_def, funMap_add]
@[simp]
| Mathlib/ModelTheory/Algebra/Ring/Basic.lean | 185 | 187 | theorem realize_mul (x y : ring.Term α) (v : α → R) :
Term.realize v (x * y) = Term.realize v x * Term.realize v y := by |
simp [mul_def, funMap_mul]
| 1 |
import Mathlib.Algebra.MonoidAlgebra.Degree
import Mathlib.Algebra.MvPolynomial.Rename
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Degrees
def degrees (p : MvPolynomial σ R) : Multiset σ :=
letI := Classical.decEq σ
p.support.sup fun s : σ →₀ ℕ => toMultiset s
#align mv_polynomial.degrees MvPolynomial.degrees
theorem degrees_def [DecidableEq σ] (p : MvPolynomial σ R) :
p.degrees = p.support.sup fun s : σ →₀ ℕ => Finsupp.toMultiset s := by rw [degrees]; convert rfl
#align mv_polynomial.degrees_def MvPolynomial.degrees_def
theorem degrees_monomial (s : σ →₀ ℕ) (a : R) : degrees (monomial s a) ≤ toMultiset s := by
classical
refine (supDegree_single s a).trans_le ?_
split_ifs
exacts [bot_le, le_rfl]
#align mv_polynomial.degrees_monomial MvPolynomial.degrees_monomial
theorem degrees_monomial_eq (s : σ →₀ ℕ) (a : R) (ha : a ≠ 0) :
degrees (monomial s a) = toMultiset s := by
classical
exact (supDegree_single s a).trans (if_neg ha)
#align mv_polynomial.degrees_monomial_eq MvPolynomial.degrees_monomial_eq
theorem degrees_C (a : R) : degrees (C a : MvPolynomial σ R) = 0 :=
Multiset.le_zero.1 <| degrees_monomial _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_C MvPolynomial.degrees_C
theorem degrees_X' (n : σ) : degrees (X n : MvPolynomial σ R) ≤ {n} :=
le_trans (degrees_monomial _ _) <| le_of_eq <| toMultiset_single _ _
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_X' MvPolynomial.degrees_X'
@[simp]
theorem degrees_X [Nontrivial R] (n : σ) : degrees (X n : MvPolynomial σ R) = {n} :=
(degrees_monomial_eq _ (1 : R) one_ne_zero).trans (toMultiset_single _ _)
set_option linter.uppercaseLean3 false in
#align mv_polynomial.degrees_X MvPolynomial.degrees_X
@[simp]
theorem degrees_zero : degrees (0 : MvPolynomial σ R) = 0 := by
rw [← C_0]
exact degrees_C 0
#align mv_polynomial.degrees_zero MvPolynomial.degrees_zero
@[simp]
theorem degrees_one : degrees (1 : MvPolynomial σ R) = 0 :=
degrees_C 1
#align mv_polynomial.degrees_one MvPolynomial.degrees_one
theorem degrees_add [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).degrees ≤ p.degrees ⊔ q.degrees := by
simp_rw [degrees_def]; exact supDegree_add_le
#align mv_polynomial.degrees_add MvPolynomial.degrees_add
| Mathlib/Algebra/MvPolynomial/Degrees.lean | 133 | 135 | theorem degrees_sum {ι : Type*} [DecidableEq σ] (s : Finset ι) (f : ι → MvPolynomial σ R) :
(∑ i ∈ s, f i).degrees ≤ s.sup fun i => (f i).degrees := by |
simp_rw [degrees_def]; exact supDegree_sum_le
| 1 |
import Mathlib.Geometry.RingedSpace.PresheafedSpace
import Mathlib.CategoryTheory.Limits.Final
import Mathlib.Topology.Sheaves.Stalks
#align_import algebraic_geometry.stalks from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
noncomputable section
universe v u v' u'
open Opposite CategoryTheory CategoryTheory.Category CategoryTheory.Functor CategoryTheory.Limits
AlgebraicGeometry TopologicalSpace
variable {C : Type u} [Category.{v} C] [HasColimits C]
-- Porting note: no tidy tactic
-- attribute [local tidy] tactic.auto_cases_opens
-- this could be replaced by
-- attribute [local aesop safe cases (rule_sets := [CategoryTheory])] Opens
-- but it doesn't appear to be needed here.
open TopCat.Presheaf
namespace AlgebraicGeometry.PresheafedSpace
abbrev stalk (X : PresheafedSpace C) (x : X) : C :=
X.presheaf.stalk x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk AlgebraicGeometry.PresheafedSpace.stalk
def stalkMap {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (x : X) :
Y.stalk (α.base x) ⟶ X.stalk x :=
(stalkFunctor C (α.base x)).map α.c ≫ X.presheaf.stalkPushforward C α.base x
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map AlgebraicGeometry.PresheafedSpace.stalkMap
@[elementwise, reassoc]
theorem stalkMap_germ {X Y : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (U : Opens Y)
(x : (Opens.map α.base).obj U) :
Y.presheaf.germ ⟨α.base x.1, x.2⟩ ≫ stalkMap α ↑x = α.c.app (op U) ≫ X.presheaf.germ x := by
rw [stalkMap, stalkFunctor_map_germ_assoc, stalkPushforward_germ]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map_germ AlgebraicGeometry.PresheafedSpace.stalkMap_germ
@[simp, elementwise, reassoc]
theorem stalkMap_germ' {X Y : PresheafedSpace.{_, _, v} C}
(α : X ⟶ Y) (U : Opens Y) (x : X) (hx : α.base x ∈ U) :
Y.presheaf.germ ⟨α.base x, hx⟩ ≫ stalkMap α x = α.c.app (op U) ≫
X.presheaf.germ (U := (Opens.map α.base).obj U) ⟨x, hx⟩ :=
PresheafedSpace.stalkMap_germ α U ⟨x, hx⟩
namespace stalkMap
@[simp]
theorem id (X : PresheafedSpace.{_, _, v} C) (x : X) :
stalkMap (𝟙 X) x = 𝟙 (X.stalk x) := by
dsimp [stalkMap]
simp only [stalkPushforward.id]
erw [← map_comp]
convert (stalkFunctor C x).map_id X.presheaf
ext
simp only [id_c, id_comp, Pushforward.id_hom_app, op_obj, eqToHom_refl, map_id]
rfl
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map.id AlgebraicGeometry.PresheafedSpace.stalkMap.id
@[simp]
theorem comp {X Y Z : PresheafedSpace.{_, _, v} C} (α : X ⟶ Y) (β : Y ⟶ Z) (x : X) :
stalkMap (α ≫ β) x =
(stalkMap β (α.base x) : Z.stalk (β.base (α.base x)) ⟶ Y.stalk (α.base x)) ≫
(stalkMap α x : Y.stalk (α.base x) ⟶ X.stalk x) := by
dsimp [stalkMap, stalkFunctor, stalkPushforward]
-- We can't use `ext` here due to https://github.com/leanprover/std4/pull/159
refine colimit.hom_ext fun U => ?_
induction U with | h U => ?_
cases U
simp only [whiskeringLeft_obj_obj, comp_obj, op_obj, unop_op, OpenNhds.inclusion_obj,
ι_colimMap_assoc, pushforwardObj_obj, Opens.map_comp_obj, whiskerLeft_app, comp_c_app,
OpenNhds.map_obj, whiskerRight_app, NatTrans.id_app, map_id, colimit.ι_pre, id_comp, assoc,
colimit.ι_pre_assoc]
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map.comp AlgebraicGeometry.PresheafedSpace.stalkMap.comp
theorem congr {X Y : PresheafedSpace.{_, _, v} C} (α β : X ⟶ Y)
(h₁ : α = β) (x x' : X) (h₂ : x = x') :
stalkMap α x ≫ eqToHom (show X.stalk x = X.stalk x' by rw [h₂]) =
eqToHom (show Y.stalk (α.base x) = Y.stalk (β.base x') by rw [h₁, h₂]) ≫ stalkMap β x' := by
ext
substs h₁ h₂
simp
set_option linter.uppercaseLean3 false in
#align algebraic_geometry.PresheafedSpace.stalk_map.congr AlgebraicGeometry.PresheafedSpace.stalkMap.congr
| Mathlib/Geometry/RingedSpace/Stalks.lean | 181 | 184 | theorem congr_hom {X Y : PresheafedSpace.{_, _, v} C} (α β : X ⟶ Y) (h : α = β) (x : X) :
stalkMap α x =
eqToHom (show Y.stalk (α.base x) = Y.stalk (β.base x) by rw [h]) ≫ stalkMap β x := by |
rw [← stalkMap.congr α β h x x rfl, eqToHom_refl, Category.comp_id]
| 1 |
import Mathlib.SetTheory.Ordinal.FixedPoint
#align_import set_theory.ordinal.principal from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7"
universe u v w
noncomputable section
open Order
namespace Ordinal
-- Porting note: commented out, doesn't seem necessary
--local infixr:0 "^" => @pow Ordinal Ordinal Ordinal.hasPow
def Principal (op : Ordinal → Ordinal → Ordinal) (o : Ordinal) : Prop :=
∀ ⦃a b⦄, a < o → b < o → op a b < o
#align ordinal.principal Ordinal.Principal
| Mathlib/SetTheory/Ordinal/Principal.lean | 52 | 54 | theorem principal_iff_principal_swap {op : Ordinal → Ordinal → Ordinal} {o : Ordinal} :
Principal op o ↔ Principal (Function.swap op) o := by |
constructor <;> exact fun h a b ha hb => h hb ha
| 1 |
import Mathlib.FieldTheory.Separable
import Mathlib.FieldTheory.SplittingField.Construction
import Mathlib.Algebra.CharP.Reduced
open Function Polynomial
class PerfectRing (R : Type*) (p : ℕ) [CommSemiring R] [ExpChar R p] : Prop where
bijective_frobenius : Bijective <| frobenius R p
section PerfectRing
variable (R : Type*) (p m n : ℕ) [CommSemiring R] [ExpChar R p]
lemma PerfectRing.ofSurjective (R : Type*) (p : ℕ) [CommRing R] [ExpChar R p]
[IsReduced R] (h : Surjective <| frobenius R p) : PerfectRing R p :=
⟨frobenius_inj R p, h⟩
#align perfect_ring.of_surjective PerfectRing.ofSurjective
instance PerfectRing.ofFiniteOfIsReduced (R : Type*) [CommRing R] [ExpChar R p]
[Finite R] [IsReduced R] : PerfectRing R p :=
ofSurjective _ _ <| Finite.surjective_of_injective (frobenius_inj R p)
variable [PerfectRing R p]
@[simp]
theorem bijective_frobenius : Bijective (frobenius R p) := PerfectRing.bijective_frobenius
theorem bijective_iterateFrobenius : Bijective (iterateFrobenius R p n) :=
coe_iterateFrobenius R p n ▸ (bijective_frobenius R p).iterate n
@[simp]
theorem injective_frobenius : Injective (frobenius R p) := (bijective_frobenius R p).1
@[simp]
theorem surjective_frobenius : Surjective (frobenius R p) := (bijective_frobenius R p).2
@[simps! apply]
noncomputable def frobeniusEquiv : R ≃+* R :=
RingEquiv.ofBijective (frobenius R p) PerfectRing.bijective_frobenius
#align frobenius_equiv frobeniusEquiv
@[simp]
theorem coe_frobeniusEquiv : ⇑(frobeniusEquiv R p) = frobenius R p := rfl
#align coe_frobenius_equiv coe_frobeniusEquiv
theorem frobeniusEquiv_def (x : R) : frobeniusEquiv R p x = x ^ p := rfl
@[simps! apply]
noncomputable def iterateFrobeniusEquiv : R ≃+* R :=
RingEquiv.ofBijective (iterateFrobenius R p n) (bijective_iterateFrobenius R p n)
@[simp]
theorem coe_iterateFrobeniusEquiv : ⇑(iterateFrobeniusEquiv R p n) = iterateFrobenius R p n := rfl
theorem iterateFrobeniusEquiv_def (x : R) : iterateFrobeniusEquiv R p n x = x ^ p ^ n := rfl
theorem iterateFrobeniusEquiv_add_apply (x : R) : iterateFrobeniusEquiv R p (m + n) x =
iterateFrobeniusEquiv R p m (iterateFrobeniusEquiv R p n x) :=
iterateFrobenius_add_apply R p m n x
theorem iterateFrobeniusEquiv_add : iterateFrobeniusEquiv R p (m + n) =
(iterateFrobeniusEquiv R p n).trans (iterateFrobeniusEquiv R p m) :=
RingEquiv.ext (iterateFrobeniusEquiv_add_apply R p m n)
theorem iterateFrobeniusEquiv_symm_add_apply (x : R) : (iterateFrobeniusEquiv R p (m + n)).symm x =
(iterateFrobeniusEquiv R p m).symm ((iterateFrobeniusEquiv R p n).symm x) :=
(iterateFrobeniusEquiv R p (m + n)).injective <| by rw [RingEquiv.apply_symm_apply, add_comm,
iterateFrobeniusEquiv_add_apply, RingEquiv.apply_symm_apply, RingEquiv.apply_symm_apply]
theorem iterateFrobeniusEquiv_symm_add : (iterateFrobeniusEquiv R p (m + n)).symm =
(iterateFrobeniusEquiv R p n).symm.trans (iterateFrobeniusEquiv R p m).symm :=
RingEquiv.ext (iterateFrobeniusEquiv_symm_add_apply R p m n)
theorem iterateFrobeniusEquiv_zero_apply (x : R) : iterateFrobeniusEquiv R p 0 x = x := by
rw [iterateFrobeniusEquiv_def, pow_zero, pow_one]
| Mathlib/FieldTheory/Perfect.lean | 116 | 117 | theorem iterateFrobeniusEquiv_one_apply (x : R) : iterateFrobeniusEquiv R p 1 x = x ^ p := by |
rw [iterateFrobeniusEquiv_def, pow_one]
| 1 |
import Batteries.Data.Array.Lemmas
namespace ByteArray
@[ext] theorem ext : {a b : ByteArray} → a.data = b.data → a = b
| ⟨_⟩, ⟨_⟩, rfl => rfl
theorem getElem_eq_data_getElem (a : ByteArray) (h : i < a.size) : a[i] = a.data[i] := rfl
@[simp] theorem uset_eq_set (a : ByteArray) {i : USize} (h : i.toNat < a.size) (v : UInt8) :
a.uset i v h = a.set ⟨i.toNat, h⟩ v := rfl
@[simp] theorem mkEmpty_data (cap) : (mkEmpty cap).data = #[] := rfl
@[simp] theorem empty_data : empty.data = #[] := rfl
@[simp] theorem size_empty : empty.size = 0 := rfl
@[simp] theorem push_data (a : ByteArray) (b : UInt8) : (a.push b).data = a.data.push b := rfl
@[simp] theorem size_push (a : ByteArray) (b : UInt8) : (a.push b).size = a.size + 1 :=
Array.size_push ..
@[simp] theorem get_push_eq (a : ByteArray) (x : UInt8) : (a.push x)[a.size] = x :=
Array.get_push_eq ..
theorem get_push_lt (a : ByteArray) (x : UInt8) (i : Nat) (h : i < a.size) :
(a.push x)[i]'(size_push .. ▸ Nat.lt_succ_of_lt h) = a[i] :=
Array.get_push_lt ..
@[simp] theorem set_data (a : ByteArray) (i : Fin a.size) (v : UInt8) :
(a.set i v).data = a.data.set i v := rfl
@[simp] theorem size_set (a : ByteArray) (i : Fin a.size) (v : UInt8) :
(a.set i v).size = a.size :=
Array.size_set ..
@[simp] theorem get_set_eq (a : ByteArray) (i : Fin a.size) (v : UInt8) : (a.set i v)[i.val] = v :=
Array.get_set_eq ..
theorem get_set_ne (a : ByteArray) (i : Fin a.size) (v : UInt8) (hj : j < a.size) (h : i.val ≠ j) :
(a.set i v)[j]'(a.size_set .. ▸ hj) = a[j] :=
Array.get_set_ne (h:=h) ..
theorem set_set (a : ByteArray) (i : Fin a.size) (v v' : UInt8) :
(a.set i v).set ⟨i, by simp [i.2]⟩ v' = a.set i v' :=
ByteArray.ext <| Array.set_set ..
@[simp] theorem copySlice_data (a i b j len exact) :
(copySlice a i b j len exact).data = b.data.extract 0 j ++ a.data.extract i (i + len)
++ b.data.extract (j + min len (a.data.size - i)) b.data.size := rfl
@[simp] theorem append_eq (a b) : ByteArray.append a b = a ++ b := rfl
@[simp] theorem append_data (a b : ByteArray) : (a ++ b).data = a.data ++ b.data := by
rw [←append_eq]; simp [ByteArray.append, size]
rw [Array.extract_empty_of_stop_le_start (h:=Nat.le_add_right ..), Array.append_nil]
theorem size_append (a b : ByteArray) : (a ++ b).size = a.size + b.size := by
simp only [size, append_eq, append_data]; exact Array.size_append ..
| .lake/packages/batteries/Batteries/Data/ByteArray.lean | 79 | 82 | theorem get_append_left {a b : ByteArray} (hlt : i < a.size)
(h : i < (a ++ b).size := size_append .. ▸ Nat.lt_of_lt_of_le hlt (Nat.le_add_right ..)) :
(a ++ b)[i] = a[i] := by |
simp [getElem_eq_data_getElem]; exact Array.get_append_left hlt
| 1 |
import Batteries.Tactic.Alias
import Batteries.Data.Nat.Basic
namespace Nat
@[simp] theorem recAux_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAux zero succ 0 = zero := rfl
theorem recAux_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAux zero succ (n+1) = succ n (Nat.recAux zero succ n) := rfl
@[simp] theorem recAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) :
Nat.recAuxOn 0 zero succ = zero := rfl
theorem recAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive n → motive (n+1)) (n) :
Nat.recAuxOn (n+1) zero succ = succ n (Nat.recAuxOn n zero succ) := rfl
@[simp] theorem casesAuxOn_zero {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) :
Nat.casesAuxOn 0 zero succ = zero := rfl
theorem casesAuxOn_succ {motive : Nat → Sort _} (zero : motive 0)
(succ : ∀ n, motive (n+1)) (n) :
Nat.casesAuxOn (n+1) zero succ = succ n := rfl
| .lake/packages/batteries/Batteries/Data/Nat/Lemmas.lean | 44 | 46 | theorem strongRec_eq {motive : Nat → Sort _} (ind : ∀ n, (∀ m, m < n → motive m) → motive n)
(t : Nat) : Nat.strongRec ind t = ind t fun m _ => Nat.strongRec ind m := by |
conv => lhs; unfold Nat.strongRec
| 1 |
import Mathlib.Topology.ContinuousOn
#align_import topology.algebra.order.left_right from "leanprover-community/mathlib"@"bcfa726826abd57587355b4b5b7e78ad6527b7e4"
open Set Filter Topology
section TopologicalSpace
variable {α β : Type*} [TopologicalSpace α] [LinearOrder α] [TopologicalSpace β]
theorem nhds_left_sup_nhds_right (a : α) : 𝓝[≤] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iic_union_Ici, nhdsWithin_univ]
#align nhds_left_sup_nhds_right nhds_left_sup_nhds_right
theorem nhds_left'_sup_nhds_right (a : α) : 𝓝[<] a ⊔ 𝓝[≥] a = 𝓝 a := by
rw [← nhdsWithin_union, Iio_union_Ici, nhdsWithin_univ]
#align nhds_left'_sup_nhds_right nhds_left'_sup_nhds_right
| Mathlib/Topology/Order/LeftRight.lean | 119 | 120 | theorem nhds_left_sup_nhds_right' (a : α) : 𝓝[≤] a ⊔ 𝓝[>] a = 𝓝 a := by |
rw [← nhdsWithin_union, Iic_union_Ioi, nhdsWithin_univ]
| 1 |
import Mathlib.Algebra.Homology.ShortComplex.ModuleCat
import Mathlib.RepresentationTheory.GroupCohomology.Basic
import Mathlib.RepresentationTheory.Invariants
universe v u
noncomputable section
open CategoryTheory Limits Representation
variable {k G : Type u} [CommRing k] [Group G] (A : Rep k G)
namespace groupCohomology
section IsMulCocycle
section
variable {G M : Type*} [Mul G] [CommGroup M] [SMul G M]
def IsMulOneCocycle (f : G → M) : Prop := ∀ g h : G, f (g * h) = g • f h * f g
def IsMulTwoCocycle (f : G × G → M) : Prop :=
∀ g h j : G, f (g * h, j) * f (g, h) = g • (f (h, j)) * f (g, h * j)
end
section
variable {G M : Type*} [Monoid G] [CommGroup M] [MulAction G M]
| Mathlib/RepresentationTheory/GroupCohomology/LowDegree.lean | 524 | 526 | theorem map_one_of_isMulOneCocycle {f : G → M} (hf : IsMulOneCocycle f) :
f 1 = 1 := by |
simpa only [mul_one, one_smul, self_eq_mul_right] using hf 1 1
| 1 |
import Mathlib.Topology.Basic
#align_import topology.nhds_set from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
open Set Filter Topology
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {f : Filter X}
{s t s₁ s₂ t₁ t₂ : Set X} {x : X}
theorem nhdsSet_diagonal (X) [TopologicalSpace (X × X)] :
𝓝ˢ (diagonal X) = ⨆ (x : X), 𝓝 (x, x) := by
rw [nhdsSet, ← range_diag, ← range_comp]
rfl
#align nhds_set_diagonal nhdsSet_diagonal
theorem mem_nhdsSet_iff_forall : s ∈ 𝓝ˢ t ↔ ∀ x : X, x ∈ t → s ∈ 𝓝 x := by
simp_rw [nhdsSet, Filter.mem_sSup, forall_mem_image]
#align mem_nhds_set_iff_forall mem_nhdsSet_iff_forall
lemma nhdsSet_le : 𝓝ˢ s ≤ f ↔ ∀ x ∈ s, 𝓝 x ≤ f := by simp [nhdsSet]
theorem bUnion_mem_nhdsSet {t : X → Set X} (h : ∀ x ∈ s, t x ∈ 𝓝 x) : (⋃ x ∈ s, t x) ∈ 𝓝ˢ s :=
mem_nhdsSet_iff_forall.2 fun x hx => mem_of_superset (h x hx) <|
subset_iUnion₂ (s := fun x _ => t x) x hx -- Porting note: fails to find `s`
#align bUnion_mem_nhds_set bUnion_mem_nhdsSet
theorem subset_interior_iff_mem_nhdsSet : s ⊆ interior t ↔ t ∈ 𝓝ˢ s := by
simp_rw [mem_nhdsSet_iff_forall, subset_interior_iff_nhds]
#align subset_interior_iff_mem_nhds_set subset_interior_iff_mem_nhdsSet
theorem disjoint_principal_nhdsSet : Disjoint (𝓟 s) (𝓝ˢ t) ↔ Disjoint (closure s) t := by
rw [disjoint_principal_left, ← subset_interior_iff_mem_nhdsSet, interior_compl,
subset_compl_iff_disjoint_left]
theorem disjoint_nhdsSet_principal : Disjoint (𝓝ˢ s) (𝓟 t) ↔ Disjoint s (closure t) := by
rw [disjoint_comm, disjoint_principal_nhdsSet, disjoint_comm]
theorem mem_nhdsSet_iff_exists : s ∈ 𝓝ˢ t ↔ ∃ U : Set X, IsOpen U ∧ t ⊆ U ∧ U ⊆ s := by
rw [← subset_interior_iff_mem_nhdsSet, subset_interior_iff]
#align mem_nhds_set_iff_exists mem_nhdsSet_iff_exists
theorem eventually_nhdsSet_iff_exists {p : X → Prop} :
(∀ᶠ x in 𝓝ˢ s, p x) ↔ ∃ t, IsOpen t ∧ s ⊆ t ∧ ∀ x, x ∈ t → p x :=
mem_nhdsSet_iff_exists
theorem eventually_nhdsSet_iff_forall {p : X → Prop} :
(∀ᶠ x in 𝓝ˢ s, p x) ↔ ∀ x, x ∈ s → ∀ᶠ y in 𝓝 x, p y :=
mem_nhdsSet_iff_forall
theorem hasBasis_nhdsSet (s : Set X) : (𝓝ˢ s).HasBasis (fun U => IsOpen U ∧ s ⊆ U) fun U => U :=
⟨fun t => by simp [mem_nhdsSet_iff_exists, and_assoc]⟩
#align has_basis_nhds_set hasBasis_nhdsSet
@[simp]
lemma lift'_nhdsSet_interior (s : Set X) : (𝓝ˢ s).lift' interior = 𝓝ˢ s :=
(hasBasis_nhdsSet s).lift'_interior_eq_self fun _ ↦ And.left
lemma Filter.HasBasis.nhdsSet_interior {ι : Sort*} {p : ι → Prop} {s : ι → Set X} {t : Set X}
(h : (𝓝ˢ t).HasBasis p s) : (𝓝ˢ t).HasBasis p (interior <| s ·) :=
lift'_nhdsSet_interior t ▸ h.lift'_interior
theorem IsOpen.mem_nhdsSet (hU : IsOpen s) : s ∈ 𝓝ˢ t ↔ t ⊆ s := by
rw [← subset_interior_iff_mem_nhdsSet, hU.interior_eq]
#align is_open.mem_nhds_set IsOpen.mem_nhdsSet
theorem IsOpen.mem_nhdsSet_self (ho : IsOpen s) : s ∈ 𝓝ˢ s := ho.mem_nhdsSet.mpr Subset.rfl
theorem principal_le_nhdsSet : 𝓟 s ≤ 𝓝ˢ s := fun _s hs =>
(subset_interior_iff_mem_nhdsSet.mpr hs).trans interior_subset
#align principal_le_nhds_set principal_le_nhdsSet
theorem subset_of_mem_nhdsSet (h : t ∈ 𝓝ˢ s) : s ⊆ t := principal_le_nhdsSet h
theorem Filter.Eventually.self_of_nhdsSet {p : X → Prop} (h : ∀ᶠ x in 𝓝ˢ s, p x) : ∀ x ∈ s, p x :=
principal_le_nhdsSet h
nonrec theorem Filter.EventuallyEq.self_of_nhdsSet {f g : X → Y} (h : f =ᶠ[𝓝ˢ s] g) : EqOn f g s :=
h.self_of_nhdsSet
@[simp]
theorem nhdsSet_eq_principal_iff : 𝓝ˢ s = 𝓟 s ↔ IsOpen s := by
rw [← principal_le_nhdsSet.le_iff_eq, le_principal_iff, mem_nhdsSet_iff_forall,
isOpen_iff_mem_nhds]
#align nhds_set_eq_principal_iff nhdsSet_eq_principal_iff
alias ⟨_, IsOpen.nhdsSet_eq⟩ := nhdsSet_eq_principal_iff
#align is_open.nhds_set_eq IsOpen.nhdsSet_eq
@[simp]
theorem nhdsSet_interior : 𝓝ˢ (interior s) = 𝓟 (interior s) :=
isOpen_interior.nhdsSet_eq
#align nhds_set_interior nhdsSet_interior
@[simp]
| Mathlib/Topology/NhdsSet.lean | 124 | 124 | theorem nhdsSet_singleton : 𝓝ˢ {x} = 𝓝 x := by | simp [nhdsSet]
| 1 |
import Mathlib.Analysis.Convex.Cone.Basic
import Mathlib.Analysis.InnerProductSpace.Projection
#align_import analysis.convex.cone.dual from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open Set LinearMap
open scoped Classical
open Pointwise
variable {𝕜 E F G : Type*}
section Dual
variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℝ H] (s t : Set H)
open RealInnerProductSpace
def Set.innerDualCone (s : Set H) : ConvexCone ℝ H where
carrier := { y | ∀ x ∈ s, 0 ≤ ⟪x, y⟫ }
smul_mem' c hc y hy x hx := by
rw [real_inner_smul_right]
exact mul_nonneg hc.le (hy x hx)
add_mem' u hu v hv x hx := by
rw [inner_add_right]
exact add_nonneg (hu x hx) (hv x hx)
#align set.inner_dual_cone Set.innerDualCone
@[simp]
theorem mem_innerDualCone (y : H) (s : Set H) : y ∈ s.innerDualCone ↔ ∀ x ∈ s, 0 ≤ ⟪x, y⟫ :=
Iff.rfl
#align mem_inner_dual_cone mem_innerDualCone
@[simp]
theorem innerDualCone_empty : (∅ : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ _ => False.elim
#align inner_dual_cone_empty innerDualCone_empty
@[simp]
theorem innerDualCone_zero : (0 : Set H).innerDualCone = ⊤ :=
eq_top_iff.mpr fun _ _ y (hy : y = 0) => hy.symm ▸ (inner_zero_left _).ge
#align inner_dual_cone_zero innerDualCone_zero
@[simp]
theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by
suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by
apply SetLike.coe_injective
exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩
exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _)
#align inner_dual_cone_univ innerDualCone_univ
theorem innerDualCone_le_innerDualCone (h : t ⊆ s) : s.innerDualCone ≤ t.innerDualCone :=
fun _ hy x hx => hy x (h hx)
#align inner_dual_cone_le_inner_dual_cone innerDualCone_le_innerDualCone
theorem pointed_innerDualCone : s.innerDualCone.Pointed := fun x _ => by rw [inner_zero_right]
#align pointed_inner_dual_cone pointed_innerDualCone
theorem innerDualCone_singleton (x : H) :
({x} : Set H).innerDualCone = (ConvexCone.positive ℝ ℝ).comap (innerₛₗ ℝ x) :=
ConvexCone.ext fun _ => forall_eq
#align inner_dual_cone_singleton innerDualCone_singleton
theorem innerDualCone_union (s t : Set H) :
(s ∪ t).innerDualCone = s.innerDualCone ⊓ t.innerDualCone :=
le_antisymm (le_inf (fun _ hx _ hy => hx _ <| Or.inl hy) fun _ hx _ hy => hx _ <| Or.inr hy)
fun _ hx _ => Or.rec (hx.1 _) (hx.2 _)
#align inner_dual_cone_union innerDualCone_union
| Mathlib/Analysis/Convex/Cone/InnerDual.lean | 105 | 107 | theorem innerDualCone_insert (x : H) (s : Set H) :
(insert x s).innerDualCone = Set.innerDualCone {x} ⊓ s.innerDualCone := by |
rw [insert_eq, innerDualCone_union]
| 1 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "ℤ[i]" => GaussianInt
namespace GaussianInt
instance : Repr ℤ[i] :=
⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩
instance instCommRing : CommRing ℤ[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : ℤ[i] →+* ℂ :=
Zsqrtd.lift ⟨I, by simp⟩
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe ℤ[i] ℂ :=
⟨toComplex⟩
theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
@[simp]
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 93 | 93 | theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by | simp [toComplex_def]
| 1 |
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Order.LatticeIntervals
import Mathlib.Order.Interval.Set.OrdConnected
#align_import order.complete_lattice_intervals from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
open scoped Classical
open Set
variable {ι : Sort*} {α : Type*} (s : Set α)
namespace Set.Iic
variable [CompleteLattice α] {a : α}
instance instCompleteLattice : CompleteLattice (Iic a) where
sSup S := ⟨sSup ((↑) '' S), by simpa using fun b hb _ ↦ hb⟩
sInf S := ⟨a ⊓ sInf ((↑) '' S), by simp⟩
le_sSup S b hb := le_sSup <| mem_image_of_mem Subtype.val hb
sSup_le S b hb := sSup_le <| fun c' ⟨c, hc, hc'⟩ ↦ hc' ▸ hb c hc
sInf_le S b hb := inf_le_of_right_le <| sInf_le <| mem_image_of_mem Subtype.val hb
le_sInf S b hb := le_inf_iff.mpr ⟨b.property, le_sInf fun d' ⟨d, hd, hd'⟩ ↦ hd' ▸ hb d hd⟩
le_top := by simp
bot_le := by simp
variable (S : Set <| Iic a) (f : ι → Iic a) (p : ι → Prop)
@[simp] theorem coe_sSup : (↑(sSup S) : α) = sSup ((↑) '' S) := rfl
@[simp] theorem coe_iSup : (↑(⨆ i, f i) : α) = ⨆ i, (f i : α) := by
rw [iSup, coe_sSup]; congr; ext; simp
| Mathlib/Order/CompleteLatticeIntervals.lean | 265 | 265 | theorem coe_biSup : (↑(⨆ i, ⨆ (_ : p i), f i) : α) = ⨆ i, ⨆ (_ : p i), (f i : α) := by | simp
| 1 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Ring.Regular
import Mathlib.Tactic.Common
#align_import algebra.gcd_monoid.basic from "leanprover-community/mathlib"@"550b58538991c8977703fdeb7c9d51a5aa27df11"
variable {α : Type*}
-- Porting note: mathlib3 had a `@[protect_proj]` here, but adding `protected` to all the fields
-- adds unnecessary clutter to later code
class NormalizationMonoid (α : Type*) [CancelCommMonoidWithZero α] where
normUnit : α → αˣ
normUnit_zero : normUnit 0 = 1
normUnit_mul : ∀ {a b}, a ≠ 0 → b ≠ 0 → normUnit (a * b) = normUnit a * normUnit b
normUnit_coe_units : ∀ u : αˣ, normUnit u = u⁻¹
#align normalization_monoid NormalizationMonoid
export NormalizationMonoid (normUnit normUnit_zero normUnit_mul normUnit_coe_units)
attribute [simp] normUnit_coe_units normUnit_zero normUnit_mul
section NormalizationMonoid
variable [CancelCommMonoidWithZero α] [NormalizationMonoid α]
@[simp]
theorem normUnit_one : normUnit (1 : α) = 1 :=
normUnit_coe_units 1
#align norm_unit_one normUnit_one
-- Porting note (#11083): quite slow. Improve performance?
def normalize : α →*₀ α where
toFun x := x * normUnit x
map_zero' := by
simp only [normUnit_zero]
exact mul_one (0:α)
map_one' := by dsimp only; rw [normUnit_one, one_mul]; rfl
map_mul' x y :=
(by_cases fun hx : x = 0 => by dsimp only; rw [hx, zero_mul, zero_mul, zero_mul]) fun hx =>
(by_cases fun hy : y = 0 => by dsimp only; rw [hy, mul_zero, zero_mul, mul_zero]) fun hy => by
simp only [normUnit_mul hx hy, Units.val_mul]; simp only [mul_assoc, mul_left_comm y]
#align normalize normalize
theorem associated_normalize (x : α) : Associated x (normalize x) :=
⟨_, rfl⟩
#align associated_normalize associated_normalize
theorem normalize_associated (x : α) : Associated (normalize x) x :=
(associated_normalize _).symm
#align normalize_associated normalize_associated
theorem associated_normalize_iff {x y : α} : Associated x (normalize y) ↔ Associated x y :=
⟨fun h => h.trans (normalize_associated y), fun h => h.trans (associated_normalize y)⟩
#align associated_normalize_iff associated_normalize_iff
theorem normalize_associated_iff {x y : α} : Associated (normalize x) y ↔ Associated x y :=
⟨fun h => (associated_normalize _).trans h, fun h => (normalize_associated _).trans h⟩
#align normalize_associated_iff normalize_associated_iff
theorem Associates.mk_normalize (x : α) : Associates.mk (normalize x) = Associates.mk x :=
Associates.mk_eq_mk_iff_associated.2 (normalize_associated _)
#align associates.mk_normalize Associates.mk_normalize
@[simp]
theorem normalize_apply (x : α) : normalize x = x * normUnit x :=
rfl
#align normalize_apply normalize_apply
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_zero : normalize (0 : α) = 0 :=
normalize.map_zero
#align normalize_zero normalize_zero
-- Porting note (#10618): `simp` can prove this
-- @[simp]
theorem normalize_one : normalize (1 : α) = 1 :=
normalize.map_one
#align normalize_one normalize_one
| Mathlib/Algebra/GCDMonoid/Basic.lean | 148 | 148 | theorem normalize_coe_units (u : αˣ) : normalize (u : α) = 1 := by | simp
| 1 |
import Mathlib.Data.List.Basic
#align_import data.list.lattice from "leanprover-community/mathlib"@"dd71334db81d0bd444af1ee339a29298bef40734"
open Nat
namespace List
variable {α : Type*} {l l₁ l₂ : List α} {p : α → Prop} {a : α}
variable [DecidableEq α]
section BagInter
@[simp]
| Mathlib/Data/List/Lattice.lean | 195 | 195 | theorem nil_bagInter (l : List α) : [].bagInter l = [] := by | cases l <;> rfl
| 1 |
import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
import Mathlib.NumberTheory.Liouville.Basic
import Mathlib.Topology.Instances.Irrational
#align_import number_theory.liouville.liouville_with from "leanprover-community/mathlib"@"0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8"
open Filter Metric Real Set
open scoped Filter Topology
def LiouvilleWith (p x : ℝ) : Prop :=
∃ C, ∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p
#align liouville_with LiouvilleWith
theorem liouvilleWith_one (x : ℝ) : LiouvilleWith 1 x := by
use 2
refine ((eventually_gt_atTop 0).mono fun n hn => ?_).frequently
have hn' : (0 : ℝ) < n := by simpa
have : x < ↑(⌊x * ↑n⌋ + 1) / ↑n := by
rw [lt_div_iff hn', Int.cast_add, Int.cast_one];
exact Int.lt_floor_add_one _
refine ⟨⌊x * n⌋ + 1, this.ne, ?_⟩
rw [abs_sub_comm, abs_of_pos (sub_pos.2 this), rpow_one, sub_lt_iff_lt_add',
add_div_eq_mul_add_div _ _ hn'.ne']
gcongr
calc _ ≤ x * n + 1 := by push_cast; gcongr; apply Int.floor_le
_ < x * n + 2 := by linarith
#align liouville_with_one liouvilleWith_one
namespace LiouvilleWith
variable {p q x y : ℝ} {r : ℚ} {m : ℤ} {n : ℕ}
theorem exists_pos (h : LiouvilleWith p x) :
∃ (C : ℝ) (_h₀ : 0 < C),
∃ᶠ n : ℕ in atTop, 1 ≤ n ∧ ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < C / n ^ p := by
rcases h with ⟨C, hC⟩
refine ⟨max C 1, zero_lt_one.trans_le <| le_max_right _ _, ?_⟩
refine ((eventually_ge_atTop 1).and_frequently hC).mono ?_
rintro n ⟨hle, m, hne, hlt⟩
refine ⟨hle, m, hne, hlt.trans_le ?_⟩
gcongr
apply le_max_left
#align liouville_with.exists_pos LiouvilleWith.exists_pos
theorem mono (h : LiouvilleWith p x) (hle : q ≤ p) : LiouvilleWith q x := by
rcases h.exists_pos with ⟨C, hC₀, hC⟩
refine ⟨C, hC.mono ?_⟩; rintro n ⟨hn, m, hne, hlt⟩
refine ⟨m, hne, hlt.trans_le <| ?_⟩
gcongr
exact_mod_cast hn
#align liouville_with.mono LiouvilleWith.mono
theorem frequently_lt_rpow_neg (h : LiouvilleWith p x) (hlt : q < p) :
∃ᶠ n : ℕ in atTop, ∃ m : ℤ, x ≠ m / n ∧ |x - m / n| < n ^ (-q) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
have : ∀ᶠ n : ℕ in atTop, C < n ^ (p - q) := by
simpa only [(· ∘ ·), neg_sub, one_div] using
((tendsto_rpow_atTop (sub_pos.2 hlt)).comp tendsto_natCast_atTop_atTop).eventually
(eventually_gt_atTop C)
refine (this.and_frequently hC).mono ?_
rintro n ⟨hnC, hn, m, hne, hlt⟩
replace hn : (0 : ℝ) < n := Nat.cast_pos.2 hn
refine ⟨m, hne, hlt.trans <| (div_lt_iff <| rpow_pos_of_pos hn _).2 ?_⟩
rwa [mul_comm, ← rpow_add hn, ← sub_eq_add_neg]
#align liouville_with.frequently_lt_rpow_neg LiouvilleWith.frequently_lt_rpow_neg
theorem mul_rat (h : LiouvilleWith p x) (hr : r ≠ 0) : LiouvilleWith p (x * r) := by
rcases h.exists_pos with ⟨C, _hC₀, hC⟩
refine ⟨r.den ^ p * (|r| * C), (tendsto_id.nsmul_atTop r.pos).frequently (hC.mono ?_)⟩
rintro n ⟨_hn, m, hne, hlt⟩
have A : (↑(r.num * m) : ℝ) / ↑(r.den • id n) = m / n * r := by
simp [← div_mul_div_comm, ← r.cast_def, mul_comm]
refine ⟨r.num * m, ?_, ?_⟩
· rw [A]; simp [hne, hr]
· rw [A, ← sub_mul, abs_mul]
simp only [smul_eq_mul, id, Nat.cast_mul]
calc _ < C / ↑n ^ p * |↑r| := by gcongr
_ = ↑r.den ^ p * (↑|r| * C) / (↑r.den * ↑n) ^ p := ?_
rw [mul_rpow, mul_div_mul_left, mul_comm, mul_div_assoc]
· simp only [Rat.cast_abs, le_refl]
all_goals positivity
#align liouville_with.mul_rat LiouvilleWith.mul_rat
theorem mul_rat_iff (hr : r ≠ 0) : LiouvilleWith p (x * r) ↔ LiouvilleWith p x :=
⟨fun h => by
simpa only [mul_assoc, ← Rat.cast_mul, mul_inv_cancel hr, Rat.cast_one, mul_one] using
h.mul_rat (inv_ne_zero hr),
fun h => h.mul_rat hr⟩
#align liouville_with.mul_rat_iff LiouvilleWith.mul_rat_iff
| Mathlib/NumberTheory/Liouville/LiouvilleWith.lean | 142 | 143 | theorem rat_mul_iff (hr : r ≠ 0) : LiouvilleWith p (r * x) ↔ LiouvilleWith p x := by |
rw [mul_comm, mul_rat_iff hr]
| 1 |
import Mathlib.RingTheory.Derivation.Basic
import Mathlib.RingTheory.Ideal.QuotientOperations
#align_import ring_theory.derivation.to_square_zero from "leanprover-community/mathlib"@"b608348ffaeb7f557f2fd46876037abafd326ff3"
section ToSquareZero
universe u v w
variable {R : Type u} {A : Type v} {B : Type w} [CommSemiring R] [CommSemiring A] [CommRing B]
variable [Algebra R A] [Algebra R B] (I : Ideal B) (hI : I ^ 2 = ⊥)
def diffToIdealOfQuotientCompEq (f₁ f₂ : A →ₐ[R] B)
(e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) : A →ₗ[R] I :=
LinearMap.codRestrict (I.restrictScalars _) (f₁.toLinearMap - f₂.toLinearMap) (by
intro x
change f₁ x - f₂ x ∈ I
rw [← Ideal.Quotient.eq, ← Ideal.Quotient.mkₐ_eq_mk R, ← AlgHom.comp_apply, e]
rfl)
#align diff_to_ideal_of_quotient_comp_eq diffToIdealOfQuotientCompEq
@[simp]
theorem diffToIdealOfQuotientCompEq_apply (f₁ f₂ : A →ₐ[R] B)
(e : (Ideal.Quotient.mkₐ R I).comp f₁ = (Ideal.Quotient.mkₐ R I).comp f₂) (x : A) :
((diffToIdealOfQuotientCompEq I f₁ f₂ e) x : B) = f₁ x - f₂ x :=
rfl
#align diff_to_ideal_of_quotient_comp_eq_apply diffToIdealOfQuotientCompEq_apply
variable [Algebra A B] [IsScalarTower R A B]
def derivationToSquareZeroOfLift (f : A →ₐ[R] B)
(e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) :
Derivation R A I := by
refine
{ diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B) ?_ with
map_one_eq_zero' := ?_
leibniz' := ?_ }
· rw [e]; ext; rfl
· ext; change f 1 - algebraMap A B 1 = 0; rw [map_one, map_one, sub_self]
· intro x y
let F := diffToIdealOfQuotientCompEq I f (IsScalarTower.toAlgHom R A B) (by rw [e]; ext; rfl)
have : (f x - algebraMap A B x) * (f y - algebraMap A B y) = 0 := by
rw [← Ideal.mem_bot, ← hI, pow_two]
convert Ideal.mul_mem_mul (F x).2 (F y).2 using 1
ext
dsimp only [Submodule.coe_add, Submodule.coe_mk, LinearMap.coe_mk,
diffToIdealOfQuotientCompEq_apply, Submodule.coe_smul_of_tower, IsScalarTower.coe_toAlgHom',
LinearMap.toFun_eq_coe]
simp only [map_mul, sub_mul, mul_sub, Algebra.smul_def] at this ⊢
rw [sub_eq_iff_eq_add, sub_eq_iff_eq_add] at this
simp only [LinearMap.coe_toAddHom, diffToIdealOfQuotientCompEq_apply, map_mul, this,
IsScalarTower.coe_toAlgHom']
ring
#align derivation_to_square_zero_of_lift derivationToSquareZeroOfLift
theorem derivationToSquareZeroOfLift_apply (f : A →ₐ[R] B)
(e : (Ideal.Quotient.mkₐ R I).comp f = IsScalarTower.toAlgHom R A (B ⧸ I)) (x : A) :
(derivationToSquareZeroOfLift I hI f e x : B) = f x - algebraMap A B x :=
rfl
#align derivation_to_square_zero_of_lift_apply derivationToSquareZeroOfLift_apply
@[simps (config := .lemmasOnly)]
def liftOfDerivationToSquareZero (f : Derivation R A I) : A →ₐ[R] B :=
{ ((I.restrictScalars R).subtype.comp f.toLinearMap + (IsScalarTower.toAlgHom R A B).toLinearMap :
A →ₗ[R] B) with
toFun := fun x => f x + algebraMap A B x
map_one' := by
dsimp
-- Note: added the `(algebraMap _ _)` hint because otherwise it would match `f 1`
rw [map_one (algebraMap _ _), f.map_one_eq_zero, Submodule.coe_zero, zero_add]
map_mul' := fun x y => by
have : (f x : B) * f y = 0 := by
rw [← Ideal.mem_bot, ← hI, pow_two]
convert Ideal.mul_mem_mul (f x).2 (f y).2 using 1
simp only [map_mul, f.leibniz, add_mul, mul_add, Submodule.coe_add,
Submodule.coe_smul_of_tower, Algebra.smul_def, this]
ring
commutes' := fun r => by
simp only [Derivation.map_algebraMap, eq_self_iff_true, zero_add, Submodule.coe_zero, ←
IsScalarTower.algebraMap_apply R A B r]
map_zero' := ((I.restrictScalars R).subtype.comp f.toLinearMap +
(IsScalarTower.toAlgHom R A B).toLinearMap).map_zero }
#align lift_of_derivation_to_square_zero liftOfDerivationToSquareZero
-- @[simp] -- Porting note: simp normal form is `liftOfDerivationToSquareZero_mk_apply'`
theorem liftOfDerivationToSquareZero_mk_apply (d : Derivation R A I) (x : A) :
Ideal.Quotient.mk I (liftOfDerivationToSquareZero I hI d x) = algebraMap A (B ⧸ I) x := by
rw [liftOfDerivationToSquareZero_apply, map_add, Ideal.Quotient.eq_zero_iff_mem.mpr (d x).prop,
zero_add]
rfl
#align lift_of_derivation_to_square_zero_mk_apply liftOfDerivationToSquareZero_mk_apply
@[simp]
| Mathlib/RingTheory/Derivation/ToSquareZero.lean | 114 | 116 | theorem liftOfDerivationToSquareZero_mk_apply' (d : Derivation R A I) (x : A) :
(Ideal.Quotient.mk I) (d x) + (algebraMap A (B ⧸ I)) x = algebraMap A (B ⧸ I) x := by |
simp only [Ideal.Quotient.eq_zero_iff_mem.mpr (d x).prop, zero_add]
| 1 |
import Batteries.Data.RBMap.Alter
import Batteries.Data.List.Lemmas
namespace Batteries
namespace RBNode
open RBColor
attribute [simp] fold foldl foldr Any forM foldlM Ordered
@[simp] theorem min?_reverse (t : RBNode α) : t.reverse.min? = t.max? := by
unfold RBNode.max?; split <;> simp [RBNode.min?]
unfold RBNode.min?; rw [min?.match_1.eq_3]
· apply min?_reverse
· simpa [reverse_eq_iff]
@[simp] theorem max?_reverse (t : RBNode α) : t.reverse.max? = t.min? := by
rw [← min?_reverse, reverse_reverse]
@[simp] theorem mem_nil {x} : ¬x ∈ (.nil : RBNode α) := by simp [(·∈·), EMem]
@[simp] theorem mem_node {y c a x b} :
y ∈ (.node c a x b : RBNode α) ↔ y = x ∨ y ∈ a ∨ y ∈ b := by simp [(·∈·), EMem]
theorem All_def {t : RBNode α} : t.All p ↔ ∀ x ∈ t, p x := by
induction t <;> simp [or_imp, forall_and, *]
theorem Any_def {t : RBNode α} : t.Any p ↔ ∃ x ∈ t, p x := by
induction t <;> simp [or_and_right, exists_or, *]
theorem memP_def : MemP cut t ↔ ∃ x ∈ t, cut x = .eq := Any_def
theorem mem_def : Mem cmp x t ↔ ∃ y ∈ t, cmp x y = .eq := Any_def
| .lake/packages/batteries/Batteries/Data/RBMap/Lemmas.lean | 42 | 43 | theorem mem_congr [@TransCmp α cmp] {t : RBNode α} (h : cmp x y = .eq) :
Mem cmp x t ↔ Mem cmp y t := by | simp [Mem, TransCmp.cmp_congr_left' h]
| 1 |
import Mathlib.NumberTheory.LegendreSymbol.QuadraticChar.Basic
#align_import number_theory.legendre_symbol.basic from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Nat
section Euler
section Legendre
open ZMod
variable (p : ℕ) [Fact p.Prime]
def legendreSym (a : ℤ) : ℤ :=
quadraticChar (ZMod p) a
#align legendre_sym legendreSym
section Values
variable {p : ℕ} [Fact p.Prime]
open ZMod
theorem legendreSym.at_neg_one (hp : p ≠ 2) : legendreSym p (-1) = χ₄ p := by
simp only [legendreSym, card p, quadraticChar_neg_one ((ringChar_zmod_n p).substr hp),
Int.cast_neg, Int.cast_one]
#align legendre_sym.at_neg_one legendreSym.at_neg_one
namespace ZMod
| Mathlib/NumberTheory/LegendreSymbol/Basic.lean | 302 | 303 | theorem exists_sq_eq_neg_one_iff : IsSquare (-1 : ZMod p) ↔ p % 4 ≠ 3 := by |
rw [FiniteField.isSquare_neg_one_iff, card p]
| 1 |
import Mathlib.CategoryTheory.Subobject.Lattice
#align_import category_theory.subobject.limits from "leanprover-community/mathlib"@"956af7c76589f444f2e1313911bad16366ea476d"
universe v u
noncomputable section
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Subobject Opposite
variable {C : Type u} [Category.{v} C] {X Y Z : C}
namespace CategoryTheory
namespace Limits
section Image
variable (f : X ⟶ Y) [HasImage f]
abbrev imageSubobject : Subobject Y :=
Subobject.mk (image.ι f)
#align category_theory.limits.image_subobject CategoryTheory.Limits.imageSubobject
def imageSubobjectIso : (imageSubobject f : C) ≅ image f :=
Subobject.underlyingIso (image.ι f)
#align category_theory.limits.image_subobject_iso CategoryTheory.Limits.imageSubobjectIso
@[reassoc (attr := simp)]
theorem imageSubobject_arrow :
(imageSubobjectIso f).hom ≫ image.ι f = (imageSubobject f).arrow := by simp [imageSubobjectIso]
#align category_theory.limits.image_subobject_arrow CategoryTheory.Limits.imageSubobject_arrow
@[reassoc (attr := simp)]
theorem imageSubobject_arrow' :
(imageSubobjectIso f).inv ≫ (imageSubobject f).arrow = image.ι f := by simp [imageSubobjectIso]
#align category_theory.limits.image_subobject_arrow' CategoryTheory.Limits.imageSubobject_arrow'
def factorThruImageSubobject : X ⟶ imageSubobject f :=
factorThruImage f ≫ (imageSubobjectIso f).inv
#align category_theory.limits.factor_thru_image_subobject CategoryTheory.Limits.factorThruImageSubobject
instance [HasEqualizers C] : Epi (factorThruImageSubobject f) := by
dsimp [factorThruImageSubobject]
apply epi_comp
@[reassoc (attr := simp), elementwise (attr := simp)]
theorem imageSubobject_arrow_comp : factorThruImageSubobject f ≫ (imageSubobject f).arrow = f := by
simp [factorThruImageSubobject, imageSubobject_arrow]
#align category_theory.limits.image_subobject_arrow_comp CategoryTheory.Limits.imageSubobject_arrow_comp
theorem imageSubobject_arrow_comp_eq_zero [HasZeroMorphisms C] {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z}
[HasImage f] [Epi (factorThruImageSubobject f)] (h : f ≫ g = 0) :
(imageSubobject f).arrow ≫ g = 0 :=
zero_of_epi_comp (factorThruImageSubobject f) <| by simp [h]
#align category_theory.limits.image_subobject_arrow_comp_eq_zero CategoryTheory.Limits.imageSubobject_arrow_comp_eq_zero
theorem imageSubobject_factors_comp_self {W : C} (k : W ⟶ X) : (imageSubobject f).Factors (k ≫ f) :=
⟨k ≫ factorThruImage f, by simp⟩
#align category_theory.limits.image_subobject_factors_comp_self CategoryTheory.Limits.imageSubobject_factors_comp_self
@[simp]
theorem factorThruImageSubobject_comp_self {W : C} (k : W ⟶ X) (h) :
(imageSubobject f).factorThru (k ≫ f) h = k ≫ factorThruImageSubobject f := by
ext
simp
#align category_theory.limits.factor_thru_image_subobject_comp_self CategoryTheory.Limits.factorThruImageSubobject_comp_self
@[simp]
theorem factorThruImageSubobject_comp_self_assoc {W W' : C} (k : W ⟶ W') (k' : W' ⟶ X) (h) :
(imageSubobject f).factorThru (k ≫ k' ≫ f) h = k ≫ k' ≫ factorThruImageSubobject f := by
ext
simp
#align category_theory.limits.factor_thru_image_subobject_comp_self_assoc CategoryTheory.Limits.factorThruImageSubobject_comp_self_assoc
theorem imageSubobject_comp_le {X' : C} (h : X' ⟶ X) (f : X ⟶ Y) [HasImage f] [HasImage (h ≫ f)] :
imageSubobject (h ≫ f) ≤ imageSubobject f :=
Subobject.mk_le_mk_of_comm (image.preComp h f) (by simp)
#align category_theory.limits.image_subobject_comp_le CategoryTheory.Limits.imageSubobject_comp_le
section
open ZeroObject
variable [HasZeroMorphisms C] [HasZeroObject C]
@[simp]
theorem imageSubobject_zero_arrow : (imageSubobject (0 : X ⟶ Y)).arrow = 0 := by
rw [← imageSubobject_arrow]
simp
#align category_theory.limits.image_subobject_zero_arrow CategoryTheory.Limits.imageSubobject_zero_arrow
@[simp]
theorem imageSubobject_zero {A B : C} : imageSubobject (0 : A ⟶ B) = ⊥ :=
Subobject.eq_of_comm (imageSubobjectIso _ ≪≫ imageZero ≪≫ Subobject.botCoeIsoZero.symm) (by simp)
#align category_theory.limits.image_subobject_zero CategoryTheory.Limits.imageSubobject_zero
end
section
variable [HasEqualizers C]
attribute [local instance] epi_comp
instance imageSubobject_comp_le_epi_of_epi {X' : C} (h : X' ⟶ X) [Epi h] (f : X ⟶ Y) [HasImage f]
[HasImage (h ≫ f)] : Epi (Subobject.ofLE _ _ (imageSubobject_comp_le h f)) := by
rw [ofLE_mk_le_mk_of_comm (image.preComp h f)]
· infer_instance
· simp
#align category_theory.limits.image_subobject_comp_le_epi_of_epi CategoryTheory.Limits.imageSubobject_comp_le_epi_of_epi
end
section
variable [HasEqualizers C]
def imageSubobjectCompIso (f : X ⟶ Y) [HasImage f] {Y' : C} (h : Y ⟶ Y') [IsIso h] :
(imageSubobject (f ≫ h) : C) ≅ (imageSubobject f : C) :=
imageSubobjectIso _ ≪≫ (image.compIso _ _).symm ≪≫ (imageSubobjectIso _).symm
#align category_theory.limits.image_subobject_comp_iso CategoryTheory.Limits.imageSubobjectCompIso
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Subobject/Limits.lean | 412 | 415 | theorem imageSubobjectCompIso_hom_arrow (f : X ⟶ Y) [HasImage f] {Y' : C} (h : Y ⟶ Y') [IsIso h] :
(imageSubobjectCompIso f h).hom ≫ (imageSubobject f).arrow =
(imageSubobject (f ≫ h)).arrow ≫ inv h := by |
simp [imageSubobjectCompIso]
| 1 |
import Mathlib.Order.Interval.Set.Basic
import Mathlib.Order.Hom.Set
#align_import data.set.intervals.order_iso from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
open Set
namespace OrderIso
section Preorder
variable {α β : Type*} [Preorder α] [Preorder β]
@[simp]
theorem preimage_Iic (e : α ≃o β) (b : β) : e ⁻¹' Iic b = Iic (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Iic OrderIso.preimage_Iic
@[simp]
theorem preimage_Ici (e : α ≃o β) (b : β) : e ⁻¹' Ici b = Ici (e.symm b) := by
ext x
simp [← e.le_iff_le]
#align order_iso.preimage_Ici OrderIso.preimage_Ici
@[simp]
theorem preimage_Iio (e : α ≃o β) (b : β) : e ⁻¹' Iio b = Iio (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Iio OrderIso.preimage_Iio
@[simp]
theorem preimage_Ioi (e : α ≃o β) (b : β) : e ⁻¹' Ioi b = Ioi (e.symm b) := by
ext x
simp [← e.lt_iff_lt]
#align order_iso.preimage_Ioi OrderIso.preimage_Ioi
@[simp]
theorem preimage_Icc (e : α ≃o β) (a b : β) : e ⁻¹' Icc a b = Icc (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iic]
#align order_iso.preimage_Icc OrderIso.preimage_Icc
@[simp]
theorem preimage_Ico (e : α ≃o β) (a b : β) : e ⁻¹' Ico a b = Ico (e.symm a) (e.symm b) := by
simp [← Ici_inter_Iio]
#align order_iso.preimage_Ico OrderIso.preimage_Ico
@[simp]
theorem preimage_Ioc (e : α ≃o β) (a b : β) : e ⁻¹' Ioc a b = Ioc (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iic]
#align order_iso.preimage_Ioc OrderIso.preimage_Ioc
@[simp]
theorem preimage_Ioo (e : α ≃o β) (a b : β) : e ⁻¹' Ioo a b = Ioo (e.symm a) (e.symm b) := by
simp [← Ioi_inter_Iio]
#align order_iso.preimage_Ioo OrderIso.preimage_Ioo
@[simp]
| Mathlib/Order/Interval/Set/OrderIso.lean | 68 | 69 | theorem image_Iic (e : α ≃o β) (a : α) : e '' Iic a = Iic (e a) := by |
rw [e.image_eq_preimage, e.symm.preimage_Iic, e.symm_symm]
| 1 |
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.FDeriv.Comp
import Mathlib.Analysis.Calculus.FDeriv.RestrictScalars
#align_import analysis.calculus.deriv.comp from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
universe u v w
open scoped Classical
open Topology Filter ENNReal
open Filter Asymptotics Set
open ContinuousLinearMap (smulRight smulRight_one_eq_iff)
variable {𝕜 : Type u} [NontriviallyNormedField 𝕜]
variable {F : Type v} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {E : Type w} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {f f₀ f₁ g : 𝕜 → F}
variable {f' f₀' f₁' g' : F}
variable {x : 𝕜}
variable {s t : Set 𝕜}
variable {L L₁ L₂ : Filter 𝕜}
section Composition
variable {𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NormedAlgebra 𝕜 𝕜'] [NormedSpace 𝕜' F]
[IsScalarTower 𝕜 𝕜' F] {s' t' : Set 𝕜'} {h : 𝕜 → 𝕜'} {h₁ : 𝕜 → 𝕜} {h₂ : 𝕜' → 𝕜'} {h' h₂' : 𝕜'}
{h₁' : 𝕜} {g₁ : 𝕜' → F} {g₁' : F} {L' : Filter 𝕜'} {y : 𝕜'} (x)
theorem HasDerivAtFilter.scomp (hg : HasDerivAtFilter g₁ g₁' (h x) L')
(hh : HasDerivAtFilter h h' x L) (hL : Tendsto h L L') :
HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by
simpa using ((hg.restrictScalars 𝕜).comp x hh hL).hasDerivAtFilter
#align has_deriv_at_filter.scomp HasDerivAtFilter.scomp
theorem HasDerivAtFilter.scomp_of_eq (hg : HasDerivAtFilter g₁ g₁' y L')
(hh : HasDerivAtFilter h h' x L) (hy : y = h x) (hL : Tendsto h L L') :
HasDerivAtFilter (g₁ ∘ h) (h' • g₁') x L := by
rw [hy] at hg; exact hg.scomp x hh hL
theorem HasDerivWithinAt.scomp_hasDerivAt (hg : HasDerivWithinAt g₁ g₁' s' (h x))
(hh : HasDerivAt h h' x) (hs : ∀ x, h x ∈ s') : HasDerivAt (g₁ ∘ h) (h' • g₁') x :=
hg.scomp x hh <| tendsto_inf.2 ⟨hh.continuousAt, tendsto_principal.2 <| eventually_of_forall hs⟩
#align has_deriv_within_at.scomp_has_deriv_at HasDerivWithinAt.scomp_hasDerivAt
theorem HasDerivWithinAt.scomp_hasDerivAt_of_eq (hg : HasDerivWithinAt g₁ g₁' s' y)
(hh : HasDerivAt h h' x) (hs : ∀ x, h x ∈ s') (hy : y = h x) :
HasDerivAt (g₁ ∘ h) (h' • g₁') x := by
rw [hy] at hg; exact hg.scomp_hasDerivAt x hh hs
nonrec theorem HasDerivWithinAt.scomp (hg : HasDerivWithinAt g₁ g₁' t' (h x))
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') :
HasDerivWithinAt (g₁ ∘ h) (h' • g₁') s x :=
hg.scomp x hh <| hh.continuousWithinAt.tendsto_nhdsWithin hst
#align has_deriv_within_at.scomp HasDerivWithinAt.scomp
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 101 | 104 | theorem HasDerivWithinAt.scomp_of_eq (hg : HasDerivWithinAt g₁ g₁' t' y)
(hh : HasDerivWithinAt h h' s x) (hst : MapsTo h s t') (hy : y = h x) :
HasDerivWithinAt (g₁ ∘ h) (h' • g₁') s x := by |
rw [hy] at hg; exact hg.scomp x hh hst
| 1 |
import Mathlib.Analysis.Convex.Basic
import Mathlib.Order.Closure
#align_import analysis.convex.hull from "leanprover-community/mathlib"@"92bd7b1ffeb306a89f450bee126ddd8a284c259d"
open Set
open Pointwise
variable {𝕜 E F : Type*}
section convexHull
section OrderedSemiring
variable [OrderedSemiring 𝕜]
section AddCommMonoid
variable (𝕜)
variable [AddCommMonoid E] [AddCommMonoid F] [Module 𝕜 E] [Module 𝕜 F]
@[simps! isClosed]
def convexHull : ClosureOperator (Set E) := .ofCompletePred (Convex 𝕜) fun _ ↦ convex_sInter
#align convex_hull convexHull
variable (s : Set E)
theorem subset_convexHull : s ⊆ convexHull 𝕜 s :=
(convexHull 𝕜).le_closure s
#align subset_convex_hull subset_convexHull
theorem convex_convexHull : Convex 𝕜 (convexHull 𝕜 s) := (convexHull 𝕜).isClosed_closure s
#align convex_convex_hull convex_convexHull
theorem convexHull_eq_iInter : convexHull 𝕜 s = ⋂ (t : Set E) (_ : s ⊆ t) (_ : Convex 𝕜 t), t := by
simp [convexHull, iInter_subtype, iInter_and]
#align convex_hull_eq_Inter convexHull_eq_iInter
variable {𝕜 s} {t : Set E} {x y : E}
| Mathlib/Analysis/Convex/Hull.lean | 62 | 63 | theorem mem_convexHull_iff : x ∈ convexHull 𝕜 s ↔ ∀ t, s ⊆ t → Convex 𝕜 t → x ∈ t := by |
simp_rw [convexHull_eq_iInter, mem_iInter]
| 1 |
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Order.Ring.Nat
import Mathlib.Tactic.NthRewrite
#align_import data.nat.gcd.basic from "leanprover-community/mathlib"@"e8638a0fcaf73e4500469f368ef9494e495099b3"
namespace Nat
theorem gcd_greatest {a b d : ℕ} (hda : d ∣ a) (hdb : d ∣ b) (hd : ∀ e : ℕ, e ∣ a → e ∣ b → e ∣ d) :
d = a.gcd b :=
(dvd_antisymm (hd _ (gcd_dvd_left a b) (gcd_dvd_right a b)) (dvd_gcd hda hdb)).symm
#align nat.gcd_greatest Nat.gcd_greatest
@[simp]
theorem gcd_add_mul_right_right (m n k : ℕ) : gcd m (n + k * m) = gcd m n := by
simp [gcd_rec m (n + k * m), gcd_rec m n]
#align nat.gcd_add_mul_right_right Nat.gcd_add_mul_right_right
@[simp]
theorem gcd_add_mul_left_right (m n k : ℕ) : gcd m (n + m * k) = gcd m n := by
simp [gcd_rec m (n + m * k), gcd_rec m n]
#align nat.gcd_add_mul_left_right Nat.gcd_add_mul_left_right
@[simp]
| Mathlib/Data/Nat/GCD/Basic.lean | 45 | 45 | theorem gcd_mul_right_add_right (m n k : ℕ) : gcd m (k * m + n) = gcd m n := by | simp [add_comm _ n]
| 1 |
import Mathlib.Logic.Equiv.Defs
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.PPWithUniv
#align_import logic.small.basic from "leanprover-community/mathlib"@"d012cd09a9b256d870751284dd6a29882b0be105"
universe u w v v'
@[mk_iff, pp_with_univ]
class Small (α : Type v) : Prop where
equiv_small : ∃ S : Type w, Nonempty (α ≃ S)
#align small Small
theorem Small.mk' {α : Type v} {S : Type w} (e : α ≃ S) : Small.{w} α :=
⟨⟨S, ⟨e⟩⟩⟩
#align small.mk' Small.mk'
@[pp_with_univ]
def Shrink (α : Type v) [Small.{w} α] : Type w :=
Classical.choose (@Small.equiv_small α _)
#align shrink Shrink
noncomputable def equivShrink (α : Type v) [Small.{w} α] : α ≃ Shrink α :=
Nonempty.some (Classical.choose_spec (@Small.equiv_small α _))
#align equiv_shrink equivShrink
@[ext]
| Mathlib/Logic/Small/Defs.lean | 56 | 58 | theorem Shrink.ext {α : Type v} [Small.{w} α] {x y : Shrink α}
(w : (equivShrink _).symm x = (equivShrink _).symm y) : x = y := by |
simpa using w
| 1 |
import Mathlib.Algebra.Algebra.Basic
import Mathlib.Algebra.Periodic
import Mathlib.Topology.Algebra.Order.Field
import Mathlib.Topology.Algebra.UniformMulAction
import Mathlib.Topology.Algebra.Star
import Mathlib.Topology.Instances.Int
import Mathlib.Topology.Order.Bornology
#align_import topology.instances.real from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
noncomputable section
open scoped Classical
open Filter Int Metric Set TopologicalSpace Bornology
open scoped Topology Uniformity Interval
universe u v w
variable {α : Type u} {β : Type v} {γ : Type w}
instance : NoncompactSpace ℝ := Int.closedEmbedding_coe_real.noncompactSpace
theorem Real.uniformContinuous_add : UniformContinuous fun p : ℝ × ℝ => p.1 + p.2 :=
Metric.uniformContinuous_iff.2 fun _ε ε0 =>
let ⟨δ, δ0, Hδ⟩ := rat_add_continuous_lemma abs ε0
⟨δ, δ0, fun h =>
let ⟨h₁, h₂⟩ := max_lt_iff.1 h
Hδ h₁ h₂⟩
#align real.uniform_continuous_add Real.uniformContinuous_add
theorem Real.uniformContinuous_neg : UniformContinuous (@Neg.neg ℝ _) :=
Metric.uniformContinuous_iff.2 fun ε ε0 =>
⟨_, ε0, fun h => by rw [dist_comm] at h; simpa only [Real.dist_eq, neg_sub_neg] using h⟩
#align real.uniform_continuous_neg Real.uniformContinuous_neg
instance : ContinuousStar ℝ := ⟨continuous_id⟩
instance : UniformAddGroup ℝ :=
UniformAddGroup.mk' Real.uniformContinuous_add Real.uniformContinuous_neg
-- short-circuit type class inference
instance : TopologicalAddGroup ℝ := by infer_instance
instance : TopologicalRing ℝ := inferInstance
instance : TopologicalDivisionRing ℝ := inferInstance
instance : ProperSpace ℝ where
isCompact_closedBall x r := by
rw [Real.closedBall_eq_Icc]
apply isCompact_Icc
instance : SecondCountableTopology ℝ := secondCountable_of_proper
theorem Real.isTopologicalBasis_Ioo_rat :
@IsTopologicalBasis ℝ _ (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) b}) :=
isTopologicalBasis_of_isOpen_of_nhds (by simp (config := { contextual := true }) [isOpen_Ioo])
fun a v hav hv =>
let ⟨l, u, ⟨hl, hu⟩, h⟩ := mem_nhds_iff_exists_Ioo_subset.mp (IsOpen.mem_nhds hv hav)
let ⟨q, hlq, hqa⟩ := exists_rat_btwn hl
let ⟨p, hap, hpu⟩ := exists_rat_btwn hu
⟨Ioo q p, by
simp only [mem_iUnion]
exact ⟨q, p, Rat.cast_lt.1 <| hqa.trans hap, rfl⟩, ⟨hqa, hap⟩, fun a' ⟨hqa', ha'p⟩ =>
h ⟨hlq.trans hqa', ha'p.trans hpu⟩⟩
#align real.is_topological_basis_Ioo_rat Real.isTopologicalBasis_Ioo_rat
@[simp]
theorem Real.cobounded_eq : cobounded ℝ = atBot ⊔ atTop := by
simp only [← comap_dist_right_atTop (0 : ℝ), Real.dist_eq, sub_zero, comap_abs_atTop]
@[deprecated] alias Real.cocompact_eq := cocompact_eq_atBot_atTop
#align real.cocompact_eq Real.cocompact_eq
@[deprecated (since := "2024-02-07")] alias Real.atBot_le_cocompact := atBot_le_cocompact
@[deprecated (since := "2024-02-07")] alias Real.atTop_le_cocompact := atTop_le_cocompact
| Mathlib/Topology/Instances/Real.lean | 92 | 94 | theorem Real.mem_closure_iff {s : Set ℝ} {x : ℝ} :
x ∈ closure s ↔ ∀ ε > 0, ∃ y ∈ s, |y - x| < ε := by |
simp [mem_closure_iff_nhds_basis nhds_basis_ball, Real.dist_eq]
| 1 |
import Mathlib.Algebra.BigOperators.Group.Finset
import Mathlib.Data.List.MinMax
import Mathlib.Algebra.Tropical.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Finset
#align_import algebra.tropical.big_operators from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
variable {R S : Type*}
open Tropical Finset
theorem List.trop_sum [AddMonoid R] (l : List R) : trop l.sum = List.prod (l.map trop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.trop_sum List.trop_sum
theorem Multiset.trop_sum [AddCommMonoid R] (s : Multiset R) :
trop s.sum = Multiset.prod (s.map trop) :=
Quotient.inductionOn s (by simpa using List.trop_sum)
#align multiset.trop_sum Multiset.trop_sum
theorem trop_sum [AddCommMonoid R] (s : Finset S) (f : S → R) :
trop (∑ i ∈ s, f i) = ∏ i ∈ s, trop (f i) := by
convert Multiset.trop_sum (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align trop_sum trop_sum
theorem List.untrop_prod [AddMonoid R] (l : List (Tropical R)) :
untrop l.prod = List.sum (l.map untrop) := by
induction' l with hd tl IH
· simp
· simp [← IH]
#align list.untrop_prod List.untrop_prod
theorem Multiset.untrop_prod [AddCommMonoid R] (s : Multiset (Tropical R)) :
untrop s.prod = Multiset.sum (s.map untrop) :=
Quotient.inductionOn s (by simpa using List.untrop_prod)
#align multiset.untrop_prod Multiset.untrop_prod
theorem untrop_prod [AddCommMonoid R] (s : Finset S) (f : S → Tropical R) :
untrop (∏ i ∈ s, f i) = ∑ i ∈ s, untrop (f i) := by
convert Multiset.untrop_prod (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align untrop_prod untrop_prod
-- Porting note: replaced `coe` with `WithTop.some` in statement
theorem List.trop_minimum [LinearOrder R] (l : List R) :
trop l.minimum = List.sum (l.map (trop ∘ WithTop.some)) := by
induction' l with hd tl IH
· simp
· simp [List.minimum_cons, ← IH]
#align list.trop_minimum List.trop_minimum
theorem Multiset.trop_inf [LinearOrder R] [OrderTop R] (s : Multiset R) :
trop s.inf = Multiset.sum (s.map trop) := by
induction' s using Multiset.induction with s x IH
· simp
· simp [← IH]
#align multiset.trop_inf Multiset.trop_inf
theorem Finset.trop_inf [LinearOrder R] [OrderTop R] (s : Finset S) (f : S → R) :
trop (s.inf f) = ∑ i ∈ s, trop (f i) := by
convert Multiset.trop_inf (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align finset.trop_inf Finset.trop_inf
theorem trop_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S) (f : S → WithTop R) :
trop (sInf (f '' s)) = ∑ i ∈ s, trop (f i) := by
rcases s.eq_empty_or_nonempty with (rfl | h)
· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, trop_top]
rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, s.trop_inf]
#align trop_Inf_image trop_sInf_image
theorem trop_iInf [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S → WithTop R) :
trop (⨅ i : S, f i) = ∑ i : S, trop (f i) := by
rw [iInf, ← Set.image_univ, ← coe_univ, trop_sInf_image]
#align trop_infi trop_iInf
theorem Multiset.untrop_sum [LinearOrder R] [OrderTop R] (s : Multiset (Tropical R)) :
untrop s.sum = Multiset.inf (s.map untrop) := by
induction' s using Multiset.induction with s x IH
· simp
· simp only [sum_cons, ge_iff_le, untrop_add, untrop_le_iff, map_cons, inf_cons, ← IH]
rfl
#align multiset.untrop_sum Multiset.untrop_sum
theorem Finset.untrop_sum' [LinearOrder R] [OrderTop R] (s : Finset S) (f : S → Tropical R) :
untrop (∑ i ∈ s, f i) = s.inf (untrop ∘ f) := by
convert Multiset.untrop_sum (s.val.map f)
simp only [Multiset.map_map, Function.comp_apply]
rfl
#align finset.untrop_sum' Finset.untrop_sum'
theorem untrop_sum_eq_sInf_image [ConditionallyCompleteLinearOrder R] (s : Finset S)
(f : S → Tropical (WithTop R)) : untrop (∑ i ∈ s, f i) = sInf (untrop ∘ f '' s) := by
rcases s.eq_empty_or_nonempty with (rfl | h)
· simp only [Set.image_empty, coe_empty, sum_empty, WithTop.sInf_empty, untrop_zero]
· rw [← inf'_eq_csInf_image _ h, inf'_eq_inf, Finset.untrop_sum']
#align untrop_sum_eq_Inf_image untrop_sum_eq_sInf_image
theorem untrop_sum [ConditionallyCompleteLinearOrder R] [Fintype S] (f : S → Tropical (WithTop R)) :
untrop (∑ i : S, f i) = ⨅ i : S, untrop (f i) := by
rw [iInf,← Set.image_univ,← coe_univ, untrop_sum_eq_sInf_image]
rfl
#align untrop_sum untrop_sum
| Mathlib/Algebra/Tropical/BigOperators.lean | 141 | 143 | theorem Finset.untrop_sum [ConditionallyCompleteLinearOrder R] (s : Finset S)
(f : S → Tropical (WithTop R)) : untrop (∑ i ∈ s, f i) = ⨅ i : s, untrop (f i) := by |
simpa [← _root_.untrop_sum] using (sum_attach _ _).symm
| 1 |
import Mathlib.SetTheory.Ordinal.Basic
import Mathlib.Data.Nat.SuccPred
#align_import set_theory.ordinal.arithmetic from "leanprover-community/mathlib"@"31b269b60935483943542d547a6dd83a66b37dc7"
assert_not_exists Field
assert_not_exists Module
noncomputable section
open Function Cardinal Set Equiv Order
open scoped Classical
open Cardinal Ordinal
universe u v w
namespace Ordinal
variable {α : Type*} {β : Type*} {γ : Type*} {r : α → α → Prop} {s : β → β → Prop}
{t : γ → γ → Prop}
@[simp]
theorem lift_add (a b : Ordinal.{v}) : lift.{u} (a + b) = lift.{u} a + lift.{u} b :=
Quotient.inductionOn₂ a b fun ⟨_α, _r, _⟩ ⟨_β, _s, _⟩ =>
Quotient.sound
⟨(RelIso.preimage Equiv.ulift _).trans
(RelIso.sumLexCongr (RelIso.preimage Equiv.ulift _) (RelIso.preimage Equiv.ulift _)).symm⟩
#align ordinal.lift_add Ordinal.lift_add
@[simp]
theorem lift_succ (a : Ordinal.{v}) : lift.{u} (succ a) = succ (lift.{u} a) := by
rw [← add_one_eq_succ, lift_add, lift_one]
rfl
#align ordinal.lift_succ Ordinal.lift_succ
instance add_contravariantClass_le : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· ≤ ·) :=
⟨fun a b c =>
inductionOn a fun α r hr =>
inductionOn b fun β₁ s₁ hs₁ =>
inductionOn c fun β₂ s₂ hs₂ ⟨f⟩ =>
⟨have fl : ∀ a, f (Sum.inl a) = Sum.inl a := fun a => by
simpa only [InitialSeg.trans_apply, InitialSeg.leAdd_apply] using
@InitialSeg.eq _ _ _ _ _
((InitialSeg.leAdd r s₁).trans f) (InitialSeg.leAdd r s₂) a
have : ∀ b, { b' // f (Sum.inr b) = Sum.inr b' } := by
intro b; cases e : f (Sum.inr b)
· rw [← fl] at e
have := f.inj' e
contradiction
· exact ⟨_, rfl⟩
let g (b) := (this b).1
have fr : ∀ b, f (Sum.inr b) = Sum.inr (g b) := fun b => (this b).2
⟨⟨⟨g, fun x y h => by
injection f.inj' (by rw [fr, fr, h] : f (Sum.inr x) = f (Sum.inr y))⟩,
@fun a b => by
-- Porting note:
-- `relEmbedding.coe_fn_to_embedding` & `initial_seg.coe_fn_to_rel_embedding`
-- → `InitialSeg.coe_coe_fn`
simpa only [Sum.lex_inr_inr, fr, InitialSeg.coe_coe_fn, Embedding.coeFn_mk] using
@RelEmbedding.map_rel_iff _ _ _ _ f.toRelEmbedding (Sum.inr a) (Sum.inr b)⟩,
fun a b H => by
rcases f.init (by rw [fr] <;> exact Sum.lex_inr_inr.2 H) with ⟨a' | a', h⟩
· rw [fl] at h
cases h
· rw [fr] at h
exact ⟨a', Sum.inr.inj h⟩⟩⟩⟩
#align ordinal.add_contravariant_class_le Ordinal.add_contravariantClass_le
theorem add_left_cancel (a) {b c : Ordinal} : a + b = a + c ↔ b = c := by
simp only [le_antisymm_iff, add_le_add_iff_left]
#align ordinal.add_left_cancel Ordinal.add_left_cancel
private theorem add_lt_add_iff_left' (a) {b c : Ordinal} : a + b < a + c ↔ b < c := by
rw [← not_le, ← not_le, add_le_add_iff_left]
instance add_covariantClass_lt : CovariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) :=
⟨fun a _b _c => (add_lt_add_iff_left' a).2⟩
#align ordinal.add_covariant_class_lt Ordinal.add_covariantClass_lt
instance add_contravariantClass_lt : ContravariantClass Ordinal.{u} Ordinal.{u} (· + ·) (· < ·) :=
⟨fun a _b _c => (add_lt_add_iff_left' a).1⟩
#align ordinal.add_contravariant_class_lt Ordinal.add_contravariantClass_lt
instance add_swap_contravariantClass_lt :
ContravariantClass Ordinal.{u} Ordinal.{u} (swap (· + ·)) (· < ·) :=
⟨fun _a _b _c => lt_imp_lt_of_le_imp_le fun h => add_le_add_right h _⟩
#align ordinal.add_swap_contravariant_class_lt Ordinal.add_swap_contravariantClass_lt
theorem add_le_add_iff_right {a b : Ordinal} : ∀ n : ℕ, a + n ≤ b + n ↔ a ≤ b
| 0 => by simp
| n + 1 => by
simp only [natCast_succ, add_succ, add_succ, succ_le_succ_iff, add_le_add_iff_right]
#align ordinal.add_le_add_iff_right Ordinal.add_le_add_iff_right
| Mathlib/SetTheory/Ordinal/Arithmetic.lean | 145 | 146 | theorem add_right_cancel {a b : Ordinal} (n : ℕ) : a + n = b + n ↔ a = b := by |
simp only [le_antisymm_iff, add_le_add_iff_right]
| 1 |
import Mathlib.SetTheory.Game.Basic
import Mathlib.SetTheory.Ordinal.NaturalOps
#align_import set_theory.game.ordinal from "leanprover-community/mathlib"@"b90e72c7eebbe8de7c8293a80208ea2ba135c834"
universe u
open SetTheory PGame
open scoped NaturalOps PGame
namespace Ordinal
noncomputable def toPGame : Ordinal.{u} → PGame.{u}
| o =>
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
⟨o.out.α, PEmpty, fun x =>
have := Ordinal.typein_lt_self x
(typein (· < ·) x).toPGame,
PEmpty.elim⟩
termination_by x => x
#align ordinal.to_pgame Ordinal.toPGame
@[nolint unusedHavesSuffices]
theorem toPGame_def (o : Ordinal) :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
o.toPGame = ⟨o.out.α, PEmpty, fun x => (typein (· < ·) x).toPGame, PEmpty.elim⟩ := by
rw [toPGame]
#align ordinal.to_pgame_def Ordinal.toPGame_def
@[simp, nolint unusedHavesSuffices]
theorem toPGame_leftMoves (o : Ordinal) : o.toPGame.LeftMoves = o.out.α := by
rw [toPGame, LeftMoves]
#align ordinal.to_pgame_left_moves Ordinal.toPGame_leftMoves
@[simp, nolint unusedHavesSuffices]
theorem toPGame_rightMoves (o : Ordinal) : o.toPGame.RightMoves = PEmpty := by
rw [toPGame, RightMoves]
#align ordinal.to_pgame_right_moves Ordinal.toPGame_rightMoves
instance isEmpty_zero_toPGame_leftMoves : IsEmpty (toPGame 0).LeftMoves := by
rw [toPGame_leftMoves]; infer_instance
#align ordinal.is_empty_zero_to_pgame_left_moves Ordinal.isEmpty_zero_toPGame_leftMoves
instance isEmpty_toPGame_rightMoves (o : Ordinal) : IsEmpty o.toPGame.RightMoves := by
rw [toPGame_rightMoves]; infer_instance
#align ordinal.is_empty_to_pgame_right_moves Ordinal.isEmpty_toPGame_rightMoves
noncomputable def toLeftMovesToPGame {o : Ordinal} : Set.Iio o ≃ o.toPGame.LeftMoves :=
(enumIsoOut o).toEquiv.trans (Equiv.cast (toPGame_leftMoves o).symm)
#align ordinal.to_left_moves_to_pgame Ordinal.toLeftMovesToPGame
@[simp]
theorem toLeftMovesToPGame_symm_lt {o : Ordinal} (i : o.toPGame.LeftMoves) :
↑(toLeftMovesToPGame.symm i) < o :=
(toLeftMovesToPGame.symm i).prop
#align ordinal.to_left_moves_to_pgame_symm_lt Ordinal.toLeftMovesToPGame_symm_lt
@[nolint unusedHavesSuffices]
theorem toPGame_moveLeft_hEq {o : Ordinal} :
have : IsWellOrder o.out.α (· < ·) := isWellOrder_out_lt o
HEq o.toPGame.moveLeft fun x : o.out.α => (typein (· < ·) x).toPGame := by
rw [toPGame]
rfl
#align ordinal.to_pgame_move_left_heq Ordinal.toPGame_moveLeft_hEq
@[simp]
theorem toPGame_moveLeft' {o : Ordinal} (i) :
o.toPGame.moveLeft i = (toLeftMovesToPGame.symm i).val.toPGame :=
(congr_heq toPGame_moveLeft_hEq.symm (cast_heq _ i)).symm
#align ordinal.to_pgame_move_left' Ordinal.toPGame_moveLeft'
theorem toPGame_moveLeft {o : Ordinal} (i) :
o.toPGame.moveLeft (toLeftMovesToPGame i) = i.val.toPGame := by simp
#align ordinal.to_pgame_move_left Ordinal.toPGame_moveLeft
noncomputable def zeroToPGameRelabelling : toPGame 0 ≡r 0 :=
Relabelling.isEmpty _
#align ordinal.zero_to_pgame_relabelling Ordinal.zeroToPGameRelabelling
noncomputable instance uniqueOneToPGameLeftMoves : Unique (toPGame 1).LeftMoves :=
(Equiv.cast <| toPGame_leftMoves 1).unique
#align ordinal.unique_one_to_pgame_left_moves Ordinal.uniqueOneToPGameLeftMoves
@[simp]
theorem one_toPGame_leftMoves_default_eq :
(default : (toPGame 1).LeftMoves) = @toLeftMovesToPGame 1 ⟨0, Set.mem_Iio.mpr zero_lt_one⟩ :=
rfl
#align ordinal.one_to_pgame_left_moves_default_eq Ordinal.one_toPGame_leftMoves_default_eq
@[simp]
theorem to_leftMoves_one_toPGame_symm (i) :
(@toLeftMovesToPGame 1).symm i = ⟨0, Set.mem_Iio.mpr zero_lt_one⟩ := by
simp [eq_iff_true_of_subsingleton]
#align ordinal.to_left_moves_one_to_pgame_symm Ordinal.to_leftMoves_one_toPGame_symm
| Mathlib/SetTheory/Game/Ordinal.lean | 121 | 121 | theorem one_toPGame_moveLeft (x) : (toPGame 1).moveLeft x = toPGame 0 := by | simp
| 1 |
import Mathlib.Algebra.Group.Subgroup.Pointwise
import Mathlib.GroupTheory.GroupAction.ConjAct
import Mathlib.GroupTheory.Index
#align_import group_theory.commensurable from "leanprover-community/mathlib"@"48085f140e684306f9e7da907cd5932056d1aded"
variable {G : Type*} [Group G]
def Commensurable (H K : Subgroup G) : Prop :=
H.relindex K ≠ 0 ∧ K.relindex H ≠ 0
#align commensurable Commensurable
namespace Commensurable
open Pointwise
@[refl]
protected theorem refl (H : Subgroup G) : Commensurable H H := by simp [Commensurable]
#align commensurable.refl Commensurable.refl
theorem comm {H K : Subgroup G} : Commensurable H K ↔ Commensurable K H := and_comm
#align commensurable.comm Commensurable.comm
@[symm]
theorem symm {H K : Subgroup G} : Commensurable H K → Commensurable K H := And.symm
#align commensurable.symm Commensurable.symm
@[trans]
theorem trans {H K L : Subgroup G} (hhk : Commensurable H K) (hkl : Commensurable K L) :
Commensurable H L :=
⟨Subgroup.relindex_ne_zero_trans hhk.1 hkl.1, Subgroup.relindex_ne_zero_trans hkl.2 hhk.2⟩
#align commensurable.trans Commensurable.trans
theorem equivalence : Equivalence (@Commensurable G _) :=
⟨Commensurable.refl, fun h => Commensurable.symm h, fun h₁ h₂ => Commensurable.trans h₁ h₂⟩
#align commensurable.equivalence Commensurable.equivalence
def quotConjEquiv (H K : Subgroup G) (g : ConjAct G) :
K ⧸ H.subgroupOf K ≃ (g • K).1 ⧸ (g • H).subgroupOf (g • K) :=
Quotient.congr (K.equivSMul g).toEquiv fun a b => by
dsimp
rw [← Quotient.eq'', ← Quotient.eq'', QuotientGroup.eq', QuotientGroup.eq',
Subgroup.mem_subgroupOf, Subgroup.mem_subgroupOf, ← MulEquiv.map_inv, ← MulEquiv.map_mul,
Subgroup.equivSMul_apply_coe]
exact Subgroup.smul_mem_pointwise_smul_iff.symm
#align commensurable.quot_conj_equiv Commensurable.quotConjEquiv
theorem commensurable_conj {H K : Subgroup G} (g : ConjAct G) :
Commensurable H K ↔ Commensurable (g • H) (g • K) :=
and_congr (not_iff_not.mpr (Eq.congr_left (Cardinal.toNat_congr (quotConjEquiv H K g))))
(not_iff_not.mpr (Eq.congr_left (Cardinal.toNat_congr (quotConjEquiv K H g))))
#align commensurable.commensurable_conj Commensurable.commensurable_conj
| Mathlib/GroupTheory/Commensurable.lean | 81 | 82 | theorem commensurable_inv (H : Subgroup G) (g : ConjAct G) :
Commensurable (g • H) H ↔ Commensurable H (g⁻¹ • H) := by | rw [commensurable_conj, inv_smul_smul]
| 1 |
import Mathlib.Tactic.Qify
import Mathlib.Data.ZMod.Basic
import Mathlib.NumberTheory.DiophantineApproximation
import Mathlib.NumberTheory.Zsqrtd.Basic
#align_import number_theory.pell from "leanprover-community/mathlib"@"7ad820c4997738e2f542f8a20f32911f52020e26"
namespace Pell
open Zsqrtd
theorem is_pell_solution_iff_mem_unitary {d : ℤ} {a : ℤ√d} :
a.re ^ 2 - d * a.im ^ 2 = 1 ↔ a ∈ unitary (ℤ√d) := by
rw [← norm_eq_one_iff_mem_unitary, norm_def, sq, sq, ← mul_assoc]
#align pell.is_pell_solution_iff_mem_unitary Pell.is_pell_solution_iff_mem_unitary
-- We use `solution₁ d` to allow for a more general structure `solution d m` that
-- encodes solutions to `x^2 - d*y^2 = m` to be added later.
def Solution₁ (d : ℤ) : Type :=
↥(unitary (ℤ√d))
#align pell.solution₁ Pell.Solution₁
namespace Solution₁
variable {d : ℤ}
-- Porting note(https://github.com/leanprover-community/mathlib4/issues/5020): manual deriving
instance instCommGroup : CommGroup (Solution₁ d) :=
inferInstanceAs (CommGroup (unitary (ℤ√d)))
#align pell.solution₁.comm_group Pell.Solution₁.instCommGroup
instance instHasDistribNeg : HasDistribNeg (Solution₁ d) :=
inferInstanceAs (HasDistribNeg (unitary (ℤ√d)))
#align pell.solution₁.has_distrib_neg Pell.Solution₁.instHasDistribNeg
instance instInhabited : Inhabited (Solution₁ d) :=
inferInstanceAs (Inhabited (unitary (ℤ√d)))
#align pell.solution₁.inhabited Pell.Solution₁.instInhabited
instance : Coe (Solution₁ d) (ℤ√d) where coe := Subtype.val
protected def x (a : Solution₁ d) : ℤ :=
(a : ℤ√d).re
#align pell.solution₁.x Pell.Solution₁.x
protected def y (a : Solution₁ d) : ℤ :=
(a : ℤ√d).im
#align pell.solution₁.y Pell.Solution₁.y
theorem prop (a : Solution₁ d) : a.x ^ 2 - d * a.y ^ 2 = 1 :=
is_pell_solution_iff_mem_unitary.mpr a.property
#align pell.solution₁.prop Pell.Solution₁.prop
| Mathlib/NumberTheory/Pell.lean | 133 | 133 | theorem prop_x (a : Solution₁ d) : a.x ^ 2 = 1 + d * a.y ^ 2 := by | rw [← a.prop]; ring
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
import Mathlib.RingTheory.PowerBasis
#align_import ring_theory.is_adjoin_root from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
open scoped Polynomial
open Polynomial
noncomputable section
universe u v
-- Porting note: this looks like something that should not be here
-- -- This class doesn't really make sense on a predicate
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure IsAdjoinRoot {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) : Type max u v where
map : R[X] →+* S
map_surjective : Function.Surjective map
ker_map : RingHom.ker map = Ideal.span {f}
algebraMap_eq : algebraMap R S = map.comp Polynomial.C
#align is_adjoin_root IsAdjoinRoot
-- This class doesn't really make sense on a predicate
-- @[nolint has_nonempty_instance] -- Porting note: This linter does not exist yet.
structure IsAdjoinRootMonic {R : Type u} (S : Type v) [CommSemiring R] [Semiring S] [Algebra R S]
(f : R[X]) extends IsAdjoinRoot S f where
Monic : Monic f
#align is_adjoin_root_monic IsAdjoinRootMonic
section Ring
variable {R : Type u} {S : Type v} [CommRing R] [Ring S] {f : R[X]} [Algebra R S]
namespace IsAdjoinRoot
def root (h : IsAdjoinRoot S f) : S :=
h.map X
#align is_adjoin_root.root IsAdjoinRoot.root
theorem subsingleton (h : IsAdjoinRoot S f) [Subsingleton R] : Subsingleton S :=
h.map_surjective.subsingleton
#align is_adjoin_root.subsingleton IsAdjoinRoot.subsingleton
theorem algebraMap_apply (h : IsAdjoinRoot S f) (x : R) :
algebraMap R S x = h.map (Polynomial.C x) := by rw [h.algebraMap_eq, RingHom.comp_apply]
#align is_adjoin_root.algebra_map_apply IsAdjoinRoot.algebraMap_apply
@[simp]
theorem mem_ker_map (h : IsAdjoinRoot S f) {p} : p ∈ RingHom.ker h.map ↔ f ∣ p := by
rw [h.ker_map, Ideal.mem_span_singleton]
#align is_adjoin_root.mem_ker_map IsAdjoinRoot.mem_ker_map
theorem map_eq_zero_iff (h : IsAdjoinRoot S f) {p} : h.map p = 0 ↔ f ∣ p := by
rw [← h.mem_ker_map, RingHom.mem_ker]
#align is_adjoin_root.map_eq_zero_iff IsAdjoinRoot.map_eq_zero_iff
@[simp]
theorem map_X (h : IsAdjoinRoot S f) : h.map X = h.root := rfl
set_option linter.uppercaseLean3 false in
#align is_adjoin_root.map_X IsAdjoinRoot.map_X
@[simp]
theorem map_self (h : IsAdjoinRoot S f) : h.map f = 0 := h.map_eq_zero_iff.mpr dvd_rfl
#align is_adjoin_root.map_self IsAdjoinRoot.map_self
@[simp]
theorem aeval_eq (h : IsAdjoinRoot S f) (p : R[X]) : aeval h.root p = h.map p :=
Polynomial.induction_on p (fun x => by rw [aeval_C, h.algebraMap_apply])
(fun p q ihp ihq => by rw [AlgHom.map_add, RingHom.map_add, ihp, ihq]) fun n x _ => by
rw [AlgHom.map_mul, aeval_C, AlgHom.map_pow, aeval_X, RingHom.map_mul, ← h.algebraMap_apply,
RingHom.map_pow, map_X]
#align is_adjoin_root.aeval_eq IsAdjoinRoot.aeval_eq
-- @[simp] -- Porting note (#10618): simp can prove this
theorem aeval_root (h : IsAdjoinRoot S f) : aeval h.root f = 0 := by rw [aeval_eq, map_self]
#align is_adjoin_root.aeval_root IsAdjoinRoot.aeval_root
def repr (h : IsAdjoinRoot S f) (x : S) : R[X] :=
(h.map_surjective x).choose
#align is_adjoin_root.repr IsAdjoinRoot.repr
theorem map_repr (h : IsAdjoinRoot S f) (x : S) : h.map (h.repr x) = x :=
(h.map_surjective x).choose_spec
#align is_adjoin_root.map_repr IsAdjoinRoot.map_repr
theorem repr_zero_mem_span (h : IsAdjoinRoot S f) : h.repr 0 ∈ Ideal.span ({f} : Set R[X]) := by
rw [← h.ker_map, RingHom.mem_ker, h.map_repr]
#align is_adjoin_root.repr_zero_mem_span IsAdjoinRoot.repr_zero_mem_span
| Mathlib/RingTheory/IsAdjoinRoot.lean | 179 | 181 | theorem repr_add_sub_repr_add_repr_mem_span (h : IsAdjoinRoot S f) (x y : S) :
h.repr (x + y) - (h.repr x + h.repr y) ∈ Ideal.span ({f} : Set R[X]) := by |
rw [← h.ker_map, RingHom.mem_ker, map_sub, h.map_repr, map_add, h.map_repr, h.map_repr, sub_self]
| 1 |
import Mathlib.Analysis.LocallyConvex.Bounded
import Mathlib.Topology.Algebra.Module.StrongTopology
#align_import analysis.normed_space.compact_operator from "leanprover-community/mathlib"@"f0c8bf9245297a541f468be517f1bde6195105e9"
open Function Set Filter Bornology Metric Pointwise Topology
def IsCompactOperator {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁] [TopologicalSpace M₂]
(f : M₁ → M₂) : Prop :=
∃ K, IsCompact K ∧ f ⁻¹' K ∈ (𝓝 0 : Filter M₁)
#align is_compact_operator IsCompactOperator
theorem isCompactOperator_zero {M₁ M₂ : Type*} [Zero M₁] [TopologicalSpace M₁]
[TopologicalSpace M₂] [Zero M₂] : IsCompactOperator (0 : M₁ → M₂) :=
⟨{0}, isCompact_singleton, mem_of_superset univ_mem fun _ _ => rfl⟩
#align is_compact_operator_zero isCompactOperator_zero
section Characterizations
section
variable {R₁ R₂ : Type*} [Semiring R₁] [Semiring R₂] {σ₁₂ : R₁ →+* R₂} {M₁ M₂ : Type*}
[TopologicalSpace M₁] [AddCommMonoid M₁] [TopologicalSpace M₂]
theorem isCompactOperator_iff_exists_mem_nhds_image_subset_compact (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), ∃ K : Set M₂, IsCompact K ∧ f '' V ⊆ K :=
⟨fun ⟨K, hK, hKf⟩ => ⟨f ⁻¹' K, hKf, K, hK, image_preimage_subset _ _⟩, fun ⟨_, hV, K, hK, hVK⟩ =>
⟨K, hK, mem_of_superset hV (image_subset_iff.mp hVK)⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_image_subset_compact isCompactOperator_iff_exists_mem_nhds_image_subset_compact
theorem isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image [T2Space M₂] (f : M₁ → M₂) :
IsCompactOperator f ↔ ∃ V ∈ (𝓝 0 : Filter M₁), IsCompact (closure <| f '' V) := by
rw [isCompactOperator_iff_exists_mem_nhds_image_subset_compact]
exact
⟨fun ⟨V, hV, K, hK, hKV⟩ => ⟨V, hV, hK.closure_of_subset hKV⟩,
fun ⟨V, hV, hVc⟩ => ⟨V, hV, closure (f '' V), hVc, subset_closure⟩⟩
#align is_compact_operator_iff_exists_mem_nhds_is_compact_closure_image isCompactOperator_iff_exists_mem_nhds_isCompact_closure_image
end
section Operations
variable {R₁ R₂ R₃ R₄ : Type*} [Semiring R₁] [Semiring R₂] [CommSemiring R₃] [CommSemiring R₄]
{σ₁₂ : R₁ →+* R₂} {σ₁₄ : R₁ →+* R₄} {σ₃₄ : R₃ →+* R₄} {M₁ M₂ M₃ M₄ : Type*} [TopologicalSpace M₁]
[AddCommMonoid M₁] [TopologicalSpace M₂] [AddCommMonoid M₂] [TopologicalSpace M₃]
[AddCommGroup M₃] [TopologicalSpace M₄] [AddCommGroup M₄]
theorem IsCompactOperator.smul {S : Type*} [Monoid S] [DistribMulAction S M₂]
[ContinuousConstSMul S M₂] {f : M₁ → M₂} (hf : IsCompactOperator f) (c : S) :
IsCompactOperator (c • f) :=
let ⟨K, hK, hKf⟩ := hf
⟨c • K, hK.image <| continuous_id.const_smul c,
mem_of_superset hKf fun _ hx => smul_mem_smul_set hx⟩
#align is_compact_operator.smul IsCompactOperator.smul
theorem IsCompactOperator.add [ContinuousAdd M₂] {f g : M₁ → M₂} (hf : IsCompactOperator f)
(hg : IsCompactOperator g) : IsCompactOperator (f + g) :=
let ⟨A, hA, hAf⟩ := hf
let ⟨B, hB, hBg⟩ := hg
⟨A + B, hA.add hB,
mem_of_superset (inter_mem hAf hBg) fun _ ⟨hxA, hxB⟩ => Set.add_mem_add hxA hxB⟩
#align is_compact_operator.add IsCompactOperator.add
theorem IsCompactOperator.neg [ContinuousNeg M₄] {f : M₁ → M₄} (hf : IsCompactOperator f) :
IsCompactOperator (-f) :=
let ⟨K, hK, hKf⟩ := hf
⟨-K, hK.neg, mem_of_superset hKf fun x (hx : f x ∈ K) => Set.neg_mem_neg.mpr hx⟩
#align is_compact_operator.neg IsCompactOperator.neg
| Mathlib/Analysis/NormedSpace/CompactOperator.lean | 228 | 230 | theorem IsCompactOperator.sub [TopologicalAddGroup M₄] {f g : M₁ → M₄} (hf : IsCompactOperator f)
(hg : IsCompactOperator g) : IsCompactOperator (f - g) := by |
rw [sub_eq_add_neg]; exact hf.add hg.neg
| 1 |
import Mathlib.Algebra.Category.ModuleCat.Basic
import Mathlib.LinearAlgebra.TensorProduct.Basic
import Mathlib.CategoryTheory.Monoidal.Linear
#align_import algebra.category.Module.monoidal.basic from "leanprover-community/mathlib"@"74403a3b2551b0970855e14ef5e8fd0d6af1bfc2"
-- Porting note: Module
set_option linter.uppercaseLean3 false
suppress_compilation
universe v w x u
open CategoryTheory
namespace ModuleCat
variable {R : Type u} [CommRing R]
namespace MonoidalCategory
-- The definitions inside this namespace are essentially private.
-- After we build the `MonoidalCategory (Module R)` instance,
-- you should use that API.
open TensorProduct
attribute [local ext] TensorProduct.ext
def tensorObj (M N : ModuleCat R) : ModuleCat R :=
ModuleCat.of R (M ⊗[R] N)
#align Module.monoidal_category.tensor_obj ModuleCat.MonoidalCategory.tensorObj
def tensorHom {M N M' N' : ModuleCat R} (f : M ⟶ N) (g : M' ⟶ N') :
tensorObj M M' ⟶ tensorObj N N' :=
TensorProduct.map f g
#align Module.monoidal_category.tensor_hom ModuleCat.MonoidalCategory.tensorHom
def whiskerLeft (M : ModuleCat R) {N₁ N₂ : ModuleCat R} (f : N₁ ⟶ N₂) :
tensorObj M N₁ ⟶ tensorObj M N₂ :=
f.lTensor M
def whiskerRight {M₁ M₂ : ModuleCat R} (f : M₁ ⟶ M₂) (N : ModuleCat R) :
tensorObj M₁ N ⟶ tensorObj M₂ N :=
f.rTensor N
theorem tensor_id (M N : ModuleCat R) : tensorHom (𝟙 M) (𝟙 N) = 𝟙 (ModuleCat.of R (M ⊗ N)) := by
-- Porting note: even with high priority ext fails to find this
apply TensorProduct.ext
rfl
#align Module.monoidal_category.tensor_id ModuleCat.MonoidalCategory.tensor_id
theorem tensor_comp {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁)
(g₂ : Y₂ ⟶ Z₂) : tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂ := by
-- Porting note: even with high priority ext fails to find this
apply TensorProduct.ext
rfl
#align Module.monoidal_category.tensor_comp ModuleCat.MonoidalCategory.tensor_comp
def associator (M : ModuleCat.{v} R) (N : ModuleCat.{w} R) (K : ModuleCat.{x} R) :
tensorObj (tensorObj M N) K ≅ tensorObj M (tensorObj N K) :=
(TensorProduct.assoc R M N K).toModuleIso
#align Module.monoidal_category.associator ModuleCat.MonoidalCategory.associator
def leftUnitor (M : ModuleCat.{u} R) : ModuleCat.of R (R ⊗[R] M) ≅ M :=
(LinearEquiv.toModuleIso (TensorProduct.lid R M) : of R (R ⊗ M) ≅ of R M).trans (ofSelfIso M)
#align Module.monoidal_category.left_unitor ModuleCat.MonoidalCategory.leftUnitor
def rightUnitor (M : ModuleCat.{u} R) : ModuleCat.of R (M ⊗[R] R) ≅ M :=
(LinearEquiv.toModuleIso (TensorProduct.rid R M) : of R (M ⊗ R) ≅ of R M).trans (ofSelfIso M)
#align Module.monoidal_category.right_unitor ModuleCat.MonoidalCategory.rightUnitor
instance : MonoidalCategoryStruct (ModuleCat.{u} R) where
tensorObj := tensorObj
whiskerLeft := whiskerLeft
whiskerRight := whiskerRight
tensorHom f g := TensorProduct.map f g
tensorUnit := ModuleCat.of R R
associator := associator
leftUnitor := leftUnitor
rightUnitor := rightUnitor
section
open TensorProduct (assoc map)
private theorem associator_naturality_aux {X₁ X₂ X₃ : Type*} [AddCommMonoid X₁] [AddCommMonoid X₂]
[AddCommMonoid X₃] [Module R X₁] [Module R X₂] [Module R X₃] {Y₁ Y₂ Y₃ : Type*}
[AddCommMonoid Y₁] [AddCommMonoid Y₂] [AddCommMonoid Y₃] [Module R Y₁] [Module R Y₂]
[Module R Y₃] (f₁ : X₁ →ₗ[R] Y₁) (f₂ : X₂ →ₗ[R] Y₂) (f₃ : X₃ →ₗ[R] Y₃) :
↑(assoc R Y₁ Y₂ Y₃) ∘ₗ map (map f₁ f₂) f₃ = map f₁ (map f₂ f₃) ∘ₗ ↑(assoc R X₁ X₂ X₃) := by
apply TensorProduct.ext_threefold
intro x y z
rfl
-- Porting note: private so hopeful never used outside this file
-- #align Module.monoidal_category.associator_naturality_aux ModuleCat.MonoidalCategory.associator_naturality_aux
variable (R)
private theorem pentagon_aux (W X Y Z : Type*) [AddCommMonoid W] [AddCommMonoid X]
[AddCommMonoid Y] [AddCommMonoid Z] [Module R W] [Module R X] [Module R Y] [Module R Z] :
(((assoc R X Y Z).toLinearMap.lTensor W).comp
(assoc R W (X ⊗[R] Y) Z).toLinearMap).comp
((assoc R W X Y).toLinearMap.rTensor Z) =
(assoc R W X (Y ⊗[R] Z)).toLinearMap.comp (assoc R (W ⊗[R] X) Y Z).toLinearMap := by
apply TensorProduct.ext_fourfold
intro w x y z
rfl
-- Porting note: private so hopeful never used outside this file
-- #align Module.monoidal_category.pentagon_aux Module.monoidal_category.pentagon_aux
end
theorem associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃ : ModuleCat R} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂)
(f₃ : X₃ ⟶ Y₃) :
tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom =
(associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃) := by
convert associator_naturality_aux f₁ f₂ f₃ using 1
#align Module.monoidal_category.associator_naturality ModuleCat.MonoidalCategory.associator_naturality
| Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean | 158 | 162 | theorem pentagon (W X Y Z : ModuleCat R) :
whiskerRight (associator W X Y).hom Z ≫
(associator W (tensorObj X Y) Z).hom ≫ whiskerLeft W (associator X Y Z).hom =
(associator (tensorObj W X) Y Z).hom ≫ (associator W X (tensorObj Y Z)).hom := by |
convert pentagon_aux R W X Y Z using 1
| 1 |
import Mathlib.Algebra.Ring.Prod
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.Tactic.FinCases
#align_import data.zmod.basic from "leanprover-community/mathlib"@"74ad1c88c77e799d2fea62801d1dbbd698cff1b7"
assert_not_exists Submodule
open Function
namespace ZMod
instance charZero : CharZero (ZMod 0) := inferInstanceAs (CharZero ℤ)
def val : ∀ {n : ℕ}, ZMod n → ℕ
| 0 => Int.natAbs
| n + 1 => ((↑) : Fin (n + 1) → ℕ)
#align zmod.val ZMod.val
theorem val_lt {n : ℕ} [NeZero n] (a : ZMod n) : a.val < n := by
cases n
· cases NeZero.ne 0 rfl
exact Fin.is_lt a
#align zmod.val_lt ZMod.val_lt
theorem val_le {n : ℕ} [NeZero n] (a : ZMod n) : a.val ≤ n :=
a.val_lt.le
#align zmod.val_le ZMod.val_le
@[simp]
theorem val_zero : ∀ {n}, (0 : ZMod n).val = 0
| 0 => rfl
| _ + 1 => rfl
#align zmod.val_zero ZMod.val_zero
@[simp]
theorem val_one' : (1 : ZMod 0).val = 1 :=
rfl
#align zmod.val_one' ZMod.val_one'
@[simp]
theorem val_neg' {n : ZMod 0} : (-n).val = n.val :=
Int.natAbs_neg n
#align zmod.val_neg' ZMod.val_neg'
@[simp]
theorem val_mul' {m n : ZMod 0} : (m * n).val = m.val * n.val :=
Int.natAbs_mul m n
#align zmod.val_mul' ZMod.val_mul'
@[simp]
theorem val_natCast {n : ℕ} (a : ℕ) : (a : ZMod n).val = a % n := by
cases n
· rw [Nat.mod_zero]
exact Int.natAbs_ofNat a
· apply Fin.val_natCast
#align zmod.val_nat_cast ZMod.val_natCast
@[deprecated (since := "2024-04-17")]
alias val_nat_cast := val_natCast
theorem val_unit' {n : ZMod 0} : IsUnit n ↔ n.val = 1 := by
simp only [val]
rw [Int.isUnit_iff, Int.natAbs_eq_iff, Nat.cast_one]
lemma eq_one_of_isUnit_natCast {n : ℕ} (h : IsUnit (n : ZMod 0)) : n = 1 := by
rw [← Nat.mod_zero n, ← val_natCast, val_unit'.mp h]
| Mathlib/Data/ZMod/Basic.lean | 101 | 102 | theorem val_natCast_of_lt {n a : ℕ} (h : a < n) : (a : ZMod n).val = a := by |
rwa [val_natCast, Nat.mod_eq_of_lt]
| 1 |
import Mathlib.Data.Opposite
import Mathlib.Data.Set.Defs
#align_import data.set.opposite from "leanprover-community/mathlib"@"fc2ed6f838ce7c9b7c7171e58d78eaf7b438fb0e"
variable {α : Type*}
open Opposite
namespace Set
protected def op (s : Set α) : Set αᵒᵖ :=
unop ⁻¹' s
#align set.op Set.op
protected def unop (s : Set αᵒᵖ) : Set α :=
op ⁻¹' s
#align set.unop Set.unop
@[simp]
theorem mem_op {s : Set α} {a : αᵒᵖ} : a ∈ s.op ↔ unop a ∈ s :=
Iff.rfl
#align set.mem_op Set.mem_op
@[simp 1100]
theorem op_mem_op {s : Set α} {a : α} : op a ∈ s.op ↔ a ∈ s := by rfl
#align set.op_mem_op Set.op_mem_op
@[simp]
theorem mem_unop {s : Set αᵒᵖ} {a : α} : a ∈ s.unop ↔ op a ∈ s :=
Iff.rfl
#align set.mem_unop Set.mem_unop
@[simp 1100]
| Mathlib/Data/Set/Opposite.lean | 48 | 48 | theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by | rfl
| 1 |
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
#align_import analysis.ODE.gronwall from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] {F : Type*} [NormedAddCommGroup F]
[NormedSpace ℝ F]
open Metric Set Asymptotics Filter Real
open scoped Classical Topology NNReal
noncomputable def gronwallBound (δ K ε x : ℝ) : ℝ :=
if K = 0 then δ + ε * x else δ * exp (K * x) + ε / K * (exp (K * x) - 1)
#align gronwall_bound gronwallBound
theorem gronwallBound_K0 (δ ε : ℝ) : gronwallBound δ 0 ε = fun x => δ + ε * x :=
funext fun _ => if_pos rfl
set_option linter.uppercaseLean3 false in
#align gronwall_bound_K0 gronwallBound_K0
theorem gronwallBound_of_K_ne_0 {δ K ε : ℝ} (hK : K ≠ 0) :
gronwallBound δ K ε = fun x => δ * exp (K * x) + ε / K * (exp (K * x) - 1) :=
funext fun _ => if_neg hK
set_option linter.uppercaseLean3 false in
#align gronwall_bound_of_K_ne_0 gronwallBound_of_K_ne_0
theorem hasDerivAt_gronwallBound (δ K ε x : ℝ) :
HasDerivAt (gronwallBound δ K ε) (K * gronwallBound δ K ε x + ε) x := by
by_cases hK : K = 0
· subst K
simp only [gronwallBound_K0, zero_mul, zero_add]
convert ((hasDerivAt_id x).const_mul ε).const_add δ
rw [mul_one]
· simp only [gronwallBound_of_K_ne_0 hK]
convert (((hasDerivAt_id x).const_mul K).exp.const_mul δ).add
((((hasDerivAt_id x).const_mul K).exp.sub_const 1).const_mul (ε / K)) using 1
simp only [id, mul_add, (mul_assoc _ _ _).symm, mul_comm _ K, mul_div_cancel₀ _ hK]
ring
#align has_deriv_at_gronwall_bound hasDerivAt_gronwallBound
theorem hasDerivAt_gronwallBound_shift (δ K ε x a : ℝ) :
HasDerivAt (fun y => gronwallBound δ K ε (y - a)) (K * gronwallBound δ K ε (x - a) + ε) x := by
convert (hasDerivAt_gronwallBound δ K ε _).comp x ((hasDerivAt_id x).sub_const a) using 1
rw [id, mul_one]
#align has_deriv_at_gronwall_bound_shift hasDerivAt_gronwallBound_shift
theorem gronwallBound_x0 (δ K ε : ℝ) : gronwallBound δ K ε 0 = δ := by
by_cases hK : K = 0
· simp only [gronwallBound, if_pos hK, mul_zero, add_zero]
· simp only [gronwallBound, if_neg hK, mul_zero, exp_zero, sub_self, mul_one,
add_zero]
#align gronwall_bound_x0 gronwallBound_x0
theorem gronwallBound_ε0 (δ K x : ℝ) : gronwallBound δ K 0 x = δ * exp (K * x) := by
by_cases hK : K = 0
· simp only [gronwallBound_K0, hK, zero_mul, exp_zero, add_zero, mul_one]
· simp only [gronwallBound_of_K_ne_0 hK, zero_div, zero_mul, add_zero]
#align gronwall_bound_ε0 gronwallBound_ε0
| Mathlib/Analysis/ODE/Gronwall.lean | 92 | 93 | theorem gronwallBound_ε0_δ0 (K x : ℝ) : gronwallBound 0 K 0 x = 0 := by |
simp only [gronwallBound_ε0, zero_mul]
| 1 |
import Mathlib.Analysis.NormedSpace.Multilinear.Basic
import Mathlib.Analysis.NormedSpace.Units
import Mathlib.Analysis.NormedSpace.OperatorNorm.Completeness
import Mathlib.Analysis.NormedSpace.OperatorNorm.Mul
#align_import analysis.normed_space.bounded_linear_maps from "leanprover-community/mathlib"@"ce11c3c2a285bbe6937e26d9792fda4e51f3fe1a"
noncomputable section
open Topology
open Filter (Tendsto)
open Metric ContinuousLinearMap
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] {G : Type*}
[NormedAddCommGroup G] [NormedSpace 𝕜 G]
structure IsBoundedLinearMap (𝕜 : Type*) [NormedField 𝕜] {E : Type*} [NormedAddCommGroup E]
[NormedSpace 𝕜 E] {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F] (f : E → F) extends
IsLinearMap 𝕜 f : Prop where
bound : ∃ M, 0 < M ∧ ∀ x : E, ‖f x‖ ≤ M * ‖x‖
#align is_bounded_linear_map IsBoundedLinearMap
theorem IsLinearMap.with_bound {f : E → F} (hf : IsLinearMap 𝕜 f) (M : ℝ)
(h : ∀ x : E, ‖f x‖ ≤ M * ‖x‖) : IsBoundedLinearMap 𝕜 f :=
⟨hf,
by_cases
(fun (this : M ≤ 0) =>
⟨1, zero_lt_one, fun x =>
(h x).trans <| mul_le_mul_of_nonneg_right (this.trans zero_le_one) (norm_nonneg x)⟩)
fun (this : ¬M ≤ 0) => ⟨M, lt_of_not_ge this, h⟩⟩
#align is_linear_map.with_bound IsLinearMap.with_bound
theorem ContinuousLinearMap.isBoundedLinearMap (f : E →L[𝕜] F) : IsBoundedLinearMap 𝕜 f :=
{ f.toLinearMap.isLinear with bound := f.bound }
#align continuous_linear_map.is_bounded_linear_map ContinuousLinearMap.isBoundedLinearMap
section
variable {ι : Type*} [Fintype ι]
theorem isBoundedLinearMap_prod_multilinear {E : ι → Type*} [∀ i, NormedAddCommGroup (E i)]
[∀ i, NormedSpace 𝕜 (E i)] :
IsBoundedLinearMap 𝕜 fun p : ContinuousMultilinearMap 𝕜 E F × ContinuousMultilinearMap 𝕜 E G =>
p.1.prod p.2 where
map_add p₁ p₂ := by ext : 1; rfl
map_smul c p := by ext : 1; rfl
bound := by
refine ⟨1, zero_lt_one, fun p ↦ ?_⟩
rw [one_mul]
apply ContinuousMultilinearMap.opNorm_le_bound _ (norm_nonneg _) _
intro m
rw [ContinuousMultilinearMap.prod_apply, norm_prod_le_iff]
constructor
· exact (p.1.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_fst_le p) <| by positivity)
· exact (p.2.le_opNorm m).trans (mul_le_mul_of_nonneg_right (norm_snd_le p) <| by positivity)
#align is_bounded_linear_map_prod_multilinear isBoundedLinearMap_prod_multilinear
theorem isBoundedLinearMap_continuousMultilinearMap_comp_linear (g : G →L[𝕜] E) :
IsBoundedLinearMap 𝕜 fun f : ContinuousMultilinearMap 𝕜 (fun _ : ι => E) F =>
f.compContinuousLinearMap fun _ => g := by
refine
IsLinearMap.with_bound
⟨fun f₁ f₂ => by ext; rfl,
fun c f => by ext; rfl⟩
(‖g‖ ^ Fintype.card ι) fun f => ?_
apply ContinuousMultilinearMap.opNorm_le_bound _ _ _
· apply_rules [mul_nonneg, pow_nonneg, norm_nonneg]
intro m
calc
‖f (g ∘ m)‖ ≤ ‖f‖ * ∏ i, ‖g (m i)‖ := f.le_opNorm _
_ ≤ ‖f‖ * ∏ i, ‖g‖ * ‖m i‖ := by
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
exact Finset.prod_le_prod (fun i _ => norm_nonneg _) fun i _ => g.le_opNorm _
_ = ‖g‖ ^ Fintype.card ι * ‖f‖ * ∏ i, ‖m i‖ := by
simp only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ]
ring
#align is_bounded_linear_map_continuous_multilinear_map_comp_linear isBoundedLinearMap_continuousMultilinearMap_comp_linear
end
section BilinearMap
namespace ContinuousLinearMap
variable {R : Type*}
variable {𝕜₂ 𝕜' : Type*} [NontriviallyNormedField 𝕜'] [NontriviallyNormedField 𝕜₂]
variable {M : Type*} [TopologicalSpace M]
variable {σ₁₂ : 𝕜 →+* 𝕜₂}
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜₂ G'] [NormedSpace 𝕜' G']
variable [SMulCommClass 𝕜₂ 𝕜' G']
section Semiring
variable [Semiring R] [AddCommMonoid M] [Module R M] {ρ₁₂ : R →+* 𝕜'}
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 285 | 286 | theorem map_add₂ (f : M →SL[ρ₁₂] F →SL[σ₁₂] G') (x x' : M) (y : F) :
f (x + x') y = f x y + f x' y := by | rw [f.map_add, add_apply]
| 1 |
import Mathlib.Algebra.GCDMonoid.Finset
import Mathlib.Algebra.Polynomial.CancelLeads
import Mathlib.Algebra.Polynomial.EraseLead
import Mathlib.Algebra.Polynomial.FieldDivision
#align_import ring_theory.polynomial.content from "leanprover-community/mathlib"@"7a030ab8eb5d99f05a891dccc49c5b5b90c947d3"
namespace Polynomial
open Polynomial
variable {R : Type*} [CommRing R] [IsDomain R]
section NormalizedGCDMonoid
variable [NormalizedGCDMonoid R]
def content (p : R[X]) : R :=
p.support.gcd p.coeff
#align polynomial.content Polynomial.content
theorem content_dvd_coeff {p : R[X]} (n : ℕ) : p.content ∣ p.coeff n := by
by_cases h : n ∈ p.support
· apply Finset.gcd_dvd h
rw [mem_support_iff, Classical.not_not] at h
rw [h]
apply dvd_zero
#align polynomial.content_dvd_coeff Polynomial.content_dvd_coeff
@[simp]
theorem content_C {r : R} : (C r).content = normalize r := by
rw [content]
by_cases h0 : r = 0
· simp [h0]
have h : (C r).support = {0} := support_monomial _ h0
simp [h]
set_option linter.uppercaseLean3 false in
#align polynomial.content_C Polynomial.content_C
@[simp]
theorem content_zero : content (0 : R[X]) = 0 := by rw [← C_0, content_C, normalize_zero]
#align polynomial.content_zero Polynomial.content_zero
@[simp]
theorem content_one : content (1 : R[X]) = 1 := by rw [← C_1, content_C, normalize_one]
#align polynomial.content_one Polynomial.content_one
theorem content_X_mul {p : R[X]} : content (X * p) = content p := by
rw [content, content, Finset.gcd_def, Finset.gcd_def]
refine congr rfl ?_
have h : (X * p).support = p.support.map ⟨Nat.succ, Nat.succ_injective⟩ := by
ext a
simp only [exists_prop, Finset.mem_map, Function.Embedding.coeFn_mk, Ne, mem_support_iff]
cases' a with a
· simp [coeff_X_mul_zero, Nat.succ_ne_zero]
rw [mul_comm, coeff_mul_X]
constructor
· intro h
use a
· rintro ⟨b, ⟨h1, h2⟩⟩
rw [← Nat.succ_injective h2]
apply h1
rw [h]
simp only [Finset.map_val, Function.comp_apply, Function.Embedding.coeFn_mk, Multiset.map_map]
refine congr (congr rfl ?_) rfl
ext a
rw [mul_comm]
simp [coeff_mul_X]
set_option linter.uppercaseLean3 false in
#align polynomial.content_X_mul Polynomial.content_X_mul
@[simp]
theorem content_X_pow {k : ℕ} : content ((X : R[X]) ^ k) = 1 := by
induction' k with k hi
· simp
rw [pow_succ', content_X_mul, hi]
set_option linter.uppercaseLean3 false in
#align polynomial.content_X_pow Polynomial.content_X_pow
@[simp]
| Mathlib/RingTheory/Polynomial/Content.lean | 142 | 142 | theorem content_X : content (X : R[X]) = 1 := by | rw [← mul_one X, content_X_mul, content_one]
| 1 |
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
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]
_ = 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]
#align one_div_neg_eq_neg_one_div one_div_neg_eq_neg_one_div
theorem div_neg_eq_neg_div (a b : K) : b / -a = -(b / a) :=
calc
b / -a = b * (1 / -a) := by rw [← inv_eq_one_div, division_def]
_ = b * -(1 / a) := by rw [one_div_neg_eq_neg_one_div]
_ = -(b * (1 / a)) := by rw [neg_mul_eq_mul_neg]
_ = -(b / a) := by rw [mul_one_div]
#align div_neg_eq_neg_div div_neg_eq_neg_div
theorem neg_div (a b : K) : -b / a = -(b / a) := by
rw [neg_eq_neg_one_mul, mul_div_assoc, ← neg_eq_neg_one_mul]
#align neg_div neg_div
@[field_simps]
theorem neg_div' (a b : K) : -(b / a) = -b / a := by simp [neg_div]
#align neg_div' neg_div'
@[simp]
theorem neg_div_neg_eq (a b : K) : -a / -b = a / b := by rw [div_neg_eq_neg_div, neg_div, neg_neg]
#align neg_div_neg_eq neg_div_neg_eq
theorem neg_inv : -a⁻¹ = (-a)⁻¹ := by rw [inv_eq_one_div, inv_eq_one_div, div_neg_eq_neg_div]
#align neg_inv neg_inv
theorem div_neg (a : K) : a / -b = -(a / b) := by rw [← div_neg_eq_neg_div]
#align div_neg div_neg
theorem inv_neg : (-a)⁻¹ = -a⁻¹ := by rw [neg_inv]
#align inv_neg inv_neg
| Mathlib/Algebra/Field/Basic.lean | 138 | 138 | theorem inv_neg_one : (-1 : K)⁻¹ = -1 := by | rw [← neg_inv, inv_one]
| 1 |
import Mathlib.Algebra.Polynomial.Degree.Definitions
import Mathlib.Algebra.Polynomial.Eval
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Polynomial.RingDivision
import Mathlib.Tactic.Abel
#align_import ring_theory.polynomial.pochhammer from "leanprover-community/mathlib"@"53b216bcc1146df1c4a0a86877890ea9f1f01589"
universe u v
open Polynomial
open Polynomial
section Semiring
variable (S : Type u) [Semiring S]
noncomputable def ascPochhammer : ℕ → S[X]
| 0 => 1
| n + 1 => X * (ascPochhammer n).comp (X + 1)
#align pochhammer ascPochhammer
@[simp]
theorem ascPochhammer_zero : ascPochhammer S 0 = 1 :=
rfl
#align pochhammer_zero ascPochhammer_zero
@[simp]
| Mathlib/RingTheory/Polynomial/Pochhammer.lean | 61 | 61 | theorem ascPochhammer_one : ascPochhammer S 1 = X := by | simp [ascPochhammer]
| 1 |
import Mathlib.Algebra.Order.Ring.Cast
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Nat.Bitwise
import Mathlib.Data.Nat.PSub
import Mathlib.Data.Nat.Size
import Mathlib.Data.Num.Bitwise
#align_import data.num.lemmas from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
set_option linter.deprecated false
-- Porting note: Required for the notation `-[n+1]`.
open Int Function
attribute [local simp] add_assoc
namespace ZNum
variable {α : Type*}
open PosNum
@[simp, norm_cast]
theorem cast_zero [Zero α] [One α] [Add α] [Neg α] : ((0 : ZNum) : α) = 0 :=
rfl
#align znum.cast_zero ZNum.cast_zero
@[simp]
theorem cast_zero' [Zero α] [One α] [Add α] [Neg α] : (ZNum.zero : α) = 0 :=
rfl
#align znum.cast_zero' ZNum.cast_zero'
@[simp, norm_cast]
theorem cast_one [Zero α] [One α] [Add α] [Neg α] : ((1 : ZNum) : α) = 1 :=
rfl
#align znum.cast_one ZNum.cast_one
@[simp]
theorem cast_pos [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (pos n : α) = n :=
rfl
#align znum.cast_pos ZNum.cast_pos
@[simp]
theorem cast_neg [Zero α] [One α] [Add α] [Neg α] (n : PosNum) : (neg n : α) = -n :=
rfl
#align znum.cast_neg ZNum.cast_neg
@[simp, norm_cast]
theorem cast_zneg [AddGroup α] [One α] : ∀ n, ((-n : ZNum) : α) = -n
| 0 => neg_zero.symm
| pos _p => rfl
| neg _p => (neg_neg _).symm
#align znum.cast_zneg ZNum.cast_zneg
theorem neg_zero : (-0 : ZNum) = 0 :=
rfl
#align znum.neg_zero ZNum.neg_zero
theorem zneg_pos (n : PosNum) : -pos n = neg n :=
rfl
#align znum.zneg_pos ZNum.zneg_pos
theorem zneg_neg (n : PosNum) : -neg n = pos n :=
rfl
#align znum.zneg_neg ZNum.zneg_neg
theorem zneg_zneg (n : ZNum) : - -n = n := by cases n <;> rfl
#align znum.zneg_zneg ZNum.zneg_zneg
| Mathlib/Data/Num/Lemmas.lean | 1,056 | 1,056 | theorem zneg_bit1 (n : ZNum) : -n.bit1 = (-n).bitm1 := by | cases n <;> rfl
| 1 |
import Mathlib.Algebra.MvPolynomial.Degrees
#align_import data.mv_polynomial.variables from "leanprover-community/mathlib"@"2f5b500a507264de86d666a5f87ddb976e2d8de4"
noncomputable section
open Set Function Finsupp AddMonoidAlgebra
universe u v w
variable {R : Type u} {S : Type v}
namespace MvPolynomial
variable {σ τ : Type*} {r : R} {e : ℕ} {n m : σ} {s : σ →₀ ℕ}
section CommSemiring
variable [CommSemiring R] {p q : MvPolynomial σ R}
section Vars
def vars (p : MvPolynomial σ R) : Finset σ :=
letI := Classical.decEq σ
p.degrees.toFinset
#align mv_polynomial.vars MvPolynomial.vars
theorem vars_def [DecidableEq σ] (p : MvPolynomial σ R) : p.vars = p.degrees.toFinset := by
rw [vars]
convert rfl
#align mv_polynomial.vars_def MvPolynomial.vars_def
@[simp]
theorem vars_0 : (0 : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_zero, Multiset.toFinset_zero]
#align mv_polynomial.vars_0 MvPolynomial.vars_0
@[simp]
theorem vars_monomial (h : r ≠ 0) : (monomial s r).vars = s.support := by
classical rw [vars_def, degrees_monomial_eq _ _ h, Finsupp.toFinset_toMultiset]
#align mv_polynomial.vars_monomial MvPolynomial.vars_monomial
@[simp]
theorem vars_C : (C r : MvPolynomial σ R).vars = ∅ := by
classical rw [vars_def, degrees_C, Multiset.toFinset_zero]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_C MvPolynomial.vars_C
@[simp]
theorem vars_X [Nontrivial R] : (X n : MvPolynomial σ R).vars = {n} := by
rw [X, vars_monomial (one_ne_zero' R), Finsupp.support_single_ne_zero _ (one_ne_zero' ℕ)]
set_option linter.uppercaseLean3 false in
#align mv_polynomial.vars_X MvPolynomial.vars_X
theorem mem_vars (i : σ) : i ∈ p.vars ↔ ∃ d ∈ p.support, i ∈ d.support := by
classical simp only [vars_def, Multiset.mem_toFinset, mem_degrees, mem_support_iff, exists_prop]
#align mv_polynomial.mem_vars MvPolynomial.mem_vars
theorem mem_support_not_mem_vars_zero {f : MvPolynomial σ R} {x : σ →₀ ℕ} (H : x ∈ f.support)
{v : σ} (h : v ∉ vars f) : x v = 0 := by
contrapose! h
exact (mem_vars v).mpr ⟨x, H, Finsupp.mem_support_iff.mpr h⟩
#align mv_polynomial.mem_support_not_mem_vars_zero MvPolynomial.mem_support_not_mem_vars_zero
theorem vars_add_subset [DecidableEq σ] (p q : MvPolynomial σ R) :
(p + q).vars ⊆ p.vars ∪ q.vars := by
intro x hx
simp only [vars_def, Finset.mem_union, Multiset.mem_toFinset] at hx ⊢
simpa using Multiset.mem_of_le (degrees_add _ _) hx
#align mv_polynomial.vars_add_subset MvPolynomial.vars_add_subset
theorem vars_add_of_disjoint [DecidableEq σ] (h : Disjoint p.vars q.vars) :
(p + q).vars = p.vars ∪ q.vars := by
refine (vars_add_subset p q).antisymm fun x hx => ?_
simp only [vars_def, Multiset.disjoint_toFinset] at h hx ⊢
rwa [degrees_add_of_disjoint h, Multiset.toFinset_union]
#align mv_polynomial.vars_add_of_disjoint MvPolynomial.vars_add_of_disjoint
section Mul
theorem vars_mul [DecidableEq σ] (φ ψ : MvPolynomial σ R) : (φ * ψ).vars ⊆ φ.vars ∪ ψ.vars := by
simp_rw [vars_def, ← Multiset.toFinset_add, Multiset.toFinset_subset]
exact Multiset.subset_of_le (degrees_mul φ ψ)
#align mv_polynomial.vars_mul MvPolynomial.vars_mul
@[simp]
theorem vars_one : (1 : MvPolynomial σ R).vars = ∅ :=
vars_C
#align mv_polynomial.vars_one MvPolynomial.vars_one
theorem vars_pow (φ : MvPolynomial σ R) (n : ℕ) : (φ ^ n).vars ⊆ φ.vars := by
classical
induction' n with n ih
· simp
· rw [pow_succ']
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset (Finset.Subset.refl _) ih
#align mv_polynomial.vars_pow MvPolynomial.vars_pow
theorem vars_prod {ι : Type*} [DecidableEq σ] {s : Finset ι} (f : ι → MvPolynomial σ R) :
(∏ i ∈ s, f i).vars ⊆ s.biUnion fun i => (f i).vars := by
classical
induction s using Finset.induction_on with
| empty => simp
| insert hs hsub =>
simp only [hs, Finset.biUnion_insert, Finset.prod_insert, not_false_iff]
apply Finset.Subset.trans (vars_mul _ _)
exact Finset.union_subset_union (Finset.Subset.refl _) hsub
#align mv_polynomial.vars_prod MvPolynomial.vars_prod
section Map
variable [CommSemiring S] (f : R →+* S)
variable (p)
theorem vars_map : (map f p).vars ⊆ p.vars := by classical simp [vars_def, degrees_map]
#align mv_polynomial.vars_map MvPolynomial.vars_map
variable {f}
theorem vars_map_of_injective (hf : Injective f) : (map f p).vars = p.vars := by
simp [vars, degrees_map_of_injective _ hf]
#align mv_polynomial.vars_map_of_injective MvPolynomial.vars_map_of_injective
| Mathlib/Algebra/MvPolynomial/Variables.lean | 226 | 228 | theorem vars_monomial_single (i : σ) {e : ℕ} {r : R} (he : e ≠ 0) (hr : r ≠ 0) :
(monomial (Finsupp.single i e) r).vars = {i} := by |
rw [vars_monomial hr, Finsupp.support_single_ne_zero _ he]
| 1 |
import Mathlib.Topology.Algebra.GroupWithZero
import Mathlib.Topology.Order.OrderClosed
#align_import topology.algebra.with_zero_topology from "leanprover-community/mathlib"@"3e0c4d76b6ebe9dfafb67d16f7286d2731ed6064"
open Topology Filter TopologicalSpace Filter Set Function
namespace WithZeroTopology
variable {α Γ₀ : Type*} [LinearOrderedCommGroupWithZero Γ₀] {γ γ₁ γ₂ : Γ₀} {l : Filter α}
{f : α → Γ₀}
scoped instance (priority := 100) topologicalSpace : TopologicalSpace Γ₀ :=
nhdsAdjoint 0 <| ⨅ γ ≠ 0, 𝓟 (Iio γ)
#align with_zero_topology.topological_space WithZeroTopology.topologicalSpace
theorem nhds_eq_update : (𝓝 : Γ₀ → Filter Γ₀) = update pure 0 (⨅ γ ≠ 0, 𝓟 (Iio γ)) := by
rw [nhds_nhdsAdjoint, sup_of_le_right]
exact le_iInf₂ fun γ hγ ↦ le_principal_iff.2 <| zero_lt_iff.2 hγ
#align with_zero_topology.nhds_eq_update WithZeroTopology.nhds_eq_update
theorem nhds_zero : 𝓝 (0 : Γ₀) = ⨅ γ ≠ 0, 𝓟 (Iio γ) := by
rw [nhds_eq_update, update_same]
#align with_zero_topology.nhds_zero WithZeroTopology.nhds_zero
theorem hasBasis_nhds_zero : (𝓝 (0 : Γ₀)).HasBasis (fun γ : Γ₀ => γ ≠ 0) Iio := by
rw [nhds_zero]
refine hasBasis_biInf_principal ?_ ⟨1, one_ne_zero⟩
exact directedOn_iff_directed.2 (Monotone.directed_ge fun a b hab => Iio_subset_Iio hab)
#align with_zero_topology.has_basis_nhds_zero WithZeroTopology.hasBasis_nhds_zero
theorem Iio_mem_nhds_zero (hγ : γ ≠ 0) : Iio γ ∈ 𝓝 (0 : Γ₀) :=
hasBasis_nhds_zero.mem_of_mem hγ
#align with_zero_topology.Iio_mem_nhds_zero WithZeroTopology.Iio_mem_nhds_zero
theorem nhds_zero_of_units (γ : Γ₀ˣ) : Iio ↑γ ∈ 𝓝 (0 : Γ₀) :=
Iio_mem_nhds_zero γ.ne_zero
#align with_zero_topology.nhds_zero_of_units WithZeroTopology.nhds_zero_of_units
theorem tendsto_zero : Tendsto f l (𝓝 (0 : Γ₀)) ↔ ∀ (γ₀) (_ : γ₀ ≠ 0), ∀ᶠ x in l, f x < γ₀ := by
simp [nhds_zero]
#align with_zero_topology.tendsto_zero WithZeroTopology.tendsto_zero
@[simp]
theorem nhds_of_ne_zero {γ : Γ₀} (h₀ : γ ≠ 0) : 𝓝 γ = pure γ :=
nhds_nhdsAdjoint_of_ne _ h₀
#align with_zero_topology.nhds_of_ne_zero WithZeroTopology.nhds_of_ne_zero
theorem nhds_coe_units (γ : Γ₀ˣ) : 𝓝 (γ : Γ₀) = pure (γ : Γ₀) :=
nhds_of_ne_zero γ.ne_zero
#align with_zero_topology.nhds_coe_units WithZeroTopology.nhds_coe_units
theorem singleton_mem_nhds_of_units (γ : Γ₀ˣ) : ({↑γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp
#align with_zero_topology.singleton_mem_nhds_of_units WithZeroTopology.singleton_mem_nhds_of_units
theorem singleton_mem_nhds_of_ne_zero (h : γ ≠ 0) : ({γ} : Set Γ₀) ∈ 𝓝 (γ : Γ₀) := by simp [h]
#align with_zero_topology.singleton_mem_nhds_of_ne_zero WithZeroTopology.singleton_mem_nhds_of_ne_zero
theorem hasBasis_nhds_of_ne_zero {x : Γ₀} (h : x ≠ 0) :
HasBasis (𝓝 x) (fun _ : Unit => True) fun _ => {x} := by
rw [nhds_of_ne_zero h]
exact hasBasis_pure _
#align with_zero_topology.has_basis_nhds_of_ne_zero WithZeroTopology.hasBasis_nhds_of_ne_zero
theorem hasBasis_nhds_units (γ : Γ₀ˣ) :
HasBasis (𝓝 (γ : Γ₀)) (fun _ : Unit => True) fun _ => {↑γ} :=
hasBasis_nhds_of_ne_zero γ.ne_zero
#align with_zero_topology.has_basis_nhds_units WithZeroTopology.hasBasis_nhds_units
theorem tendsto_of_ne_zero {γ : Γ₀} (h : γ ≠ 0) : Tendsto f l (𝓝 γ) ↔ ∀ᶠ x in l, f x = γ := by
rw [nhds_of_ne_zero h, tendsto_pure]
#align with_zero_topology.tendsto_of_ne_zero WithZeroTopology.tendsto_of_ne_zero
theorem tendsto_units {γ₀ : Γ₀ˣ} : Tendsto f l (𝓝 (γ₀ : Γ₀)) ↔ ∀ᶠ x in l, f x = γ₀ :=
tendsto_of_ne_zero γ₀.ne_zero
#align with_zero_topology.tendsto_units WithZeroTopology.tendsto_units
| Mathlib/Topology/Algebra/WithZeroTopology.lean | 128 | 129 | theorem Iio_mem_nhds (h : γ₁ < γ₂) : Iio γ₂ ∈ 𝓝 γ₁ := by |
rcases eq_or_ne γ₁ 0 with (rfl | h₀) <;> simp [*, h.ne', Iio_mem_nhds_zero]
| 1 |
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Linear.Basic
#align_import category_theory.linear.linear_functor from "leanprover-community/mathlib"@"829895f162a1f29d0133f4b3538f4cd1fb5bffd3"
namespace CategoryTheory
variable (R : Type*) [Semiring R]
class Functor.Linear {C D : Type*} [Category C] [Category D] [Preadditive C] [Preadditive D]
[Linear R C] [Linear R D] (F : C ⥤ D) [F.Additive] : Prop where
map_smul : ∀ {X Y : C} (f : X ⟶ Y) (r : R), F.map (r • f) = r • F.map f := by aesop_cat
#align category_theory.functor.linear CategoryTheory.Functor.Linear
section Linear
namespace Functor
section
variable {R}
variable {C D : Type*} [Category C] [Category D] [Preadditive C] [Preadditive D]
[CategoryTheory.Linear R C] [CategoryTheory.Linear R D] (F : C ⥤ D) [Additive F] [Linear R F]
@[simp]
theorem map_smul {X Y : C} (r : R) (f : X ⟶ Y) : F.map (r • f) = r • F.map f :=
Functor.Linear.map_smul _ _
#align category_theory.functor.map_smul CategoryTheory.Functor.map_smul
@[simp]
| Mathlib/CategoryTheory/Linear/LinearFunctor.lean | 53 | 54 | theorem map_units_smul {X Y : C} (r : Rˣ) (f : X ⟶ Y) : F.map (r • f) = r • F.map f := by |
apply map_smul
| 1 |
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.normed_space.basic from "leanprover-community/mathlib"@"bc91ed7093bf098d253401e69df601fc33dde156"
open Metric Set Function Filter
open scoped NNReal Topology
instance Real.punctured_nhds_module_neBot {E : Type*} [AddCommGroup E] [TopologicalSpace E]
[ContinuousAdd E] [Nontrivial E] [Module ℝ E] [ContinuousSMul ℝ E] (x : E) : NeBot (𝓝[≠] x) :=
Module.punctured_nhds_neBot ℝ E x
#align real.punctured_nhds_module_ne_bot Real.punctured_nhds_module_neBot
section Seminormed
variable {E : Type*} [SeminormedAddCommGroup E] [NormedSpace ℝ E]
theorem inv_norm_smul_mem_closed_unit_ball (x : E) :
‖x‖⁻¹ • x ∈ closedBall (0 : E) 1 := by
simp only [mem_closedBall_zero_iff, norm_smul, norm_inv, norm_norm, ← div_eq_inv_mul,
div_self_le_one]
#align inv_norm_smul_mem_closed_unit_ball inv_norm_smul_mem_closed_unit_ball
theorem norm_smul_of_nonneg {t : ℝ} (ht : 0 ≤ t) (x : E) : ‖t • x‖ = t * ‖x‖ := by
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht]
#align norm_smul_of_nonneg norm_smul_of_nonneg
theorem dist_smul_add_one_sub_smul_le {r : ℝ} {x y : E} (h : r ∈ Icc 0 1) :
dist (r • x + (1 - r) • y) x ≤ dist y x :=
calc
dist (r • x + (1 - r) • y) x = ‖1 - r‖ * ‖x - y‖ := by
simp_rw [dist_eq_norm', ← norm_smul, sub_smul, one_smul, smul_sub, ← sub_sub, ← sub_add,
sub_right_comm]
_ = (1 - r) * dist y x := by
rw [Real.norm_eq_abs, abs_eq_self.mpr (sub_nonneg.mpr h.2), dist_eq_norm']
_ ≤ (1 - 0) * dist y x := by gcongr; exact h.1
_ = dist y x := by rw [sub_zero, one_mul]
theorem closure_ball (x : E) {r : ℝ} (hr : r ≠ 0) : closure (ball x r) = closedBall x r := by
refine Subset.antisymm closure_ball_subset_closedBall fun y hy => ?_
have : ContinuousWithinAt (fun c : ℝ => c • (y - x) + x) (Ico 0 1) 1 :=
((continuous_id.smul continuous_const).add continuous_const).continuousWithinAt
convert this.mem_closure _ _
· rw [one_smul, sub_add_cancel]
· simp [closure_Ico zero_ne_one, zero_le_one]
· rintro c ⟨hc0, hc1⟩
rw [mem_ball, dist_eq_norm, add_sub_cancel_right, norm_smul, Real.norm_eq_abs,
abs_of_nonneg hc0, mul_comm, ← mul_one r]
rw [mem_closedBall, dist_eq_norm] at hy
replace hr : 0 < r := ((norm_nonneg _).trans hy).lt_of_ne hr.symm
apply mul_lt_mul' <;> assumption
#align closure_ball closure_ball
theorem frontier_ball (x : E) {r : ℝ} (hr : r ≠ 0) :
frontier (ball x r) = sphere x r := by
rw [frontier, closure_ball x hr, isOpen_ball.interior_eq, closedBall_diff_ball]
#align frontier_ball frontier_ball
theorem interior_closedBall (x : E) {r : ℝ} (hr : r ≠ 0) :
interior (closedBall x r) = ball x r := by
cases' hr.lt_or_lt with hr hr
· rw [closedBall_eq_empty.2 hr, ball_eq_empty.2 hr.le, interior_empty]
refine Subset.antisymm ?_ ball_subset_interior_closedBall
intro y hy
rcases (mem_closedBall.1 <| interior_subset hy).lt_or_eq with (hr | rfl)
· exact hr
set f : ℝ → E := fun c : ℝ => c • (y - x) + x
suffices f ⁻¹' closedBall x (dist y x) ⊆ Icc (-1) 1 by
have hfc : Continuous f := (continuous_id.smul continuous_const).add continuous_const
have hf1 : (1 : ℝ) ∈ f ⁻¹' interior (closedBall x <| dist y x) := by simpa [f]
have h1 : (1 : ℝ) ∈ interior (Icc (-1 : ℝ) 1) :=
interior_mono this (preimage_interior_subset_interior_preimage hfc hf1)
simp at h1
intro c hc
rw [mem_Icc, ← abs_le, ← Real.norm_eq_abs, ← mul_le_mul_right hr]
simpa [f, dist_eq_norm, norm_smul] using hc
#align interior_closed_ball interior_closedBall
| Mathlib/Analysis/NormedSpace/Real.lean | 101 | 103 | theorem frontier_closedBall (x : E) {r : ℝ} (hr : r ≠ 0) :
frontier (closedBall x r) = sphere x r := by |
rw [frontier, closure_closedBall, interior_closedBall x hr, closedBall_diff_ball]
| 1 |
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Combinatorics.SimpleGraph.Maps
#align_import combinatorics.simple_graph.subgraph from "leanprover-community/mathlib"@"c6ef6387ede9983aee397d442974e61f89dfd87b"
universe u v
namespace SimpleGraph
@[ext]
structure Subgraph {V : Type u} (G : SimpleGraph V) where
verts : Set V
Adj : V → V → Prop
adj_sub : ∀ {v w : V}, Adj v w → G.Adj v w
edge_vert : ∀ {v w : V}, Adj v w → v ∈ verts
symm : Symmetric Adj := by aesop_graph -- Porting note: Originally `by obviously`
#align simple_graph.subgraph SimpleGraph.Subgraph
initialize_simps_projections SimpleGraph.Subgraph (Adj → adj)
variable {ι : Sort*} {V : Type u} {W : Type v}
@[simps]
protected def singletonSubgraph (G : SimpleGraph V) (v : V) : G.Subgraph where
verts := {v}
Adj := ⊥
adj_sub := False.elim
edge_vert := False.elim
symm _ _ := False.elim
#align simple_graph.singleton_subgraph SimpleGraph.singletonSubgraph
@[simps]
def subgraphOfAdj (G : SimpleGraph V) {v w : V} (hvw : G.Adj v w) : G.Subgraph where
verts := {v, w}
Adj a b := s(v, w) = s(a, b)
adj_sub h := by
rw [← G.mem_edgeSet, ← h]
exact hvw
edge_vert {a b} h := by
apply_fun fun e ↦ a ∈ e at h
simp only [Sym2.mem_iff, true_or, eq_iff_iff, iff_true] at h
exact h
#align simple_graph.subgraph_of_adj SimpleGraph.subgraphOfAdj
namespace Subgraph
variable {G : SimpleGraph V} {G₁ G₂ : G.Subgraph} {a b : V}
protected theorem loopless (G' : Subgraph G) : Irreflexive G'.Adj :=
fun v h ↦ G.loopless v (G'.adj_sub h)
#align simple_graph.subgraph.loopless SimpleGraph.Subgraph.loopless
theorem adj_comm (G' : Subgraph G) (v w : V) : G'.Adj v w ↔ G'.Adj w v :=
⟨fun x ↦ G'.symm x, fun x ↦ G'.symm x⟩
#align simple_graph.subgraph.adj_comm SimpleGraph.Subgraph.adj_comm
@[symm]
theorem adj_symm (G' : Subgraph G) {u v : V} (h : G'.Adj u v) : G'.Adj v u :=
G'.symm h
#align simple_graph.subgraph.adj_symm SimpleGraph.Subgraph.adj_symm
protected theorem Adj.symm {G' : Subgraph G} {u v : V} (h : G'.Adj u v) : G'.Adj v u :=
G'.symm h
#align simple_graph.subgraph.adj.symm SimpleGraph.Subgraph.Adj.symm
protected theorem Adj.adj_sub {H : G.Subgraph} {u v : V} (h : H.Adj u v) : G.Adj u v :=
H.adj_sub h
#align simple_graph.subgraph.adj.adj_sub SimpleGraph.Subgraph.Adj.adj_sub
protected theorem Adj.fst_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ∈ H.verts :=
H.edge_vert h
#align simple_graph.subgraph.adj.fst_mem SimpleGraph.Subgraph.Adj.fst_mem
protected theorem Adj.snd_mem {H : G.Subgraph} {u v : V} (h : H.Adj u v) : v ∈ H.verts :=
h.symm.fst_mem
#align simple_graph.subgraph.adj.snd_mem SimpleGraph.Subgraph.Adj.snd_mem
protected theorem Adj.ne {H : G.Subgraph} {u v : V} (h : H.Adj u v) : u ≠ v :=
h.adj_sub.ne
#align simple_graph.subgraph.adj.ne SimpleGraph.Subgraph.Adj.ne
@[simps]
protected def coe (G' : Subgraph G) : SimpleGraph G'.verts where
Adj v w := G'.Adj v w
symm _ _ h := G'.symm h
loopless v h := loopless G v (G'.adj_sub h)
#align simple_graph.subgraph.coe SimpleGraph.Subgraph.coe
@[simp]
theorem coe_adj_sub (G' : Subgraph G) (u v : G'.verts) (h : G'.coe.Adj u v) : G.Adj u v :=
G'.adj_sub h
#align simple_graph.subgraph.coe_adj_sub SimpleGraph.Subgraph.coe_adj_sub
-- Given `h : H.Adj u v`, then `h.coe : H.coe.Adj ⟨u, _⟩ ⟨v, _⟩`.
protected theorem Adj.coe {H : G.Subgraph} {u v : V} (h : H.Adj u v) :
H.coe.Adj ⟨u, H.edge_vert h⟩ ⟨v, H.edge_vert h.symm⟩ := h
#align simple_graph.subgraph.adj.coe SimpleGraph.Subgraph.Adj.coe
def IsSpanning (G' : Subgraph G) : Prop :=
∀ v : V, v ∈ G'.verts
#align simple_graph.subgraph.is_spanning SimpleGraph.Subgraph.IsSpanning
theorem isSpanning_iff {G' : Subgraph G} : G'.IsSpanning ↔ G'.verts = Set.univ :=
Set.eq_univ_iff_forall.symm
#align simple_graph.subgraph.is_spanning_iff SimpleGraph.Subgraph.isSpanning_iff
@[simps]
protected def spanningCoe (G' : Subgraph G) : SimpleGraph V where
Adj := G'.Adj
symm := G'.symm
loopless v hv := G.loopless v (G'.adj_sub hv)
#align simple_graph.subgraph.spanning_coe SimpleGraph.Subgraph.spanningCoe
@[simp]
theorem Adj.of_spanningCoe {G' : Subgraph G} {u v : G'.verts} (h : G'.spanningCoe.Adj u v) :
G.Adj u v :=
G'.adj_sub h
#align simple_graph.subgraph.adj.of_spanning_coe SimpleGraph.Subgraph.Adj.of_spanningCoe
| Mathlib/Combinatorics/SimpleGraph/Subgraph.lean | 177 | 178 | theorem spanningCoe_inj : G₁.spanningCoe = G₂.spanningCoe ↔ G₁.Adj = G₂.Adj := by |
simp [Subgraph.spanningCoe]
| 1 |
import Mathlib.MeasureTheory.Decomposition.RadonNikodym
import Mathlib.Probability.Kernel.Disintegration.CdfToKernel
#align_import probability.kernel.cond_cdf from "leanprover-community/mathlib"@"3b88f4005dc2e28d42f974cc1ce838f0dafb39b8"
open MeasureTheory Set Filter TopologicalSpace
open scoped NNReal ENNReal MeasureTheory Topology
namespace MeasureTheory.Measure
variable {α β : Type*} {mα : MeasurableSpace α} (ρ : Measure (α × ℝ))
noncomputable def IicSnd (r : ℝ) : Measure α :=
(ρ.restrict (univ ×ˢ Iic r)).fst
#align measure_theory.measure.Iic_snd MeasureTheory.Measure.IicSnd
theorem IicSnd_apply (r : ℝ) {s : Set α} (hs : MeasurableSet s) :
ρ.IicSnd r s = ρ (s ×ˢ Iic r) := by
rw [IicSnd, fst_apply hs,
restrict_apply' (MeasurableSet.univ.prod (measurableSet_Iic : MeasurableSet (Iic r))), ←
prod_univ, prod_inter_prod, inter_univ, univ_inter]
#align measure_theory.measure.Iic_snd_apply MeasureTheory.Measure.IicSnd_apply
theorem IicSnd_univ (r : ℝ) : ρ.IicSnd r univ = ρ (univ ×ˢ Iic r) :=
IicSnd_apply ρ r MeasurableSet.univ
#align measure_theory.measure.Iic_snd_univ MeasureTheory.Measure.IicSnd_univ
theorem IicSnd_mono {r r' : ℝ} (h_le : r ≤ r') : ρ.IicSnd r ≤ ρ.IicSnd r' := by
refine Measure.le_iff.2 fun s hs ↦ ?_
simp_rw [IicSnd_apply ρ _ hs]
refine measure_mono (prod_subset_prod_iff.mpr (Or.inl ⟨subset_rfl, Iic_subset_Iic.mpr ?_⟩))
exact mod_cast h_le
#align measure_theory.measure.Iic_snd_mono MeasureTheory.Measure.IicSnd_mono
theorem IicSnd_le_fst (r : ℝ) : ρ.IicSnd r ≤ ρ.fst := by
refine Measure.le_iff.2 fun s hs ↦ ?_
simp_rw [fst_apply hs, IicSnd_apply ρ r hs]
exact measure_mono (prod_subset_preimage_fst _ _)
#align measure_theory.measure.Iic_snd_le_fst MeasureTheory.Measure.IicSnd_le_fst
theorem IicSnd_ac_fst (r : ℝ) : ρ.IicSnd r ≪ ρ.fst :=
Measure.absolutelyContinuous_of_le (IicSnd_le_fst ρ r)
#align measure_theory.measure.Iic_snd_ac_fst MeasureTheory.Measure.IicSnd_ac_fst
theorem IsFiniteMeasure.IicSnd {ρ : Measure (α × ℝ)} [IsFiniteMeasure ρ] (r : ℝ) :
IsFiniteMeasure (ρ.IicSnd r) :=
isFiniteMeasure_of_le _ (IicSnd_le_fst ρ _)
#align measure_theory.measure.is_finite_measure.Iic_snd MeasureTheory.Measure.IsFiniteMeasure.IicSnd
| Mathlib/Probability/Kernel/Disintegration/CondCdf.lean | 87 | 89 | theorem iInf_IicSnd_gt (t : ℚ) {s : Set α} (hs : MeasurableSet s) [IsFiniteMeasure ρ] :
⨅ r : { r' : ℚ // t < r' }, ρ.IicSnd r s = ρ.IicSnd t s := by |
simp_rw [ρ.IicSnd_apply _ hs, Measure.iInf_rat_gt_prod_Iic hs]
| 1 |
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Lemma
import Mathlib.Tactic.TypeStar
#align_import data.option.defs from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
namespace Option
#align option.lift_or_get Option.liftOrGet
protected def traverse.{u, v}
{F : Type u → Type v} [Applicative F] {α : Type*} {β : Type u} (f : α → F β) :
Option α → F (Option β)
| none => pure none
| some x => some <$> f x
#align option.traverse Option.traverse
#align option.maybe Option.sequence
#align option.mmap Option.mapM
#align option.melim Option.elimM
#align option.mget_or_else Option.getDM
variable {α : Type*} {β : Type*}
-- Porting note: Would need to add the attribute directly in `Init.Prelude`.
-- attribute [inline] Option.isSome Option.isNone
protected def elim' (b : β) (f : α → β) : Option α → β
| some a => f a
| none => b
#align option.elim Option.elim'
@[simp]
theorem elim'_none (b : β) (f : α → β) : Option.elim' b f none = b := rfl
@[simp]
theorem elim'_some {a : α} (b : β) (f : α → β) : Option.elim' b f (some a) = f a := rfl
-- Porting note: this lemma was introduced because it is necessary
-- in `CategoryTheory.Category.PartialFun`
lemma elim'_eq_elim {α β : Type*} (b : β) (f : α → β) (a : Option α) :
Option.elim' b f a = Option.elim a b f := by
cases a <;> rfl
theorem mem_some_iff {α : Type*} {a b : α} : a ∈ some b ↔ b = a := by simp
#align option.mem_some_iff Option.mem_some_iff
@[inline]
def decidableEqNone {o : Option α} : Decidable (o = none) :=
decidable_of_decidable_of_iff isNone_iff_eq_none
#align option.decidable_eq_none Option.decidableEqNone
instance decidableForallMem {p : α → Prop} [DecidablePred p] :
∀ o : Option α, Decidable (∀ a ∈ o, p a)
| none => isTrue (by simp [false_imp_iff])
| some a =>
if h : p a then isTrue fun o e ↦ some_inj.1 e ▸ h
else isFalse <| mt (fun H ↦ H _ rfl) h
instance decidableExistsMem {p : α → Prop} [DecidablePred p] :
∀ o : Option α, Decidable (∃ a ∈ o, p a)
| none => isFalse fun ⟨a, ⟨h, _⟩⟩ ↦ by cases h
| some a => if h : p a then isTrue <| ⟨_, rfl, h⟩ else isFalse fun ⟨_, ⟨rfl, hn⟩⟩ ↦ h hn
abbrev iget [Inhabited α] : Option α → α
| some x => x
| none => default
#align option.iget Option.iget
theorem iget_some [Inhabited α] {a : α} : (some a).iget = a :=
rfl
#align option.iget_some Option.iget_some
@[simp]
| Mathlib/Data/Option/Defs.lean | 96 | 97 | theorem mem_toList {a : α} {o : Option α} : a ∈ toList o ↔ a ∈ o := by |
cases o <;> simp [toList, eq_comm]
| 1 |
import Mathlib.Algebra.BigOperators.WithTop
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Data.ENNReal.Basic
#align_import data.real.ennreal from "leanprover-community/mathlib"@"c14c8fcde993801fca8946b0d80131a1a81d1520"
open Set NNReal ENNReal
namespace ENNReal
variable {a b c d : ℝ≥0∞} {r p q : ℝ≥0}
section OperationsAndInfty
variable {α : Type*}
@[simp] theorem add_eq_top : a + b = ∞ ↔ a = ∞ ∨ b = ∞ := WithTop.add_eq_top
#align ennreal.add_eq_top ENNReal.add_eq_top
@[simp] theorem add_lt_top : a + b < ∞ ↔ a < ∞ ∧ b < ∞ := WithTop.add_lt_top
#align ennreal.add_lt_top ENNReal.add_lt_top
theorem toNNReal_add {r₁ r₂ : ℝ≥0∞} (h₁ : r₁ ≠ ∞) (h₂ : r₂ ≠ ∞) :
(r₁ + r₂).toNNReal = r₁.toNNReal + r₂.toNNReal := by
lift r₁ to ℝ≥0 using h₁
lift r₂ to ℝ≥0 using h₂
rfl
#align ennreal.to_nnreal_add ENNReal.toNNReal_add
theorem not_lt_top {x : ℝ≥0∞} : ¬x < ∞ ↔ x = ∞ := by rw [lt_top_iff_ne_top, Classical.not_not]
#align ennreal.not_lt_top ENNReal.not_lt_top
theorem add_ne_top : a + b ≠ ∞ ↔ a ≠ ∞ ∧ b ≠ ∞ := by simpa only [lt_top_iff_ne_top] using add_lt_top
#align ennreal.add_ne_top ENNReal.add_ne_top
theorem mul_top' : a * ∞ = if a = 0 then 0 else ∞ := by convert WithTop.mul_top' a
#align ennreal.mul_top ENNReal.mul_top'
-- Porting note: added because `simp` no longer uses `WithTop` lemmas for `ℝ≥0∞`
@[simp] theorem mul_top (h : a ≠ 0) : a * ∞ = ∞ := WithTop.mul_top h
| Mathlib/Data/ENNReal/Operations.lean | 212 | 212 | theorem top_mul' : ∞ * a = if a = 0 then 0 else ∞ := by | convert WithTop.top_mul' a
| 1 |
import Mathlib.LinearAlgebra.ExteriorAlgebra.Basic
import Mathlib.LinearAlgebra.CliffordAlgebra.Fold
import Mathlib.LinearAlgebra.CliffordAlgebra.Conjugation
import Mathlib.LinearAlgebra.Dual
#align_import linear_algebra.clifford_algebra.contraction from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
open LinearMap (BilinForm)
universe u1 u2 u3
variable {R : Type u1} [CommRing R]
variable {M : Type u2} [AddCommGroup M] [Module R M]
variable (Q : QuadraticForm R M)
namespace CliffordAlgebra
section contractLeft
variable (d d' : Module.Dual R M)
@[simps!]
def contractLeftAux (d : Module.Dual R M) :
M →ₗ[R] CliffordAlgebra Q × CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q :=
haveI v_mul := (Algebra.lmul R (CliffordAlgebra Q)).toLinearMap ∘ₗ ι Q
d.smulRight (LinearMap.fst _ (CliffordAlgebra Q) (CliffordAlgebra Q)) -
v_mul.compl₂ (LinearMap.snd _ (CliffordAlgebra Q) _)
#align clifford_algebra.contract_left_aux CliffordAlgebra.contractLeftAux
theorem contractLeftAux_contractLeftAux (v : M) (x : CliffordAlgebra Q) (fx : CliffordAlgebra Q) :
contractLeftAux Q d v (ι Q v * x, contractLeftAux Q d v (x, fx)) = Q v • fx := by
simp only [contractLeftAux_apply_apply]
rw [mul_sub, ← mul_assoc, ι_sq_scalar, ← Algebra.smul_def, ← sub_add, mul_smul_comm, sub_self,
zero_add]
#align clifford_algebra.contract_left_aux_contract_left_aux CliffordAlgebra.contractLeftAux_contractLeftAux
variable {Q}
def contractLeft : Module.Dual R M →ₗ[R] CliffordAlgebra Q →ₗ[R] CliffordAlgebra Q where
toFun d := foldr' Q (contractLeftAux Q d) (contractLeftAux_contractLeftAux Q d) 0
map_add' d₁ d₂ :=
LinearMap.ext fun x => by
dsimp only
rw [LinearMap.add_apply]
induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
· simp_rw [foldr'_algebraMap, smul_zero, zero_add]
· rw [map_add, map_add, map_add, add_add_add_comm, hx, hy]
· rw [foldr'_ι_mul, foldr'_ι_mul, foldr'_ι_mul, hx]
dsimp only [contractLeftAux_apply_apply]
rw [sub_add_sub_comm, mul_add, LinearMap.add_apply, add_smul]
map_smul' c d :=
LinearMap.ext fun x => by
dsimp only
rw [LinearMap.smul_apply, RingHom.id_apply]
induction' x using CliffordAlgebra.left_induction with r x y hx hy m x hx
· simp_rw [foldr'_algebraMap, smul_zero]
· rw [map_add, map_add, smul_add, hx, hy]
· rw [foldr'_ι_mul, foldr'_ι_mul, hx]
dsimp only [contractLeftAux_apply_apply]
rw [LinearMap.smul_apply, smul_assoc, mul_smul_comm, smul_sub]
#align clifford_algebra.contract_left CliffordAlgebra.contractLeft
def contractRight : CliffordAlgebra Q →ₗ[R] Module.Dual R M →ₗ[R] CliffordAlgebra Q :=
LinearMap.flip (LinearMap.compl₂ (LinearMap.compr₂ contractLeft reverse) reverse)
#align clifford_algebra.contract_right CliffordAlgebra.contractRight
theorem contractRight_eq (x : CliffordAlgebra Q) :
contractRight (Q := Q) x d = reverse (contractLeft (R := R) (M := M) d <| reverse x) :=
rfl
#align clifford_algebra.contract_right_eq CliffordAlgebra.contractRight_eq
local infixl:70 "⌋" => contractLeft (R := R) (M := M)
local infixl:70 "⌊" => contractRight (R := R) (M := M) (Q := Q)
-- Porting note: Lean needs to be reminded of this instance otherwise the statement of the
-- next result times out
instance : SMul R (CliffordAlgebra Q) := inferInstance
theorem contractLeft_ι_mul (a : M) (b : CliffordAlgebra Q) :
d⌋(ι Q a * b) = d a • b - ι Q a * (d⌋b) := by
-- Porting note: Lean cannot figure out anymore the third argument
refine foldr'_ι_mul _ _ ?_ _ _ _
exact fun m x fx ↦ contractLeftAux_contractLeftAux Q d m x fx
#align clifford_algebra.contract_left_ι_mul CliffordAlgebra.contractLeft_ι_mul
theorem contractRight_mul_ι (a : M) (b : CliffordAlgebra Q) :
b * ι Q a⌊d = d a • b - b⌊d * ι Q a := by
rw [contractRight_eq, reverse.map_mul, reverse_ι, contractLeft_ι_mul, map_sub, map_smul,
reverse_reverse, reverse.map_mul, reverse_ι, contractRight_eq]
#align clifford_algebra.contract_right_mul_ι CliffordAlgebra.contractRight_mul_ι
theorem contractLeft_algebraMap_mul (r : R) (b : CliffordAlgebra Q) :
d⌋(algebraMap _ _ r * b) = algebraMap _ _ r * (d⌋b) := by
rw [← Algebra.smul_def, map_smul, Algebra.smul_def]
#align clifford_algebra.contract_left_algebra_map_mul CliffordAlgebra.contractLeft_algebraMap_mul
theorem contractLeft_mul_algebraMap (a : CliffordAlgebra Q) (r : R) :
d⌋(a * algebraMap _ _ r) = d⌋a * algebraMap _ _ r := by
rw [← Algebra.commutes, contractLeft_algebraMap_mul, Algebra.commutes]
#align clifford_algebra.contract_left_mul_algebra_map CliffordAlgebra.contractLeft_mul_algebraMap
theorem contractRight_algebraMap_mul (r : R) (b : CliffordAlgebra Q) :
algebraMap _ _ r * b⌊d = algebraMap _ _ r * (b⌊d) := by
rw [← Algebra.smul_def, LinearMap.map_smul₂, Algebra.smul_def]
#align clifford_algebra.contract_right_algebra_map_mul CliffordAlgebra.contractRight_algebraMap_mul
| Mathlib/LinearAlgebra/CliffordAlgebra/Contraction.lean | 159 | 161 | theorem contractRight_mul_algebraMap (a : CliffordAlgebra Q) (r : R) :
a * algebraMap _ _ r⌊d = a⌊d * algebraMap _ _ r := by |
rw [← Algebra.commutes, contractRight_algebraMap_mul, Algebra.commutes]
| 1 |
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Limits.Preserves.Basic
#align_import category_theory.limits.preserves.shapes.pullbacks from "leanprover-community/mathlib"@"f11e306adb9f2a393539d2bb4293bf1b42caa7ac"
noncomputable section
universe v₁ v₂ u₁ u₂
-- Porting note: need Functor namespace for mapCone
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Functor
namespace CategoryTheory.Limits
section Pushout
variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
variable (G : C ⥤ D)
variable {W X Y Z : C} {h : X ⟶ Z} {k : Y ⟶ Z} {f : W ⟶ X} {g : W ⟶ Y} (comm : f ≫ h = g ≫ k)
def isColimitMapCoconePushoutCoconeEquiv :
IsColimit (mapCocone G (PushoutCocone.mk h k comm)) ≃
IsColimit
(PushoutCocone.mk (G.map h) (G.map k) (by simp only [← G.map_comp, comm]) :
PushoutCocone (G.map f) (G.map g)) :=
(IsColimit.precomposeHomEquiv (diagramIsoSpan.{v₂} _).symm _).symm.trans <|
IsColimit.equivIsoColimit <|
Cocones.ext (Iso.refl _) <| by
rintro (_ | _ | _) <;> dsimp <;>
simp only [Category.comp_id, Category.id_comp, ← G.map_comp]
#align category_theory.limits.is_colimit_map_cocone_pushout_cocone_equiv CategoryTheory.Limits.isColimitMapCoconePushoutCoconeEquiv
def isColimitPushoutCoconeMapOfIsColimit [PreservesColimit (span f g) G]
(l : IsColimit (PushoutCocone.mk h k comm)) :
IsColimit (PushoutCocone.mk (G.map h) (G.map k) (show G.map f ≫ G.map h = G.map g ≫ G.map k
from by simp only [← G.map_comp,comm] )) :=
isColimitMapCoconePushoutCoconeEquiv G comm (PreservesColimit.preserves l)
#align category_theory.limits.is_colimit_pushout_cocone_map_of_is_colimit CategoryTheory.Limits.isColimitPushoutCoconeMapOfIsColimit
def isColimitOfIsColimitPushoutCoconeMap [ReflectsColimit (span f g) G]
(l : IsColimit (PushoutCocone.mk (G.map h) (G.map k) (show G.map f ≫ G.map h =
G.map g ≫ G.map k from by simp only [← G.map_comp,comm]))) :
IsColimit (PushoutCocone.mk h k comm) :=
ReflectsColimit.reflects ((isColimitMapCoconePushoutCoconeEquiv G comm).symm l)
#align category_theory.limits.is_colimit_of_is_colimit_pushout_cocone_map CategoryTheory.Limits.isColimitOfIsColimitPushoutCoconeMap
variable (f g) [PreservesColimit (span f g) G]
def isColimitOfHasPushoutOfPreservesColimit [i : HasPushout f g] :
IsColimit (PushoutCocone.mk (G.map pushout.inl) (G.map (@pushout.inr _ _ _ _ _ f g i))
(show G.map f ≫ G.map pushout.inl = G.map g ≫ G.map pushout.inr from by
simp only [← G.map_comp, pushout.condition])) :=
isColimitPushoutCoconeMapOfIsColimit G _ (pushoutIsPushout f g)
#align category_theory.limits.is_colimit_of_has_pushout_of_preserves_colimit CategoryTheory.Limits.isColimitOfHasPushoutOfPreservesColimit
def preservesPushoutSymmetry : PreservesColimit (span g f) G where
preserves {c} hc := by
apply (IsColimit.precomposeHomEquiv (diagramIsoSpan.{v₂} _).symm _).toFun
apply IsColimit.ofIsoColimit _ (PushoutCocone.isoMk _).symm
apply PushoutCocone.isColimitOfFlip
apply (isColimitMapCoconePushoutCoconeEquiv _ _).toFun
· refine @PreservesColimit.preserves _ _ _ _ _ _ _ _ ?_ _ ?_ -- Porting note: more TC coddling
· dsimp
infer_instance
· exact PushoutCocone.flipIsColimit hc
#align category_theory.limits.preserves_pushout_symmetry CategoryTheory.Limits.preservesPushoutSymmetry
theorem hasPushout_of_preservesPushout [HasPushout f g] : HasPushout (G.map f) (G.map g) :=
⟨⟨⟨_, isColimitPushoutCoconeMapOfIsColimit G _ (pushoutIsPushout _ _)⟩⟩⟩
#align category_theory.limits.has_pushout_of_preserves_pushout CategoryTheory.Limits.hasPushout_of_preservesPushout
variable [HasPushout f g] [HasPushout (G.map f) (G.map g)]
def PreservesPushout.iso : pushout (G.map f) (G.map g) ≅ G.obj (pushout f g) :=
IsColimit.coconePointUniqueUpToIso (colimit.isColimit _)
(isColimitOfHasPushoutOfPreservesColimit G f g)
#align category_theory.limits.preserves_pushout.iso CategoryTheory.Limits.PreservesPushout.iso
@[simp]
theorem PreservesPushout.iso_hom : (PreservesPushout.iso G f g).hom = pushoutComparison G f g :=
rfl
#align category_theory.limits.preserves_pushout.iso_hom CategoryTheory.Limits.PreservesPushout.iso_hom
@[reassoc]
theorem PreservesPushout.inl_iso_hom :
pushout.inl ≫ (PreservesPushout.iso G f g).hom = G.map pushout.inl := by
delta PreservesPushout.iso
simp
#align category_theory.limits.preserves_pushout.inl_iso_hom CategoryTheory.Limits.PreservesPushout.inl_iso_hom
@[reassoc]
theorem PreservesPushout.inr_iso_hom :
pushout.inr ≫ (PreservesPushout.iso G f g).hom = G.map pushout.inr := by
delta PreservesPushout.iso
simp
#align category_theory.limits.preserves_pushout.inr_iso_hom CategoryTheory.Limits.PreservesPushout.inr_iso_hom
@[reassoc (attr := simp)]
| Mathlib/CategoryTheory/Limits/Preserves/Shapes/Pullbacks.lean | 239 | 241 | theorem PreservesPushout.inl_iso_inv :
G.map pushout.inl ≫ (PreservesPushout.iso G f g).inv = pushout.inl := by |
simp [PreservesPushout.iso, Iso.comp_inv_eq]
| 1 |
import Mathlib.Algebra.Group.Commute.Basic
import Mathlib.Data.Fintype.Card
import Mathlib.GroupTheory.Perm.Basic
#align_import group_theory.perm.support from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
open Equiv Finset
namespace Equiv.Perm
variable {α : Type*}
section support
variable [DecidableEq α] [Fintype α] {f g : Perm α}
def support (f : Perm α) : Finset α :=
univ.filter fun x => f x ≠ x
#align equiv.perm.support Equiv.Perm.support
@[simp]
| Mathlib/GroupTheory/Perm/Support.lean | 297 | 298 | theorem mem_support {x : α} : x ∈ f.support ↔ f x ≠ x := by |
rw [support, mem_filter, and_iff_right (mem_univ x)]
| 1 |
import Mathlib.Analysis.Normed.Group.Hom
import Mathlib.Analysis.SpecialFunctions.Pow.Continuity
import Mathlib.Data.Set.Image
import Mathlib.MeasureTheory.Function.LpSeminorm.ChebyshevMarkov
import Mathlib.MeasureTheory.Function.LpSeminorm.CompareExp
import Mathlib.MeasureTheory.Function.LpSeminorm.TriangleInequality
import Mathlib.MeasureTheory.Measure.OpenPos
import Mathlib.Topology.ContinuousFunction.Compact
import Mathlib.Order.Filter.IndicatorFunction
#align_import measure_theory.function.lp_space from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
noncomputable section
set_option linter.uppercaseLean3 false
open TopologicalSpace MeasureTheory Filter
open scoped NNReal ENNReal Topology MeasureTheory Uniformity
variable {α E F G : Type*} {m m0 : MeasurableSpace α} {p : ℝ≥0∞} {q : ℝ} {μ ν : Measure α}
[NormedAddCommGroup E] [NormedAddCommGroup F] [NormedAddCommGroup G]
namespace MeasureTheory
@[simp]
theorem snorm_aeeqFun {α E : Type*} [MeasurableSpace α] {μ : Measure α} [NormedAddCommGroup E]
{p : ℝ≥0∞} {f : α → E} (hf : AEStronglyMeasurable f μ) :
snorm (AEEqFun.mk f hf) p μ = snorm f p μ :=
snorm_congr_ae (AEEqFun.coeFn_mk _ _)
#align measure_theory.snorm_ae_eq_fun MeasureTheory.snorm_aeeqFun
theorem Memℒp.snorm_mk_lt_top {α E : Type*} [MeasurableSpace α] {μ : Measure α}
[NormedAddCommGroup E] {p : ℝ≥0∞} {f : α → E} (hfp : Memℒp f p μ) :
snorm (AEEqFun.mk f hfp.1) p μ < ∞ := by simp [hfp.2]
#align measure_theory.mem_ℒp.snorm_mk_lt_top MeasureTheory.Memℒp.snorm_mk_lt_top
def Lp {α} (E : Type*) {m : MeasurableSpace α} [NormedAddCommGroup E] (p : ℝ≥0∞)
(μ : Measure α := by volume_tac) : AddSubgroup (α →ₘ[μ] E) where
carrier := { f | snorm f p μ < ∞ }
zero_mem' := by simp [snorm_congr_ae AEEqFun.coeFn_zero, snorm_zero]
add_mem' {f g} hf hg := by
simp [snorm_congr_ae (AEEqFun.coeFn_add f g),
snorm_add_lt_top ⟨f.aestronglyMeasurable, hf⟩ ⟨g.aestronglyMeasurable, hg⟩]
neg_mem' {f} hf := by rwa [Set.mem_setOf_eq, snorm_congr_ae (AEEqFun.coeFn_neg f), snorm_neg]
#align measure_theory.Lp MeasureTheory.Lp
-- Porting note: calling the first argument `α` breaks the `(α := ·)` notation
scoped notation:25 α' " →₁[" μ "] " E => MeasureTheory.Lp (α := α') E 1 μ
scoped notation:25 α' " →₂[" μ "] " E => MeasureTheory.Lp (α := α') E 2 μ
namespace Memℒp
def toLp (f : α → E) (h_mem_ℒp : Memℒp f p μ) : Lp E p μ :=
⟨AEEqFun.mk f h_mem_ℒp.1, h_mem_ℒp.snorm_mk_lt_top⟩
#align measure_theory.mem_ℒp.to_Lp MeasureTheory.Memℒp.toLp
theorem coeFn_toLp {f : α → E} (hf : Memℒp f p μ) : hf.toLp f =ᵐ[μ] f :=
AEEqFun.coeFn_mk _ _
#align measure_theory.mem_ℒp.coe_fn_to_Lp MeasureTheory.Memℒp.coeFn_toLp
| Mathlib/MeasureTheory/Function/LpSpace.lean | 126 | 127 | theorem toLp_congr {f g : α → E} (hf : Memℒp f p μ) (hg : Memℒp g p μ) (hfg : f =ᵐ[μ] g) :
hf.toLp f = hg.toLp g := by | simp [toLp, hfg]
| 1 |
import Mathlib.Analysis.Convex.Hull
#align_import analysis.convex.join from "leanprover-community/mathlib"@"951bf1d9e98a2042979ced62c0620bcfb3587cf8"
open Set
variable {ι : Sort*} {𝕜 E : Type*}
section OrderedSemiring
variable (𝕜) [OrderedSemiring 𝕜] [AddCommMonoid E] [Module 𝕜 E] {s t s₁ s₂ t₁ t₂ u : Set E}
{x y : E}
def convexJoin (s t : Set E) : Set E :=
⋃ (x ∈ s) (y ∈ t), segment 𝕜 x y
#align convex_join convexJoin
variable {𝕜}
theorem mem_convexJoin : x ∈ convexJoin 𝕜 s t ↔ ∃ a ∈ s, ∃ b ∈ t, x ∈ segment 𝕜 a b := by
simp [convexJoin]
#align mem_convex_join mem_convexJoin
theorem convexJoin_comm (s t : Set E) : convexJoin 𝕜 s t = convexJoin 𝕜 t s :=
(iUnion₂_comm _).trans <| by simp_rw [convexJoin, segment_symm]
#align convex_join_comm convexJoin_comm
theorem convexJoin_mono (hs : s₁ ⊆ s₂) (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s₁ t₁ ⊆ convexJoin 𝕜 s₂ t₂ :=
biUnion_mono hs fun _ _ => biUnion_subset_biUnion_left ht
#align convex_join_mono convexJoin_mono
theorem convexJoin_mono_left (hs : s₁ ⊆ s₂) : convexJoin 𝕜 s₁ t ⊆ convexJoin 𝕜 s₂ t :=
convexJoin_mono hs Subset.rfl
#align convex_join_mono_left convexJoin_mono_left
theorem convexJoin_mono_right (ht : t₁ ⊆ t₂) : convexJoin 𝕜 s t₁ ⊆ convexJoin 𝕜 s t₂ :=
convexJoin_mono Subset.rfl ht
#align convex_join_mono_right convexJoin_mono_right
@[simp]
theorem convexJoin_empty_left (t : Set E) : convexJoin 𝕜 ∅ t = ∅ := by simp [convexJoin]
#align convex_join_empty_left convexJoin_empty_left
@[simp]
theorem convexJoin_empty_right (s : Set E) : convexJoin 𝕜 s ∅ = ∅ := by simp [convexJoin]
#align convex_join_empty_right convexJoin_empty_right
@[simp]
theorem convexJoin_singleton_left (t : Set E) (x : E) :
convexJoin 𝕜 {x} t = ⋃ y ∈ t, segment 𝕜 x y := by simp [convexJoin]
#align convex_join_singleton_left convexJoin_singleton_left
@[simp]
theorem convexJoin_singleton_right (s : Set E) (y : E) :
convexJoin 𝕜 s {y} = ⋃ x ∈ s, segment 𝕜 x y := by simp [convexJoin]
#align convex_join_singleton_right convexJoin_singleton_right
-- Porting note (#10618): simp can prove it
theorem convexJoin_singletons (x : E) : convexJoin 𝕜 {x} {y} = segment 𝕜 x y := by simp
#align convex_join_singletons convexJoin_singletons
@[simp]
theorem convexJoin_union_left (s₁ s₂ t : Set E) :
convexJoin 𝕜 (s₁ ∪ s₂) t = convexJoin 𝕜 s₁ t ∪ convexJoin 𝕜 s₂ t := by
simp_rw [convexJoin, mem_union, iUnion_or, iUnion_union_distrib]
#align convex_join_union_left convexJoin_union_left
@[simp]
theorem convexJoin_union_right (s t₁ t₂ : Set E) :
convexJoin 𝕜 s (t₁ ∪ t₂) = convexJoin 𝕜 s t₁ ∪ convexJoin 𝕜 s t₂ := by
simp_rw [convexJoin_comm s, convexJoin_union_left]
#align convex_join_union_right convexJoin_union_right
@[simp]
theorem convexJoin_iUnion_left (s : ι → Set E) (t : Set E) :
convexJoin 𝕜 (⋃ i, s i) t = ⋃ i, convexJoin 𝕜 (s i) t := by
simp_rw [convexJoin, mem_iUnion, iUnion_exists]
exact iUnion_comm _
#align convex_join_Union_left convexJoin_iUnion_left
@[simp]
| Mathlib/Analysis/Convex/Join.lean | 98 | 100 | theorem convexJoin_iUnion_right (s : Set E) (t : ι → Set E) :
convexJoin 𝕜 s (⋃ i, t i) = ⋃ i, convexJoin 𝕜 s (t i) := by |
simp_rw [convexJoin_comm s, convexJoin_iUnion_left]
| 1 |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Monic
import Mathlib.Algebra.Ring.Action.Basic
import Mathlib.GroupTheory.GroupAction.Hom
import Mathlib.GroupTheory.GroupAction.Quotient
#align_import algebra.polynomial.group_ring_action from "leanprover-community/mathlib"@"afad8e438d03f9d89da2914aa06cb4964ba87a18"
variable (M : Type*) [Monoid M]
open Polynomial
namespace Polynomial
variable (R : Type*) [Semiring R]
variable {M}
-- Porting note: changed `(· • ·) m` to `HSMul.hSMul m`
theorem smul_eq_map [MulSemiringAction M R] (m : M) :
HSMul.hSMul m = map (MulSemiringAction.toRingHom M R m) := by
suffices DistribMulAction.toAddMonoidHom R[X] m =
(mapRingHom (MulSemiringAction.toRingHom M R m)).toAddMonoidHom by
ext1 r
exact DFunLike.congr_fun this r
ext n r : 2
change m • monomial n r = map (MulSemiringAction.toRingHom M R m) (monomial n r)
rw [Polynomial.map_monomial, Polynomial.smul_monomial, MulSemiringAction.toRingHom_apply]
#align polynomial.smul_eq_map Polynomial.smul_eq_map
variable (M)
noncomputable instance [MulSemiringAction M R] : MulSemiringAction M R[X] :=
{ Polynomial.distribMulAction with
smul_one := fun m ↦
smul_eq_map R m ▸ Polynomial.map_one (MulSemiringAction.toRingHom M R m)
smul_mul := fun m _ _ ↦
smul_eq_map R m ▸ Polynomial.map_mul (MulSemiringAction.toRingHom M R m) }
variable {M R}
variable [MulSemiringAction M R]
@[simp]
theorem smul_X (m : M) : (m • X : R[X]) = X :=
(smul_eq_map R m).symm ▸ map_X _
set_option linter.uppercaseLean3 false in
#align polynomial.smul_X Polynomial.smul_X
variable (S : Type*) [CommSemiring S] [MulSemiringAction M S]
theorem smul_eval_smul (m : M) (f : S[X]) (x : S) : (m • f).eval (m • x) = m • f.eval x :=
Polynomial.induction_on f (fun r ↦ by rw [smul_C, eval_C, eval_C])
(fun f g ihf ihg ↦ by rw [smul_add, eval_add, ihf, ihg, eval_add, smul_add]) fun n r _ ↦ by
rw [smul_mul', smul_pow', smul_C, smul_X, eval_mul, eval_C, eval_pow, eval_X, eval_mul, eval_C,
eval_pow, eval_X, smul_mul', smul_pow']
#align polynomial.smul_eval_smul Polynomial.smul_eval_smul
variable (G : Type*) [Group G]
theorem eval_smul' [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) :
f.eval (g • x) = g • (g⁻¹ • f).eval x := by
rw [← smul_eval_smul, smul_inv_smul]
#align polynomial.eval_smul' Polynomial.eval_smul'
| Mathlib/Algebra/Polynomial/GroupRingAction.lean | 76 | 78 | theorem smul_eval [MulSemiringAction G S] (g : G) (f : S[X]) (x : S) :
(g • f).eval x = g • f.eval (g⁻¹ • x) := by |
rw [← smul_eval_smul, smul_inv_smul]
| 1 |
import Mathlib.CategoryTheory.Balanced
import Mathlib.CategoryTheory.Limits.EssentiallySmall
import Mathlib.CategoryTheory.Limits.Opposites
import Mathlib.CategoryTheory.Limits.Shapes.ZeroMorphisms
import Mathlib.CategoryTheory.Subobject.Lattice
import Mathlib.CategoryTheory.Subobject.WellPowered
import Mathlib.Data.Set.Opposite
import Mathlib.Data.Set.Subsingleton
#align_import category_theory.generator from "leanprover-community/mathlib"@"f187f1074fa1857c94589cc653c786cadc4c35ff"
universe w v₁ v₂ u₁ u₂
open CategoryTheory.Limits Opposite
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D]
def IsSeparating (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ X), h ≫ f = h ≫ g) → f = g
#align category_theory.is_separating CategoryTheory.IsSeparating
def IsCoseparating (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f g : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : Y ⟶ G), f ≫ h = g ≫ h) → f = g
#align category_theory.is_coseparating CategoryTheory.IsCoseparating
def IsDetecting (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : G ⟶ Y), ∃! h' : G ⟶ X, h' ≫ f = h) → IsIso f
#align category_theory.is_detecting CategoryTheory.IsDetecting
def IsCodetecting (𝒢 : Set C) : Prop :=
∀ ⦃X Y : C⦄ (f : X ⟶ Y), (∀ G ∈ 𝒢, ∀ (h : X ⟶ G), ∃! h' : Y ⟶ G, f ≫ h' = h) → IsIso f
#align category_theory.is_codetecting CategoryTheory.IsCodetecting
section Dual
theorem isSeparating_op_iff (𝒢 : Set C) : IsSeparating 𝒢.op ↔ IsCoseparating 𝒢 := by
refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩
· refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
· refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_separating_op_iff CategoryTheory.isSeparating_op_iff
theorem isCoseparating_op_iff (𝒢 : Set C) : IsCoseparating 𝒢.op ↔ IsSeparating 𝒢 := by
refine ⟨fun h𝒢 X Y f g hfg => ?_, fun h𝒢 X Y f g hfg => ?_⟩
· refine Quiver.Hom.op_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.unop_inj ?_)
simpa only [unop_comp, Quiver.Hom.unop_op] using hfg _ (Set.mem_op.1 hG) _
· refine Quiver.Hom.unop_inj (h𝒢 _ _ fun G hG h => Quiver.Hom.op_inj ?_)
simpa only [op_comp, Quiver.Hom.op_unop] using hfg _ (Set.op_mem_op.2 hG) _
#align category_theory.is_coseparating_op_iff CategoryTheory.isCoseparating_op_iff
theorem isCoseparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsCoseparating 𝒢.unop ↔ IsSeparating 𝒢 := by
rw [← isSeparating_op_iff, Set.unop_op]
#align category_theory.is_coseparating_unop_iff CategoryTheory.isCoseparating_unop_iff
| Mathlib/CategoryTheory/Generator.lean | 113 | 114 | theorem isSeparating_unop_iff (𝒢 : Set Cᵒᵖ) : IsSeparating 𝒢.unop ↔ IsCoseparating 𝒢 := by |
rw [← isCoseparating_op_iff, Set.unop_op]
| 1 |
import Batteries.Data.RBMap.Basic
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Mathport.Rename
import Mathlib.Tactic.TypeStar
import Mathlib.Util.CompileInductive
#align_import data.tree from "leanprover-community/mathlib"@"ed989ff568099019c6533a4d94b27d852a5710d8"
inductive Tree.{u} (α : Type u) : Type u
| nil : Tree α
| node : α → Tree α → Tree α → Tree α
deriving DecidableEq, Repr -- Porting note: Removed `has_reflect`, added `Repr`.
#align tree Tree
namespace Tree
universe u
variable {α : Type u}
-- Porting note: replaced with `deriving Repr` which builds a better instance anyway
#noalign tree.repr
instance : Inhabited (Tree α) :=
⟨nil⟩
open Batteries (RBNode)
def ofRBNode : RBNode α → Tree α
| RBNode.nil => nil
| RBNode.node _color l key r => node key (ofRBNode l) (ofRBNode r)
#align tree.of_rbnode Tree.ofRBNode
def map {β} (f : α → β) : Tree α → Tree β
| nil => nil
| node a l r => node (f a) (map f l) (map f r)
#align tree.map Tree.map
@[simp]
def numNodes : Tree α → ℕ
| nil => 0
| node _ a b => a.numNodes + b.numNodes + 1
#align tree.num_nodes Tree.numNodes
@[simp]
def numLeaves : Tree α → ℕ
| nil => 1
| node _ a b => a.numLeaves + b.numLeaves
#align tree.num_leaves Tree.numLeaves
@[simp]
def height : Tree α → ℕ
| nil => 0
| node _ a b => max a.height b.height + 1
#align tree.height Tree.height
| Mathlib/Data/Tree/Basic.lean | 90 | 91 | theorem numLeaves_eq_numNodes_succ (x : Tree α) : x.numLeaves = x.numNodes + 1 := by |
induction x <;> simp [*, Nat.add_comm, Nat.add_assoc, Nat.add_left_comm]
| 1 |
import Mathlib.Algebra.Quaternion
import Mathlib.Tactic.Ring
#align_import algebra.quaternion_basis from "leanprover-community/mathlib"@"3aa5b8a9ed7a7cabd36e6e1d022c9858ab8a8c2d"
open Quaternion
namespace QuaternionAlgebra
structure Basis {R : Type*} (A : Type*) [CommRing R] [Ring A] [Algebra R A] (c₁ c₂ : R) where
(i j k : A)
i_mul_i : i * i = c₁ • (1 : A)
j_mul_j : j * j = c₂ • (1 : A)
i_mul_j : i * j = k
j_mul_i : j * i = -k
#align quaternion_algebra.basis QuaternionAlgebra.Basis
variable {R : Type*} {A B : Type*} [CommRing R] [Ring A] [Ring B] [Algebra R A] [Algebra R B]
variable {c₁ c₂ : R}
namespace Basis
@[ext]
protected theorem ext ⦃q₁ q₂ : Basis A c₁ c₂⦄ (hi : q₁.i = q₂.i) (hj : q₁.j = q₂.j) : q₁ = q₂ := by
cases q₁; rename_i q₁_i_mul_j _
cases q₂; rename_i q₂_i_mul_j _
congr
rw [← q₁_i_mul_j, ← q₂_i_mul_j]
congr
#align quaternion_algebra.basis.ext QuaternionAlgebra.Basis.ext
variable (R)
@[simps i j k]
protected def self : Basis ℍ[R,c₁,c₂] c₁ c₂ where
i := ⟨0, 1, 0, 0⟩
i_mul_i := by ext <;> simp
j := ⟨0, 0, 1, 0⟩
j_mul_j := by ext <;> simp
k := ⟨0, 0, 0, 1⟩
i_mul_j := by ext <;> simp
j_mul_i := by ext <;> simp
#align quaternion_algebra.basis.self QuaternionAlgebra.Basis.self
variable {R}
instance : Inhabited (Basis ℍ[R,c₁,c₂] c₁ c₂) :=
⟨Basis.self R⟩
variable (q : Basis A c₁ c₂)
attribute [simp] i_mul_i j_mul_j i_mul_j j_mul_i
@[simp]
theorem i_mul_k : q.i * q.k = c₁ • q.j := by
rw [← i_mul_j, ← mul_assoc, i_mul_i, smul_mul_assoc, one_mul]
#align quaternion_algebra.basis.i_mul_k QuaternionAlgebra.Basis.i_mul_k
@[simp]
theorem k_mul_i : q.k * q.i = -c₁ • q.j := by
rw [← i_mul_j, mul_assoc, j_mul_i, mul_neg, i_mul_k, neg_smul]
#align quaternion_algebra.basis.k_mul_i QuaternionAlgebra.Basis.k_mul_i
@[simp]
theorem k_mul_j : q.k * q.j = c₂ • q.i := by
rw [← i_mul_j, mul_assoc, j_mul_j, mul_smul_comm, mul_one]
#align quaternion_algebra.basis.k_mul_j QuaternionAlgebra.Basis.k_mul_j
@[simp]
theorem j_mul_k : q.j * q.k = -c₂ • q.i := by
rw [← i_mul_j, ← mul_assoc, j_mul_i, neg_mul, k_mul_j, neg_smul]
#align quaternion_algebra.basis.j_mul_k QuaternionAlgebra.Basis.j_mul_k
@[simp]
theorem k_mul_k : q.k * q.k = -((c₁ * c₂) • (1 : A)) := by
rw [← i_mul_j, mul_assoc, ← mul_assoc q.j _ _, j_mul_i, ← i_mul_j, ← mul_assoc, mul_neg, ←
mul_assoc, i_mul_i, smul_mul_assoc, one_mul, neg_mul, smul_mul_assoc, j_mul_j, smul_smul]
#align quaternion_algebra.basis.k_mul_k QuaternionAlgebra.Basis.k_mul_k
def lift (x : ℍ[R,c₁,c₂]) : A :=
algebraMap R _ x.re + x.imI • q.i + x.imJ • q.j + x.imK • q.k
#align quaternion_algebra.basis.lift QuaternionAlgebra.Basis.lift
theorem lift_zero : q.lift (0 : ℍ[R,c₁,c₂]) = 0 := by simp [lift]
#align quaternion_algebra.basis.lift_zero QuaternionAlgebra.Basis.lift_zero
theorem lift_one : q.lift (1 : ℍ[R,c₁,c₂]) = 1 := by simp [lift]
#align quaternion_algebra.basis.lift_one QuaternionAlgebra.Basis.lift_one
theorem lift_add (x y : ℍ[R,c₁,c₂]) : q.lift (x + y) = q.lift x + q.lift y := by
simp only [lift, add_re, map_add, add_imI, add_smul, add_imJ, add_imK]
abel
#align quaternion_algebra.basis.lift_add QuaternionAlgebra.Basis.lift_add
theorem lift_mul (x y : ℍ[R,c₁,c₂]) : q.lift (x * y) = q.lift x * q.lift y := by
simp only [lift, Algebra.algebraMap_eq_smul_one]
simp_rw [add_mul, mul_add, smul_mul_assoc, mul_smul_comm, one_mul, mul_one, smul_smul]
simp only [i_mul_i, j_mul_j, i_mul_j, j_mul_i, i_mul_k, k_mul_i, k_mul_j, j_mul_k, k_mul_k]
simp only [smul_smul, smul_neg, sub_eq_add_neg, add_smul, ← add_assoc, mul_neg, neg_smul]
simp only [mul_right_comm _ _ (c₁ * c₂), mul_comm _ (c₁ * c₂)]
simp only [mul_comm _ c₁, mul_right_comm _ _ c₁]
simp only [mul_comm _ c₂, mul_right_comm _ _ c₂]
simp only [← mul_comm c₁ c₂, ← mul_assoc]
simp only [mul_re, sub_eq_add_neg, add_smul, neg_smul, mul_imI, ← add_assoc, mul_imJ, mul_imK]
abel
#align quaternion_algebra.basis.lift_mul QuaternionAlgebra.Basis.lift_mul
| Mathlib/Algebra/QuaternionBasis.lean | 138 | 139 | theorem lift_smul (r : R) (x : ℍ[R,c₁,c₂]) : q.lift (r • x) = r • q.lift x := by |
simp [lift, mul_smul, ← Algebra.smul_def]
| 1 |
import Mathlib.Algebra.Group.Equiv.TypeTags
import Mathlib.GroupTheory.FreeAbelianGroup
import Mathlib.GroupTheory.FreeGroup.IsFreeGroup
import Mathlib.LinearAlgebra.Dimension.StrongRankCondition
#align_import group_theory.free_abelian_group_finsupp from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
noncomputable section
variable {X : Type*}
def FreeAbelianGroup.toFinsupp : FreeAbelianGroup X →+ X →₀ ℤ :=
FreeAbelianGroup.lift fun x => Finsupp.single x (1 : ℤ)
#align free_abelian_group.to_finsupp FreeAbelianGroup.toFinsupp
def Finsupp.toFreeAbelianGroup : (X →₀ ℤ) →+ FreeAbelianGroup X :=
Finsupp.liftAddHom fun x => (smulAddHom ℤ (FreeAbelianGroup X)).flip (FreeAbelianGroup.of x)
#align finsupp.to_free_abelian_group Finsupp.toFreeAbelianGroup
open Finsupp FreeAbelianGroup
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_singleAddHom (x : X) :
Finsupp.toFreeAbelianGroup.comp (Finsupp.singleAddHom x) =
(smulAddHom ℤ (FreeAbelianGroup X)).flip (of x) := by
ext
simp only [AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply, one_smul,
toFreeAbelianGroup, Finsupp.liftAddHom_apply_single]
#align finsupp.to_free_abelian_group_comp_single_add_hom Finsupp.toFreeAbelianGroup_comp_singleAddHom
@[simp]
theorem FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup :
toFinsupp.comp toFreeAbelianGroup = AddMonoidHom.id (X →₀ ℤ) := by
ext x y; simp only [AddMonoidHom.id_comp]
rw [AddMonoidHom.comp_assoc, Finsupp.toFreeAbelianGroup_comp_singleAddHom]
simp only [toFinsupp, AddMonoidHom.coe_comp, Finsupp.singleAddHom_apply, Function.comp_apply,
one_smul, lift.of, AddMonoidHom.flip_apply, smulAddHom_apply, AddMonoidHom.id_apply]
#align free_abelian_group.to_finsupp_comp_to_free_abelian_group FreeAbelianGroup.toFinsupp_comp_toFreeAbelianGroup
@[simp]
theorem Finsupp.toFreeAbelianGroup_comp_toFinsupp :
toFreeAbelianGroup.comp toFinsupp = AddMonoidHom.id (FreeAbelianGroup X) := by
ext
rw [toFreeAbelianGroup, toFinsupp, AddMonoidHom.comp_apply, lift.of,
liftAddHom_apply_single, AddMonoidHom.flip_apply, smulAddHom_apply, one_smul,
AddMonoidHom.id_apply]
#align finsupp.to_free_abelian_group_comp_to_finsupp Finsupp.toFreeAbelianGroup_comp_toFinsupp
@[simp]
| Mathlib/GroupTheory/FreeAbelianGroupFinsupp.lean | 72 | 74 | theorem Finsupp.toFreeAbelianGroup_toFinsupp {X} (x : FreeAbelianGroup X) :
Finsupp.toFreeAbelianGroup (FreeAbelianGroup.toFinsupp x) = x := by |
rw [← AddMonoidHom.comp_apply, Finsupp.toFreeAbelianGroup_comp_toFinsupp, AddMonoidHom.id_apply]
| 1 |
import Mathlib.NumberTheory.Zsqrtd.Basic
import Mathlib.RingTheory.PrincipalIdealDomain
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Real.Archimedean
#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
open Zsqrtd Complex
open scoped ComplexConjugate
abbrev GaussianInt : Type :=
Zsqrtd (-1)
#align gaussian_int GaussianInt
local notation "ℤ[i]" => GaussianInt
namespace GaussianInt
instance : Repr ℤ[i] :=
⟨fun x _ => "⟨" ++ repr x.re ++ ", " ++ repr x.im ++ "⟩"⟩
instance instCommRing : CommRing ℤ[i] :=
Zsqrtd.commRing
#align gaussian_int.comm_ring GaussianInt.instCommRing
section
attribute [-instance] Complex.instField -- Avoid making things noncomputable unnecessarily.
def toComplex : ℤ[i] →+* ℂ :=
Zsqrtd.lift ⟨I, by simp⟩
#align gaussian_int.to_complex GaussianInt.toComplex
end
instance : Coe ℤ[i] ℂ :=
⟨toComplex⟩
theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
rfl
#align gaussian_int.to_complex_def GaussianInt.toComplex_def
theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [toComplex_def]
#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
apply Complex.ext <;> simp [toComplex_def]
#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
@[simp]
theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [toComplex_def]
#align gaussian_int.to_real_re GaussianInt.to_real_re
@[simp]
theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [toComplex_def]
#align gaussian_int.to_real_im GaussianInt.to_real_im
@[simp]
theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [toComplex_def]
#align gaussian_int.to_complex_re GaussianInt.toComplex_re
@[simp]
theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def]
#align gaussian_int.to_complex_im GaussianInt.toComplex_im
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
toComplex.map_add _ _
#align gaussian_int.to_complex_add GaussianInt.toComplex_add
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
toComplex.map_mul _ _
#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
toComplex.map_one
#align gaussian_int.to_complex_one GaussianInt.toComplex_one
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
toComplex.map_zero
#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
toComplex.map_neg _
#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
-- Porting note (#10618): @[simp] can prove this
theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
toComplex.map_sub _ _
#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
@[simp]
theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) := by
rw [toComplex_def₂, toComplex_def₂]
exact congr_arg₂ _ rfl (Int.cast_neg _)
#align gaussian_int.to_complex_star GaussianInt.toComplex_star
@[simp]
theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
cases x; cases y; simp [toComplex_def₂]
#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
lemma toComplex_injective : Function.Injective GaussianInt.toComplex :=
fun ⦃_ _⦄ ↦ toComplex_inj.mp
@[simp]
theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
rw [← toComplex_zero, toComplex_inj]
#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
@[simp]
| Mathlib/NumberTheory/Zsqrtd/GaussianInt.lean | 154 | 155 | theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by |
rw [Zsqrtd.norm, normSq]; simp
| 1 |
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.MkIffOfInductiveProp
#align_import data.sum.basic from "leanprover-community/mathlib"@"bd9851ca476957ea4549eb19b40e7b5ade9428cc"
universe u v w x
variable {α : Type u} {α' : Type w} {β : Type v} {β' : Type x} {γ δ : Type*}
namespace Sum
#align sum.forall Sum.forall
#align sum.exists Sum.exists
theorem exists_sum {γ : α ⊕ β → Sort*} (p : (∀ ab, γ ab) → Prop) :
(∃ fab, p fab) ↔ (∃ fa fb, p (Sum.rec fa fb)) := by
rw [← not_forall_not, forall_sum]
simp
theorem inl_injective : Function.Injective (inl : α → Sum α β) := fun _ _ ↦ inl.inj
#align sum.inl_injective Sum.inl_injective
theorem inr_injective : Function.Injective (inr : β → Sum α β) := fun _ _ ↦ inr.inj
#align sum.inr_injective Sum.inr_injective
theorem sum_rec_congr (P : α ⊕ β → Sort*) (f : ∀ i, P (inl i)) (g : ∀ i, P (inr i))
{x y : α ⊕ β} (h : x = y) :
@Sum.rec _ _ _ f g x = cast (congr_arg P h.symm) (@Sum.rec _ _ _ f g y) := by cases h; rfl
section get
#align sum.is_left Sum.isLeft
#align sum.is_right Sum.isRight
#align sum.get_left Sum.getLeft?
#align sum.get_right Sum.getRight?
variable {x y : Sum α β}
#align sum.get_left_eq_none_iff Sum.getLeft?_eq_none_iff
#align sum.get_right_eq_none_iff Sum.getRight?_eq_none_iff
theorem eq_left_iff_getLeft_eq {a : α} : x = inl a ↔ ∃ h, x.getLeft h = a := by
cases x <;> simp
theorem eq_right_iff_getRight_eq {b : β} : x = inr b ↔ ∃ h, x.getRight h = b := by
cases x <;> simp
#align sum.get_left_eq_some_iff Sum.getLeft?_eq_some_iff
#align sum.get_right_eq_some_iff Sum.getRight?_eq_some_iff
| Mathlib/Data/Sum/Basic.lean | 63 | 64 | theorem getLeft_eq_getLeft? (h₁ : x.isLeft) (h₂ : x.getLeft?.isSome) :
x.getLeft h₁ = x.getLeft?.get h₂ := by | simp [← getLeft?_eq_some_iff]
| 1 |
import Mathlib.Algebra.Order.Monoid.Defs
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Util.AssertExists
#align_import algebra.order.group.defs from "leanprover-community/mathlib"@"b599f4e4e5cf1fbcb4194503671d3d9e569c1fce"
open Function
universe u
variable {α : Type u}
class OrderedAddCommGroup (α : Type u) extends AddCommGroup α, PartialOrder α where
protected add_le_add_left : ∀ a b : α, a ≤ b → ∀ c : α, c + a ≤ c + b
#align ordered_add_comm_group OrderedAddCommGroup
class OrderedCommGroup (α : Type u) extends CommGroup α, PartialOrder α where
protected mul_le_mul_left : ∀ a b : α, a ≤ b → ∀ c : α, c * a ≤ c * b
#align ordered_comm_group OrderedCommGroup
attribute [to_additive] OrderedCommGroup
@[to_additive]
instance OrderedCommGroup.to_covariantClass_left_le (α : Type u) [OrderedCommGroup α] :
CovariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := OrderedCommGroup.mul_le_mul_left b c bc a
#align ordered_comm_group.to_covariant_class_left_le OrderedCommGroup.to_covariantClass_left_le
#align ordered_add_comm_group.to_covariant_class_left_le OrderedAddCommGroup.to_covariantClass_left_le
-- See note [lower instance priority]
@[to_additive OrderedAddCommGroup.toOrderedCancelAddCommMonoid]
instance (priority := 100) OrderedCommGroup.toOrderedCancelCommMonoid [OrderedCommGroup α] :
OrderedCancelCommMonoid α :=
{ ‹OrderedCommGroup α› with le_of_mul_le_mul_left := fun a b c ↦ le_of_mul_le_mul_left' }
#align ordered_comm_group.to_ordered_cancel_comm_monoid OrderedCommGroup.toOrderedCancelCommMonoid
#align ordered_add_comm_group.to_ordered_cancel_add_comm_monoid OrderedAddCommGroup.toOrderedCancelAddCommMonoid
example (α : Type u) [OrderedAddCommGroup α] : CovariantClass α α (swap (· + ·)) (· < ·) :=
IsRightCancelAdd.covariant_swap_add_lt_of_covariant_swap_add_le α
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- It was introduced in https://github.com/leanprover-community/mathlib/pull/17564
-- but without the motivation clearly explained.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_left_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (· * ·) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_left' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_left_le OrderedCommGroup.to_contravariantClass_left_le
#align ordered_add_comm_group.to_contravariant_class_left_le OrderedAddCommGroup.to_contravariantClass_left_le
-- Porting note: this instance is not used,
-- and causes timeouts after lean4#2210.
-- See further explanation on `OrderedCommGroup.to_contravariantClass_left_le`.
@[to_additive "A choice-free shortcut instance."]
theorem OrderedCommGroup.to_contravariantClass_right_le (α : Type u) [OrderedCommGroup α] :
ContravariantClass α α (swap (· * ·)) (· ≤ ·) where
elim a b c bc := by simpa using mul_le_mul_right' bc a⁻¹
#align ordered_comm_group.to_contravariant_class_right_le OrderedCommGroup.to_contravariantClass_right_le
#align ordered_add_comm_group.to_contravariant_class_right_le OrderedAddCommGroup.to_contravariantClass_right_le
section Group
variable [Group α]
section Preorder
variable [Preorder α]
section CommGroup
variable [CommGroup α]
-- Most of the lemmas that are primed in this section appear in ordered_field.
-- I (DT) did not try to minimise the assumptions.
section Group
variable [Group α] [LT α]
section Right
variable [CovariantClass α α (swap (· * ·)) (· < ·)] {a b c d : α}
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 875 | 876 | theorem div_lt_div_iff_right (c : α) : a / c < b / c ↔ a < b := by |
simpa only [div_eq_mul_inv] using mul_lt_mul_iff_right _
| 1 |
import Mathlib.Algebra.EuclideanDomain.Defs
import Mathlib.Algebra.Ring.Divisibility.Basic
import Mathlib.Algebra.Ring.Regular
import Mathlib.Algebra.GroupWithZero.Divisibility
import Mathlib.Algebra.Ring.Basic
#align_import algebra.euclidean_domain.basic from "leanprover-community/mathlib"@"bf9bbbcf0c1c1ead18280b0d010e417b10abb1b6"
universe u
namespace EuclideanDomain
variable {R : Type u}
variable [EuclideanDomain R]
local infixl:50 " ≺ " => EuclideanDomain.R
-- See note [lower instance priority]
instance (priority := 100) toMulDivCancelClass : MulDivCancelClass R where
mul_div_cancel a b hb := by
refine (eq_of_sub_eq_zero ?_).symm
by_contra h
have := mul_right_not_lt b h
rw [sub_mul, mul_comm (_ / _), sub_eq_iff_eq_add'.2 (div_add_mod (a * b) b).symm] at this
exact this (mod_lt _ hb)
#align euclidean_domain.mul_div_cancel_left mul_div_cancel_left₀
#align euclidean_domain.mul_div_cancel mul_div_cancel_right₀
@[simp]
theorem mod_eq_zero {a b : R} : a % b = 0 ↔ b ∣ a :=
⟨fun h => by
rw [← div_add_mod a b, h, add_zero]
exact dvd_mul_right _ _, fun ⟨c, e⟩ => by
rw [e, ← add_left_cancel_iff, div_add_mod, add_zero]
haveI := Classical.dec
by_cases b0 : b = 0
· simp only [b0, zero_mul]
· rw [mul_div_cancel_left₀ _ b0]⟩
#align euclidean_domain.mod_eq_zero EuclideanDomain.mod_eq_zero
@[simp]
theorem mod_self (a : R) : a % a = 0 :=
mod_eq_zero.2 dvd_rfl
#align euclidean_domain.mod_self EuclideanDomain.mod_self
theorem dvd_mod_iff {a b c : R} (h : c ∣ b) : c ∣ a % b ↔ c ∣ a := by
rw [← dvd_add_right (h.mul_right _), div_add_mod]
#align euclidean_domain.dvd_mod_iff EuclideanDomain.dvd_mod_iff
@[simp]
theorem mod_one (a : R) : a % 1 = 0 :=
mod_eq_zero.2 (one_dvd _)
#align euclidean_domain.mod_one EuclideanDomain.mod_one
@[simp]
theorem zero_mod (b : R) : 0 % b = 0 :=
mod_eq_zero.2 (dvd_zero _)
#align euclidean_domain.zero_mod EuclideanDomain.zero_mod
@[simp]
theorem zero_div {a : R} : 0 / a = 0 :=
by_cases (fun a0 : a = 0 => a0.symm ▸ div_zero 0) fun a0 => by
simpa only [zero_mul] using mul_div_cancel_right₀ 0 a0
#align euclidean_domain.zero_div EuclideanDomain.zero_div
@[simp]
theorem div_self {a : R} (a0 : a ≠ 0) : a / a = 1 := by
simpa only [one_mul] using mul_div_cancel_right₀ 1 a0
#align euclidean_domain.div_self EuclideanDomain.div_self
| Mathlib/Algebra/EuclideanDomain/Basic.lean | 88 | 89 | theorem eq_div_of_mul_eq_left {a b c : R} (hb : b ≠ 0) (h : a * b = c) : a = c / b := by |
rw [← h, mul_div_cancel_right₀ _ hb]
| 1 |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Analysis.NormedSpace.Basic
import Mathlib.Analysis.Normed.Group.AddTorsor
import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace
import Mathlib.Topology.Instances.RealVectorSpace
#align_import analysis.normed_space.add_torsor from "leanprover-community/mathlib"@"837f72de63ad6cd96519cde5f1ffd5ed8d280ad0"
noncomputable section
open NNReal Topology
open Filter
variable {α V P W Q : Type*} [SeminormedAddCommGroup V] [PseudoMetricSpace P] [NormedAddTorsor V P]
[NormedAddCommGroup W] [MetricSpace Q] [NormedAddTorsor W Q]
section NormedSpace
variable {𝕜 : Type*} [NormedField 𝕜] [NormedSpace 𝕜 V] [NormedSpace 𝕜 W]
open AffineMap
theorem AffineSubspace.isClosed_direction_iff (s : AffineSubspace 𝕜 Q) :
IsClosed (s.direction : Set W) ↔ IsClosed (s : Set Q) := by
rcases s.eq_bot_or_nonempty with (rfl | ⟨x, hx⟩); · simp [isClosed_singleton]
rw [← (IsometryEquiv.vaddConst x).toHomeomorph.symm.isClosed_image,
AffineSubspace.coe_direction_eq_vsub_set_right hx]
rfl
#align affine_subspace.is_closed_direction_iff AffineSubspace.isClosed_direction_iff
@[simp]
theorem dist_center_homothety (p₁ p₂ : P) (c : 𝕜) :
dist p₁ (homothety p₁ c p₂) = ‖c‖ * dist p₁ p₂ := by
simp [homothety_def, norm_smul, ← dist_eq_norm_vsub, dist_comm]
#align dist_center_homothety dist_center_homothety
@[simp]
theorem nndist_center_homothety (p₁ p₂ : P) (c : 𝕜) :
nndist p₁ (homothety p₁ c p₂) = ‖c‖₊ * nndist p₁ p₂ :=
NNReal.eq <| dist_center_homothety _ _ _
#align nndist_center_homothety nndist_center_homothety
@[simp]
| Mathlib/Analysis/NormedSpace/AddTorsor.lean | 57 | 58 | theorem dist_homothety_center (p₁ p₂ : P) (c : 𝕜) :
dist (homothety p₁ c p₂) p₁ = ‖c‖ * dist p₁ p₂ := by | rw [dist_comm, dist_center_homothety]
| 1 |
import Mathlib.Tactic.Ring.Basic
import Mathlib.Tactic.TryThis
import Mathlib.Tactic.Conv
import Mathlib.Util.Qq
set_option autoImplicit true
-- In this file we would like to be able to use multi-character auto-implicits.
set_option relaxedAutoImplicit true
namespace Mathlib.Tactic
open Lean hiding Rat
open Qq Meta
namespace RingNF
open Ring
inductive RingMode where
| SOP
| raw
deriving Inhabited, BEq, Repr
structure Config where
red := TransparencyMode.reducible
recursive := true
mode := RingMode.SOP
deriving Inhabited, BEq, Repr
declare_config_elab elabConfig Config
structure Context where
ctx : Simp.Context
simp : Simp.Result → SimpM Simp.Result
abbrev M := ReaderT Context AtomM
def rewrite (parent : Expr) (root := true) : M Simp.Result :=
fun nctx rctx s ↦ do
let pre : Simp.Simproc := fun e =>
try
guard <| root || parent != e -- recursion guard
let e ← withReducible <| whnf e
guard e.isApp -- all interesting ring expressions are applications
let ⟨u, α, e⟩ ← inferTypeQ' e
let sα ← synthInstanceQ (q(CommSemiring $α) : Q(Type u))
let c ← mkCache sα
let ⟨a, _, pa⟩ ← match ← isAtomOrDerivable sα c e rctx s with
| none => eval sα c e rctx s -- `none` indicates that `eval` will find something algebraic.
| some none => failure -- No point rewriting atoms
| some (some r) => pure r -- Nothing algebraic for `eval` to use, but `norm_num` simplifies.
let r ← nctx.simp { expr := a, proof? := pa }
if ← withReducible <| isDefEq r.expr e then return .done { expr := r.expr }
pure (.done r)
catch _ => pure <| .continue
let post := Simp.postDefault #[]
(·.1) <$> Simp.main parent nctx.ctx (methods := { pre, post })
variable [CommSemiring R]
theorem add_assoc_rev (a b c : R) : a + (b + c) = a + b + c := (add_assoc ..).symm
theorem mul_assoc_rev (a b c : R) : a * (b * c) = a * b * c := (mul_assoc ..).symm
theorem mul_neg {R} [Ring R] (a b : R) : a * -b = -(a * b) := by simp
theorem add_neg {R} [Ring R] (a b : R) : a + -b = a - b := (sub_eq_add_neg ..).symm
theorem nat_rawCast_0 : (Nat.rawCast 0 : R) = 0 := by simp
theorem nat_rawCast_1 : (Nat.rawCast 1 : R) = 1 := by simp
theorem nat_rawCast_2 [Nat.AtLeastTwo n] : (Nat.rawCast n : R) = OfNat.ofNat n := rfl
theorem int_rawCast_neg {R} [Ring R] : (Int.rawCast (.negOfNat n) : R) = -Nat.rawCast n := by simp
| Mathlib/Tactic/Ring/RingNF.lean | 124 | 125 | theorem rat_rawCast_pos {R} [DivisionRing R] :
(Rat.rawCast (.ofNat n) d : R) = Nat.rawCast n / Nat.rawCast d := by | simp
| 1 |
import Mathlib.GroupTheory.Perm.Cycle.Type
import Mathlib.GroupTheory.Perm.Option
import Mathlib.Logic.Equiv.Fin
import Mathlib.Logic.Equiv.Fintype
#align_import group_theory.perm.fin from "leanprover-community/mathlib"@"7e1c1263b6a25eb90bf16e80d8f47a657e403c4c"
open Equiv
def Equiv.Perm.decomposeFin {n : ℕ} : Perm (Fin n.succ) ≃ Fin n.succ × Perm (Fin n) :=
((Equiv.permCongr <| finSuccEquiv n).trans Equiv.Perm.decomposeOption).trans
(Equiv.prodCongr (finSuccEquiv n).symm (Equiv.refl _))
#align equiv.perm.decompose_fin Equiv.Perm.decomposeFin
@[simp]
| Mathlib/GroupTheory/Perm/Fin.lean | 29 | 31 | theorem Equiv.Perm.decomposeFin_symm_of_refl {n : ℕ} (p : Fin (n + 1)) :
Equiv.Perm.decomposeFin.symm (p, Equiv.refl _) = swap 0 p := by |
simp [Equiv.Perm.decomposeFin, Equiv.permCongr_def]
| 1 |
import Mathlib.Algebra.Associated
import Mathlib.Algebra.Group.Submonoid.Membership
import Mathlib.Algebra.Ring.Opposite
import Mathlib.GroupTheory.GroupAction.Opposite
#align_import ring_theory.non_zero_divisors from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
variable (M₀ : Type*) [MonoidWithZero M₀]
def nonZeroDivisorsLeft : Submonoid M₀ where
carrier := {x | ∀ y, y * x = 0 → y = 0}
one_mem' := by simp
mul_mem' {x} {y} hx hy := fun z hz ↦ hx _ <| hy _ (mul_assoc z x y ▸ hz)
@[simp] lemma mem_nonZeroDivisorsLeft_iff {x : M₀} :
x ∈ nonZeroDivisorsLeft M₀ ↔ ∀ y, y * x = 0 → y = 0 :=
Iff.rfl
lemma nmem_nonZeroDivisorsLeft_iff {r : M₀} :
r ∉ nonZeroDivisorsLeft M₀ ↔ {s | s * r = 0 ∧ s ≠ 0}.Nonempty := by
simpa [mem_nonZeroDivisorsLeft_iff] using Set.nonempty_def.symm
def nonZeroDivisorsRight : Submonoid M₀ where
carrier := {x | ∀ y, x * y = 0 → y = 0}
one_mem' := by simp
mul_mem' := fun {x} {y} hx hy z hz ↦ hy _ (hx _ ((mul_assoc x y z).symm ▸ hz))
@[simp] lemma mem_nonZeroDivisorsRight_iff {x : M₀} :
x ∈ nonZeroDivisorsRight M₀ ↔ ∀ y, x * y = 0 → y = 0 :=
Iff.rfl
lemma nmem_nonZeroDivisorsRight_iff {r : M₀} :
r ∉ nonZeroDivisorsRight M₀ ↔ {s | r * s = 0 ∧ s ≠ 0}.Nonempty := by
simpa [mem_nonZeroDivisorsRight_iff] using Set.nonempty_def.symm
lemma nonZeroDivisorsLeft_eq_right (M₀ : Type*) [CommMonoidWithZero M₀] :
nonZeroDivisorsLeft M₀ = nonZeroDivisorsRight M₀ := by
ext x; simp [mul_comm x]
@[simp] lemma coe_nonZeroDivisorsLeft_eq [NoZeroDivisors M₀] [Nontrivial M₀] :
nonZeroDivisorsLeft M₀ = {x : M₀ | x ≠ 0} := by
ext x
simp only [SetLike.mem_coe, mem_nonZeroDivisorsLeft_iff, mul_eq_zero, forall_eq_or_imp, true_and,
Set.mem_setOf_eq]
refine ⟨fun h ↦ ?_, fun hx y hx' ↦ by contradiction⟩
contrapose! h
exact ⟨1, h, one_ne_zero⟩
@[simp] lemma coe_nonZeroDivisorsRight_eq [NoZeroDivisors M₀] [Nontrivial M₀] :
nonZeroDivisorsRight M₀ = {x : M₀ | x ≠ 0} := by
ext x
simp only [SetLike.mem_coe, mem_nonZeroDivisorsRight_iff, mul_eq_zero, Set.mem_setOf_eq]
refine ⟨fun h ↦ ?_, fun hx y hx' ↦ by aesop⟩
contrapose! h
exact ⟨1, Or.inl h, one_ne_zero⟩
def nonZeroDivisors (R : Type*) [MonoidWithZero R] : Submonoid R where
carrier := { x | ∀ z, z * x = 0 → z = 0 }
one_mem' _ hz := by rwa [mul_one] at hz
mul_mem' hx₁ hx₂ _ hz := by
rw [← mul_assoc] at hz
exact hx₁ _ (hx₂ _ hz)
#align non_zero_divisors nonZeroDivisors
scoped[nonZeroDivisors] notation:9000 R "⁰" => nonZeroDivisors R
def nonZeroSMulDivisors (R : Type*) [MonoidWithZero R] (M : Type _) [Zero M] [MulAction R M] :
Submonoid R where
carrier := { r | ∀ m : M, r • m = 0 → m = 0}
one_mem' m h := (one_smul R m) ▸ h
mul_mem' {r₁ r₂} h₁ h₂ m H := h₂ _ <| h₁ _ <| mul_smul r₁ r₂ m ▸ H
scoped[nonZeroSMulDivisors] notation:9000 R "⁰[" M "]" => nonZeroSMulDivisors R M
section nonZeroDivisors
open nonZeroDivisors
variable {M M' M₁ R R' F : Type*} [MonoidWithZero M] [MonoidWithZero M'] [CommMonoidWithZero M₁]
[Ring R] [CommRing R']
theorem mem_nonZeroDivisors_iff {r : M} : r ∈ M⁰ ↔ ∀ x, x * r = 0 → x = 0 := Iff.rfl
#align mem_non_zero_divisors_iff mem_nonZeroDivisors_iff
lemma nmem_nonZeroDivisors_iff {r : M} : r ∉ M⁰ ↔ {s | s * r = 0 ∧ s ≠ 0}.Nonempty := by
simpa [mem_nonZeroDivisors_iff] using Set.nonempty_def.symm
theorem mul_right_mem_nonZeroDivisors_eq_zero_iff {x r : M} (hr : r ∈ M⁰) : x * r = 0 ↔ x = 0 :=
⟨hr _, by simp (config := { contextual := true })⟩
#align mul_right_mem_non_zero_divisors_eq_zero_iff mul_right_mem_nonZeroDivisors_eq_zero_iff
@[simp]
theorem mul_right_coe_nonZeroDivisors_eq_zero_iff {x : M} {c : M⁰} : x * c = 0 ↔ x = 0 :=
mul_right_mem_nonZeroDivisors_eq_zero_iff c.prop
#align mul_right_coe_non_zero_divisors_eq_zero_iff mul_right_coe_nonZeroDivisors_eq_zero_iff
| Mathlib/Algebra/GroupWithZero/NonZeroDivisors.lean | 129 | 130 | theorem mul_left_mem_nonZeroDivisors_eq_zero_iff {r x : M₁} (hr : r ∈ M₁⁰) : r * x = 0 ↔ x = 0 := by |
rw [mul_comm, mul_right_mem_nonZeroDivisors_eq_zero_iff hr]
| 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.