Context stringlengths 57 6.04k | file_name stringlengths 21 79 | start int64 14 1.49k | end int64 18 1.5k | theorem stringlengths 25 1.55k | proof stringlengths 5 7.36k | goals listlengths 0 224 | goals_before listlengths 0 220 |
|---|---|---|---|---|---|---|---|
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Computability.Primrec
import Mathlib.Tactic.Ring
import Mathlib.Tactic.Linarith
#align_import computability.ackermann from "leanprover-community/mathlib"@"9b2660e1b25419042c8da10bf411aa3c67f14383"
open Nat
def ack : ℕ → ℕ → ℕ
| 0, n => n + 1
| m + 1, 0 => ack m 1
| m + 1, n + 1 => ack m (ack (m + 1) n)
#align ack ack
@[simp]
theorem ack_zero (n : ℕ) : ack 0 n = n + 1 := by rw [ack]
#align ack_zero ack_zero
@[simp]
theorem ack_succ_zero (m : ℕ) : ack (m + 1) 0 = ack m 1 := by rw [ack]
#align ack_succ_zero ack_succ_zero
@[simp]
theorem ack_succ_succ (m n : ℕ) : ack (m + 1) (n + 1) = ack m (ack (m + 1) n) := by rw [ack]
#align ack_succ_succ ack_succ_succ
@[simp]
theorem ack_one (n : ℕ) : ack 1 n = n + 2 := by
induction' n with n IH
· rfl
· simp [IH]
#align ack_one ack_one
@[simp]
| Mathlib/Computability/Ackermann.lean | 89 | 92 | theorem ack_two (n : ℕ) : ack 2 n = 2 * n + 3 := by |
induction' n with n IH
· rfl
· simpa [mul_succ]
| [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1",
" ack (m + 1) (n + 1) = ack m (ack (m + 1) n)",
" ack 1 n = n + 2",
" ack 1 0 = 0 + 2",
" ack 1 (n + 1) = n + 1 + 2",
" ack 2 n = 2 * n + 3",
" ack 2 0 = 2 * 0 + 3",
" ack 2 (n + 1) = 2 * (n + 1) + 3"
] | [
" ack 0 n = n + 1",
" ack (m + 1) 0 = ack m 1",
" ack (m + 1) (n + 1) = ack m (ack (m + 1) n)",
" ack 1 n = n + 2",
" ack 1 0 = 0 + 2",
" ack 1 (n + 1) = n + 1 + 2"
] |
import Mathlib.MeasureTheory.MeasurableSpace.Basic
import Mathlib.Data.Set.MemPartition
import Mathlib.Order.Filter.CountableSeparatingOn
open Set MeasureTheory
namespace MeasurableSpace
variable {α β : Type*}
class CountablyGenerated (α : Type*) [m : MeasurableSpace α] : Prop where
isCountablyGenerated : ∃ b : Set (Set α), b.Countable ∧ m = generateFrom b
#align measurable_space.countably_generated MeasurableSpace.CountablyGenerated
def countableGeneratingSet (α : Type*) [MeasurableSpace α] [h : CountablyGenerated α] :
Set (Set α) :=
insert ∅ h.isCountablyGenerated.choose
lemma countable_countableGeneratingSet [MeasurableSpace α] [h : CountablyGenerated α] :
Set.Countable (countableGeneratingSet α) :=
Countable.insert _ h.isCountablyGenerated.choose_spec.1
lemma generateFrom_countableGeneratingSet [m : MeasurableSpace α] [h : CountablyGenerated α] :
generateFrom (countableGeneratingSet α) = m :=
(generateFrom_insert_empty _).trans <| h.isCountablyGenerated.choose_spec.2.symm
lemma empty_mem_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
∅ ∈ countableGeneratingSet α := mem_insert _ _
lemma nonempty_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α] :
Set.Nonempty (countableGeneratingSet α) :=
⟨∅, mem_insert _ _⟩
lemma measurableSet_countableGeneratingSet [MeasurableSpace α] [CountablyGenerated α]
{s : Set α} (hs : s ∈ countableGeneratingSet α) :
MeasurableSet s := by
rw [← generateFrom_countableGeneratingSet (α := α)]
exact measurableSet_generateFrom hs
def natGeneratingSequence (α : Type*) [MeasurableSpace α] [CountablyGenerated α] : ℕ → (Set α) :=
enumerateCountable (countable_countableGeneratingSet (α := α)) ∅
lemma generateFrom_natGeneratingSequence (α : Type*) [m : MeasurableSpace α]
[CountablyGenerated α] : generateFrom (range (natGeneratingSequence _)) = m := by
rw [natGeneratingSequence, range_enumerateCountable_of_mem _ empty_mem_countableGeneratingSet,
generateFrom_countableGeneratingSet]
lemma measurableSet_natGeneratingSequence [MeasurableSpace α] [CountablyGenerated α] (n : ℕ) :
MeasurableSet (natGeneratingSequence α n) :=
measurableSet_countableGeneratingSet $ Set.enumerateCountable_mem _
empty_mem_countableGeneratingSet n
theorem CountablyGenerated.comap [m : MeasurableSpace β] [h : CountablyGenerated β] (f : α → β) :
@CountablyGenerated α (.comap f m) := by
rcases h with ⟨⟨b, hbc, rfl⟩⟩
rw [comap_generateFrom]
letI := generateFrom (preimage f '' b)
exact ⟨_, hbc.image _, rfl⟩
theorem CountablyGenerated.sup {m₁ m₂ : MeasurableSpace β} (h₁ : @CountablyGenerated β m₁)
(h₂ : @CountablyGenerated β m₂) : @CountablyGenerated β (m₁ ⊔ m₂) := by
rcases h₁ with ⟨⟨b₁, hb₁c, rfl⟩⟩
rcases h₂ with ⟨⟨b₂, hb₂c, rfl⟩⟩
exact @mk _ (_ ⊔ _) ⟨_, hb₁c.union hb₂c, generateFrom_sup_generateFrom⟩
instance (priority := 100) [MeasurableSpace α] [Countable α] : CountablyGenerated α where
isCountablyGenerated := by
refine ⟨⋃ y, {measurableAtom y}, countable_iUnion (fun i ↦ countable_singleton _), ?_⟩
refine le_antisymm ?_ (generateFrom_le (by simp [MeasurableSet.measurableAtom_of_countable]))
intro s hs
have : s = ⋃ y ∈ s, measurableAtom y := by
apply Subset.antisymm
· intro x hx
simpa using ⟨x, hx, by simp⟩
· simp only [iUnion_subset_iff]
intro x hx
exact measurableAtom_subset hs hx
rw [this]
apply MeasurableSet.biUnion (to_countable s) (fun x _hx ↦ ?_)
apply measurableSet_generateFrom
simp
instance [MeasurableSpace α] [CountablyGenerated α] {p : α → Prop} :
CountablyGenerated { x // p x } := .comap _
instance [MeasurableSpace α] [CountablyGenerated α] [MeasurableSpace β] [CountablyGenerated β] :
CountablyGenerated (α × β) :=
.sup (.comap Prod.fst) (.comap Prod.snd)
section SeparatesPoints
class SeparatesPoints (α : Type*) [m : MeasurableSpace α] : Prop where
separates : ∀ x y : α, (∀ s, MeasurableSet s → (x ∈ s → y ∈ s)) → x = y
theorem separatesPoints_def [MeasurableSpace α] [hs : SeparatesPoints α] {x y : α}
(h : ∀ s, MeasurableSet s → (x ∈ s → y ∈ s)) : x = y := hs.separates _ _ h
theorem exists_measurableSet_of_ne [MeasurableSpace α] [SeparatesPoints α] {x y : α}
(h : x ≠ y) : ∃ s, MeasurableSet s ∧ x ∈ s ∧ y ∉ s := by
contrapose! h
exact separatesPoints_def h
theorem separatesPoints_iff [MeasurableSpace α] : SeparatesPoints α ↔
∀ x y : α, (∀ s, MeasurableSet s → (x ∈ s ↔ y ∈ s)) → x = y :=
⟨fun h ↦ fun _ _ hxy ↦ h.separates _ _ fun _ hs xs ↦ (hxy _ hs).mp xs,
fun h ↦ ⟨fun _ _ hxy ↦ h _ _ fun _ hs ↦
⟨fun xs ↦ hxy _ hs xs, not_imp_not.mp fun xs ↦ hxy _ hs.compl xs⟩⟩⟩
| Mathlib/MeasureTheory/MeasurableSpace/CountablyGenerated.lean | 157 | 163 | theorem separating_of_generateFrom (S : Set (Set α))
[h : @SeparatesPoints α (generateFrom S)] :
∀ x y : α, (∀ s ∈ S, x ∈ s ↔ y ∈ s) → x = y := by |
letI := generateFrom S
intros x y hxy
rw [← forall_generateFrom_mem_iff_mem_iff] at hxy
exact separatesPoints_def $ fun _ hs ↦ (hxy _ hs).mp
| [
" MeasurableSet s",
" generateFrom (range (natGeneratingSequence α)) = m",
" CountablyGenerated α",
" CountablyGenerated β",
" ∃ b, b.Countable ∧ inst✝¹ = generateFrom b",
" inst✝¹ = generateFrom (⋃ y, {measurableAtom y})",
" ∀ t ∈ ⋃ y, {measurableAtom y}, MeasurableSet t",
" inst✝¹ ≤ generateFrom (⋃ ... | [
" MeasurableSet s",
" generateFrom (range (natGeneratingSequence α)) = m",
" CountablyGenerated α",
" CountablyGenerated β",
" ∃ b, b.Countable ∧ inst✝¹ = generateFrom b",
" inst✝¹ = generateFrom (⋃ y, {measurableAtom y})",
" ∀ t ∈ ⋃ y, {measurableAtom y}, MeasurableSet t",
" inst✝¹ ≤ generateFrom (⋃ ... |
import Mathlib.Analysis.NormedSpace.LinearIsometry
import Mathlib.Analysis.NormedSpace.ContinuousLinearMap
import Mathlib.Analysis.NormedSpace.Basic
variable {𝕜 E : Type*}
namespace LinearMap
variable (𝕜)
section Seminormed
variable [NormedDivisionRing 𝕜] [SeminormedAddCommGroup E] [Module 𝕜 E] [BoundedSMul 𝕜 E]
| Mathlib/Analysis/NormedSpace/Span.lean | 36 | 39 | theorem toSpanSingleton_homothety (x : E) (c : 𝕜) :
‖LinearMap.toSpanSingleton 𝕜 E x c‖ = ‖x‖ * ‖c‖ := by |
rw [mul_comm]
exact norm_smul _ _
| [
" ‖(toSpanSingleton 𝕜 E x) c‖ = ‖x‖ * ‖c‖",
" ‖(toSpanSingleton 𝕜 E x) c‖ = ‖c‖ * ‖x‖"
] | [] |
import Mathlib.Data.Multiset.Sum
import Mathlib.Data.Finset.Card
#align_import data.finset.sum from "leanprover-community/mathlib"@"48a058d7e39a80ed56858505719a0b2197900999"
open Function Multiset Sum
namespace Finset
variable {α β : Type*} (s : Finset α) (t : Finset β)
def disjSum : Finset (Sum α β) :=
⟨s.1.disjSum t.1, s.2.disjSum t.2⟩
#align finset.disj_sum Finset.disjSum
@[simp]
theorem val_disjSum : (s.disjSum t).1 = s.1.disjSum t.1 :=
rfl
#align finset.val_disj_sum Finset.val_disjSum
@[simp]
theorem empty_disjSum : (∅ : Finset α).disjSum t = t.map Embedding.inr :=
val_inj.1 <| Multiset.zero_disjSum _
#align finset.empty_disj_sum Finset.empty_disjSum
@[simp]
theorem disjSum_empty : s.disjSum (∅ : Finset β) = s.map Embedding.inl :=
val_inj.1 <| Multiset.disjSum_zero _
#align finset.disj_sum_empty Finset.disjSum_empty
@[simp]
theorem card_disjSum : (s.disjSum t).card = s.card + t.card :=
Multiset.card_disjSum _ _
#align finset.card_disj_sum Finset.card_disjSum
theorem disjoint_map_inl_map_inr : Disjoint (s.map Embedding.inl) (t.map Embedding.inr) := by
simp_rw [disjoint_left, mem_map]
rintro x ⟨a, _, rfl⟩ ⟨b, _, ⟨⟩⟩
#align finset.disjoint_map_inl_map_inr Finset.disjoint_map_inl_map_inr
@[simp]
theorem map_inl_disjUnion_map_inr :
(s.map Embedding.inl).disjUnion (t.map Embedding.inr) (disjoint_map_inl_map_inr _ _) =
s.disjSum t :=
rfl
#align finset.map_inl_disj_union_map_inr Finset.map_inl_disjUnion_map_inr
variable {s t} {s₁ s₂ : Finset α} {t₁ t₂ : Finset β} {a : α} {b : β} {x : Sum α β}
theorem mem_disjSum : x ∈ s.disjSum t ↔ (∃ a, a ∈ s ∧ inl a = x) ∨ ∃ b, b ∈ t ∧ inr b = x :=
Multiset.mem_disjSum
#align finset.mem_disj_sum Finset.mem_disjSum
@[simp]
theorem inl_mem_disjSum : inl a ∈ s.disjSum t ↔ a ∈ s :=
Multiset.inl_mem_disjSum
#align finset.inl_mem_disj_sum Finset.inl_mem_disjSum
@[simp]
theorem inr_mem_disjSum : inr b ∈ s.disjSum t ↔ b ∈ t :=
Multiset.inr_mem_disjSum
#align finset.inr_mem_disj_sum Finset.inr_mem_disjSum
@[simp]
| Mathlib/Data/Finset/Sum.lean | 83 | 83 | theorem disjSum_eq_empty : s.disjSum t = ∅ ↔ s = ∅ ∧ t = ∅ := by | simp [ext_iff]
| [
" _root_.Disjoint (map Embedding.inl s) (map Embedding.inr t)",
" ∀ ⦃a : α ⊕ β⦄, (∃ a_1 ∈ s, Embedding.inl a_1 = a) → ¬∃ a_2 ∈ t, Embedding.inr a_2 = a",
" s.disjSum t = ∅ ↔ s = ∅ ∧ t = ∅"
] | [
" _root_.Disjoint (map Embedding.inl s) (map Embedding.inr t)",
" ∀ ⦃a : α ⊕ β⦄, (∃ a_1 ∈ s, Embedding.inl a_1 = a) → ¬∃ a_2 ∈ t, Embedding.inr a_2 = a"
] |
import Mathlib.Algebra.Group.Defs
import Mathlib.Control.Functor
#align_import control.applicative from "leanprover-community/mathlib"@"70d50ecfd4900dd6d328da39ab7ebd516abe4025"
universe u v w
section Lemmas
open Function
variable {F : Type u → Type v}
variable [Applicative F] [LawfulApplicative F]
variable {α β γ σ : Type u}
theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α) (y : F σ) :
f <$> x <*> g <$> y = ((· ∘ g) ∘ f) <$> x <*> y := by
simp [flip, functor_norm]
#align applicative.map_seq_map Applicative.map_seq_map
theorem Applicative.pure_seq_eq_map' (f : α → β) : ((pure f : F (α → β)) <*> ·) = (f <$> ·) := by
ext; simp [functor_norm]
#align applicative.pure_seq_eq_map' Applicative.pure_seq_eq_map'
| Mathlib/Control/Applicative.lean | 40 | 63 | theorem Applicative.ext {F} :
∀ {A1 : Applicative F} {A2 : Applicative F} [@LawfulApplicative F A1] [@LawfulApplicative F A2],
(∀ {α : Type u} (x : α), @Pure.pure _ A1.toPure _ x = @Pure.pure _ A2.toPure _ x) →
(∀ {α β : Type u} (f : F (α → β)) (x : F α),
@Seq.seq _ A1.toSeq _ _ f (fun _ => x) = @Seq.seq _ A2.toSeq _ _ f (fun _ => x)) →
A1 = A2
| { toFunctor := F1, seq := s1, pure := p1, seqLeft := sl1, seqRight := sr1 },
{ toFunctor := F2, seq := s2, pure := p2, seqLeft := sl2, seqRight := sr2 },
L1, L2, H1, H2 => by
obtain rfl : @p1 = @p2 := by |
funext α x
apply H1
obtain rfl : @s1 = @s2 := by
funext α β f x
exact H2 f (x Unit.unit)
obtain ⟨seqLeft_eq1, seqRight_eq1, pure_seq1, -⟩ := L1
obtain ⟨seqLeft_eq2, seqRight_eq2, pure_seq2, -⟩ := L2
obtain rfl : F1 = F2 := by
apply Functor.ext
intros
exact (pure_seq1 _ _).symm.trans (pure_seq2 _ _)
congr <;> funext α β x y
· exact (seqLeft_eq1 _ (y Unit.unit)).trans (seqLeft_eq2 _ _).symm
· exact (seqRight_eq1 _ (y Unit.unit)).trans (seqRight_eq2 _ (y Unit.unit)).symm
| [
" (Seq.seq (f <$> x) fun x => g <$> y) = Seq.seq (((fun x => x ∘ g) ∘ f) <$> x) fun x => y",
" (fun x => Seq.seq (pure f) fun x_1 => x) = fun x => f <$> x",
" (Seq.seq (pure f) fun x => x✝) = f <$> x✝",
" mk = mk",
" p1 = p2",
" p1 x = p2 x",
" s1 = s2",
" s1 f x = s2 f x",
" F1 = F2",
" ∀ (α β : ... | [
" (Seq.seq (f <$> x) fun x => g <$> y) = Seq.seq (((fun x => x ∘ g) ∘ f) <$> x) fun x => y",
" (fun x => Seq.seq (pure f) fun x_1 => x) = fun x => f <$> x",
" (Seq.seq (pure f) fun x => x✝) = f <$> x✝"
] |
import Mathlib.Analysis.InnerProductSpace.Adjoint
import Mathlib.Topology.Algebra.Module.Basic
#align_import analysis.inner_product_space.linear_pmap from "leanprover-community/mathlib"@"8b981918a93bc45a8600de608cde7944a80d92b9"
noncomputable section
open RCLike
open scoped ComplexConjugate Classical
variable {𝕜 E F G : Type*} [RCLike 𝕜]
variable [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
variable [NormedAddCommGroup F] [InnerProductSpace 𝕜 F]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 _ _ x y
namespace LinearPMap
def IsFormalAdjoint (T : E →ₗ.[𝕜] F) (S : F →ₗ.[𝕜] E) : Prop :=
∀ (x : T.domain) (y : S.domain), ⟪T x, y⟫ = ⟪(x : E), S y⟫
#align linear_pmap.is_formal_adjoint LinearPMap.IsFormalAdjoint
variable {T : E →ₗ.[𝕜] F} {S : F →ₗ.[𝕜] E}
@[symm]
protected theorem IsFormalAdjoint.symm (h : T.IsFormalAdjoint S) :
S.IsFormalAdjoint T := fun y _ => by
rw [← inner_conj_symm, ← inner_conj_symm (y : F), h]
#align linear_pmap.is_formal_adjoint.symm LinearPMap.IsFormalAdjoint.symm
variable (T)
def adjointDomain : Submodule 𝕜 F where
carrier := {y | Continuous ((innerₛₗ 𝕜 y).comp T.toFun)}
zero_mem' := by
rw [Set.mem_setOf_eq, LinearMap.map_zero, LinearMap.zero_comp]
exact continuous_zero
add_mem' hx hy := by rw [Set.mem_setOf_eq, LinearMap.map_add] at *; exact hx.add hy
smul_mem' a x hx := by
rw [Set.mem_setOf_eq, LinearMap.map_smulₛₗ] at *
exact hx.const_smul (conj a)
#align linear_pmap.adjoint_domain LinearPMap.adjointDomain
def adjointDomainMkCLM (y : T.adjointDomain) : T.domain →L[𝕜] 𝕜 :=
⟨(innerₛₗ 𝕜 (y : F)).comp T.toFun, y.prop⟩
#align linear_pmap.adjoint_domain_mk_clm LinearPMap.adjointDomainMkCLM
theorem adjointDomainMkCLM_apply (y : T.adjointDomain) (x : T.domain) :
adjointDomainMkCLM T y x = ⟪(y : F), T x⟫ :=
rfl
#align linear_pmap.adjoint_domain_mk_clm_apply LinearPMap.adjointDomainMkCLM_apply
variable {T}
variable (hT : Dense (T.domain : Set E))
def adjointDomainMkCLMExtend (y : T.adjointDomain) : E →L[𝕜] 𝕜 :=
(T.adjointDomainMkCLM y).extend (Submodule.subtypeL T.domain) hT.denseRange_val
uniformEmbedding_subtype_val.toUniformInducing
#align linear_pmap.adjoint_domain_mk_clm_extend LinearPMap.adjointDomainMkCLMExtend
@[simp]
theorem adjointDomainMkCLMExtend_apply (y : T.adjointDomain) (x : T.domain) :
adjointDomainMkCLMExtend hT y (x : E) = ⟪(y : F), T x⟫ :=
ContinuousLinearMap.extend_eq _ _ _ _ _
#align linear_pmap.adjoint_domain_mk_clm_extend_apply LinearPMap.adjointDomainMkCLMExtend_apply
variable [CompleteSpace E]
def adjointAux : T.adjointDomain →ₗ[𝕜] E where
toFun y := (InnerProductSpace.toDual 𝕜 E).symm (adjointDomainMkCLMExtend hT y)
map_add' x y :=
hT.eq_of_inner_left fun _ => by
simp only [inner_add_left, Submodule.coe_add, InnerProductSpace.toDual_symm_apply,
adjointDomainMkCLMExtend_apply]
map_smul' _ _ :=
hT.eq_of_inner_left fun _ => by
simp only [inner_smul_left, Submodule.coe_smul_of_tower, RingHom.id_apply,
InnerProductSpace.toDual_symm_apply, adjointDomainMkCLMExtend_apply]
#align linear_pmap.adjoint_aux LinearPMap.adjointAux
| Mathlib/Analysis/InnerProductSpace/LinearPMap.lean | 140 | 147 | theorem adjointAux_inner (y : T.adjointDomain) (x : T.domain) :
⟪adjointAux hT y, x⟫ = ⟪(y : F), T x⟫ := by |
simp only [adjointAux, LinearMap.coe_mk, InnerProductSpace.toDual_symm_apply,
adjointDomainMkCLMExtend_apply]
-- Porting note(https://github.com/leanprover-community/mathlib4/issues/5026):
-- mathlib3 was finished here
simp only [AddHom.coe_mk, InnerProductSpace.toDual_symm_apply]
rw [adjointDomainMkCLMExtend_apply]
| [
" ⟪↑S y, ↑x✝⟫_𝕜 = ⟪↑y, ↑T x✝⟫_𝕜",
" a✝ + b✝ ∈ {y | Continuous ⇑((innerₛₗ 𝕜) y ∘ₗ T.toFun)}",
" Continuous ⇑(((innerₛₗ 𝕜) a✝ + (innerₛₗ 𝕜) b✝) ∘ₗ T.toFun)",
" 0 ∈ { carrier := {y | Continuous ⇑((innerₛₗ 𝕜) y ∘ₗ T.toFun)}, add_mem' := ⋯ }.carrier",
" Continuous ⇑0",
" a • x ∈ { carrier := {y | Continu... | [
" ⟪↑S y, ↑x✝⟫_𝕜 = ⟪↑y, ↑T x✝⟫_𝕜",
" a✝ + b✝ ∈ {y | Continuous ⇑((innerₛₗ 𝕜) y ∘ₗ T.toFun)}",
" Continuous ⇑(((innerₛₗ 𝕜) a✝ + (innerₛₗ 𝕜) b✝) ∘ₗ T.toFun)",
" 0 ∈ { carrier := {y | Continuous ⇑((innerₛₗ 𝕜) y ∘ₗ T.toFun)}, add_mem' := ⋯ }.carrier",
" Continuous ⇑0",
" a • x ∈ { carrier := {y | Continu... |
import Mathlib.Order.BooleanAlgebra
import Mathlib.Logic.Equiv.Basic
#align_import order.symm_diff from "leanprover-community/mathlib"@"6eb334bd8f3433d5b08ba156b8ec3e6af47e1904"
open Function OrderDual
variable {ι α β : Type*} {π : ι → Type*}
def symmDiff [Sup α] [SDiff α] (a b : α) : α :=
a \ b ⊔ b \ a
#align symm_diff symmDiff
def bihimp [Inf α] [HImp α] (a b : α) : α :=
(b ⇨ a) ⊓ (a ⇨ b)
#align bihimp bihimp
scoped[symmDiff] infixl:100 " ∆ " => symmDiff
scoped[symmDiff] infixl:100 " ⇔ " => bihimp
open scoped symmDiff
theorem symmDiff_def [Sup α] [SDiff α] (a b : α) : a ∆ b = a \ b ⊔ b \ a :=
rfl
#align symm_diff_def symmDiff_def
theorem bihimp_def [Inf α] [HImp α] (a b : α) : a ⇔ b = (b ⇨ a) ⊓ (a ⇨ b) :=
rfl
#align bihimp_def bihimp_def
theorem symmDiff_eq_Xor' (p q : Prop) : p ∆ q = Xor' p q :=
rfl
#align symm_diff_eq_xor symmDiff_eq_Xor'
@[simp]
theorem bihimp_iff_iff {p q : Prop} : p ⇔ q ↔ (p ↔ q) :=
(iff_iff_implies_and_implies _ _).symm.trans Iff.comm
#align bihimp_iff_iff bihimp_iff_iff
@[simp]
theorem Bool.symmDiff_eq_xor : ∀ p q : Bool, p ∆ q = xor p q := by decide
#align bool.symm_diff_eq_bxor Bool.symmDiff_eq_xor
section GeneralizedCoheytingAlgebra
variable [GeneralizedCoheytingAlgebra α] (a b c d : α)
@[simp]
theorem toDual_symmDiff : toDual (a ∆ b) = toDual a ⇔ toDual b :=
rfl
#align to_dual_symm_diff toDual_symmDiff
@[simp]
theorem ofDual_bihimp (a b : αᵒᵈ) : ofDual (a ⇔ b) = ofDual a ∆ ofDual b :=
rfl
#align of_dual_bihimp ofDual_bihimp
theorem symmDiff_comm : a ∆ b = b ∆ a := by simp only [symmDiff, sup_comm]
#align symm_diff_comm symmDiff_comm
instance symmDiff_isCommutative : Std.Commutative (α := α) (· ∆ ·) :=
⟨symmDiff_comm⟩
#align symm_diff_is_comm symmDiff_isCommutative
@[simp]
| Mathlib/Order/SymmDiff.lean | 121 | 121 | theorem symmDiff_self : a ∆ a = ⊥ := by | rw [symmDiff, sup_idem, sdiff_self]
| [
" ∀ (p q : Bool), p ∆ q = xor p q",
" a ∆ b = b ∆ a",
" a ∆ a = ⊥"
] | [
" ∀ (p q : Bool), p ∆ q = xor p q",
" a ∆ b = b ∆ a"
] |
import Mathlib.CategoryTheory.Sites.Coherent.RegularSheaves
namespace CategoryTheory.regularTopology
open Limits
variable {C : Type*} [Category C] [Preregular C] {X : C}
theorem mem_sieves_of_hasEffectiveEpi (S : Sieve X) :
(∃ (Y : C) (π : Y ⟶ X), EffectiveEpi π ∧ S.arrows π) → (S ∈ (regularTopology C).sieves X) := by
rintro ⟨Y, π, h⟩
have h_le : Sieve.generate (Presieve.ofArrows (fun () ↦ Y) (fun _ ↦ π)) ≤ S := by
rw [Sieve.sets_iff_generate (Presieve.ofArrows _ _) S]
apply Presieve.le_of_factorsThru_sieve (Presieve.ofArrows _ _) S _
intro W g f
refine ⟨W, 𝟙 W, ?_⟩
cases f
exact ⟨π, ⟨h.2, Category.id_comp π⟩⟩
apply Coverage.saturate_of_superset (regularCoverage C) h_le
exact Coverage.saturate.of X _ ⟨Y, π, rfl, h.1⟩
instance {Y Y' : C} (π : Y ⟶ X) [EffectiveEpi π]
(π' : Y' ⟶ Y) [EffectiveEpi π'] : EffectiveEpi (π' ≫ π) := by
rw [effectiveEpi_iff_effectiveEpiFamily, ← Sieve.effectiveEpimorphic_family]
suffices h₂ : (Sieve.generate (Presieve.ofArrows _ _)) ∈
GrothendieckTopology.sieves (regularTopology C) X by
change Nonempty _
rw [← Sieve.forallYonedaIsSheaf_iff_colimit]
exact fun W => regularTopology.isSheaf_yoneda_obj W _ h₂
apply Coverage.saturate.transitive X (Sieve.generate (Presieve.ofArrows (fun () ↦ Y)
(fun () ↦ π)))
· apply Coverage.saturate.of
use Y, π
· intro V f ⟨Y₁, h, g, ⟨hY, hf⟩⟩
rw [← hf, Sieve.pullback_comp]
apply (regularTopology C).pullback_stable'
apply regularTopology.mem_sieves_of_hasEffectiveEpi
cases hY
exact ⟨Y', π', inferInstance, Y', (𝟙 _), π' ≫ π, Presieve.ofArrows.mk (), (by simp)⟩
| Mathlib/CategoryTheory/Sites/Coherent/RegularTopology.lean | 64 | 78 | theorem mem_sieves_iff_hasEffectiveEpi (S : Sieve X) :
(S ∈ (regularTopology C).sieves X) ↔
∃ (Y : C) (π : Y ⟶ X), EffectiveEpi π ∧ (S.arrows π) := by |
constructor
· intro h
induction' h with Y T hS Y Y R S _ _ a b
· rcases hS with ⟨Y', π, h'⟩
refine ⟨Y', π, h'.2, ?_⟩
rcases h' with ⟨rfl, _⟩
exact ⟨Y', 𝟙 Y', π, Presieve.ofArrows.mk (), (by simp)⟩
· exact ⟨Y, (𝟙 Y), inferInstance, by simp only [Sieve.top_apply, forall_const]⟩
· rcases a with ⟨Y₁, π, ⟨h₁,h₂⟩⟩
choose Y' π' _ H using b h₂
exact ⟨Y', π' ≫ π, inferInstance, (by simpa using H)⟩
· exact regularTopology.mem_sieves_of_hasEffectiveEpi S
| [
" (∃ Y π, EffectiveEpi π ∧ S.arrows π) → S ∈ (regularTopology C).sieves X",
" S ∈ (regularTopology C).sieves X",
" Sieve.generate (Presieve.ofArrows (fun x => Y) fun x => π) ≤ S",
" (Presieve.ofArrows (fun x => Y) fun x => π) ≤ S.arrows",
" (Presieve.ofArrows (fun x => Y) fun x => π).FactorsThru S.arrows",
... | [
" (∃ Y π, EffectiveEpi π ∧ S.arrows π) → S ∈ (regularTopology C).sieves X",
" S ∈ (regularTopology C).sieves X",
" Sieve.generate (Presieve.ofArrows (fun x => Y) fun x => π) ≤ S",
" (Presieve.ofArrows (fun x => Y) fun x => π) ≤ S.arrows",
" (Presieve.ofArrows (fun x => Y) fun x => π).FactorsThru S.arrows",
... |
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Ideal.Over
import Mathlib.RingTheory.JacobsonIdeal
#align_import ring_theory.jacobson from "leanprover-community/mathlib"@"a7c017d750512a352b623b1824d75da5998457d0"
set_option autoImplicit true
universe u
namespace Ideal
open Polynomial
open Polynomial
namespace Polynomial
open Polynomial
section CommRing
-- Porting note: move to better place
-- Porting note: make `S` and `T` universe polymorphic
lemma Subring.mem_closure_image_of {S T : Type*} [CommRing S] [CommRing T] (g : S →+* T)
(u : Set S) (x : S) (hx : x ∈ Subring.closure u) : g x ∈ Subring.closure (g '' u) := by
rw [Subring.mem_closure] at hx ⊢
intro T₁ h₁
rw [← Subring.mem_comap]
apply hx
simp only [Subring.coe_comap, ← Set.image_subset_iff, SetLike.mem_coe]
exact h₁
-- Porting note: move to better place
lemma mem_closure_X_union_C {R : Type*} [Ring R] (p : R[X]) :
p ∈ Subring.closure (insert X {f | f.degree ≤ 0} : Set R[X]) := by
refine Polynomial.induction_on p ?_ ?_ ?_
· intro r
apply Subring.subset_closure
apply Set.mem_insert_of_mem
exact degree_C_le
· intros p1 p2 h1 h2
exact Subring.add_mem _ h1 h2
· intros n r hr
rw [pow_succ, ← mul_assoc]
apply Subring.mul_mem _ hr
apply Subring.subset_closure
apply Set.mem_insert
variable {R S : Type*} [CommRing R] [CommRing S] [IsDomain S]
variable {Rₘ Sₘ : Type*} [CommRing Rₘ] [CommRing Sₘ]
| Mathlib/RingTheory/Jacobson.lean | 303 | 355 | theorem isIntegral_isLocalization_polynomial_quotient
(P : Ideal R[X]) (pX : R[X]) (hpX : pX ∈ P) [Algebra (R ⧸ P.comap (C : R →+* R[X])) Rₘ]
[IsLocalization.Away (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff Rₘ]
[Algebra (R[X] ⧸ P) Sₘ] [IsLocalization ((Submonoid.powers (pX.map (Quotient.mk (P.comap
(C : R →+* R[X])))).leadingCoeff).map (quotientMap P C le_rfl) : Submonoid (R[X] ⧸ P)) Sₘ] :
(IsLocalization.map Sₘ (quotientMap P C le_rfl) (Submonoid.powers (pX.map (Quotient.mk (P.comap
(C : R →+* R[X])))).leadingCoeff).le_comap_map : Rₘ →+* Sₘ).IsIntegral := by |
let P' : Ideal R := P.comap C
let M : Submonoid (R ⧸ P') :=
Submonoid.powers (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff
let M' : Submonoid (R[X] ⧸ P) :=
(Submonoid.powers (pX.map (Quotient.mk (P.comap (C : R →+* R[X])))).leadingCoeff).map
(quotientMap P C le_rfl)
let φ : R ⧸ P' →+* R[X] ⧸ P := quotientMap P C le_rfl
let φ' : Rₘ →+* Sₘ := IsLocalization.map Sₘ φ M.le_comap_map
have hφ' : φ.comp (Quotient.mk P') = (Quotient.mk P).comp C := rfl
intro p
obtain ⟨⟨p', ⟨q, hq⟩⟩, hp⟩ := IsLocalization.surj M' p
suffices φ'.IsIntegralElem (algebraMap (R[X] ⧸ P) Sₘ p') by
obtain ⟨q', hq', rfl⟩ := hq
obtain ⟨q'', hq''⟩ := isUnit_iff_exists_inv'.1 (IsLocalization.map_units Rₘ (⟨q', hq'⟩ : M))
refine (hp.symm ▸ this).of_mul_unit φ' p (algebraMap (R[X] ⧸ P) Sₘ (φ q')) q'' ?_
rw [← φ'.map_one, ← congr_arg φ' hq'', φ'.map_mul, ← φ'.comp_apply]
simp only [IsLocalization.map_comp _]
rw [RingHom.comp_apply]
dsimp at hp
refine @IsIntegral.of_mem_closure'' Rₘ _ Sₘ _ φ'
((algebraMap (R[X] ⧸ P) Sₘ).comp (Quotient.mk P) '' insert X { p | p.degree ≤ 0 }) ?_
((algebraMap (R[X] ⧸ P) Sₘ) p') ?_
· rintro x ⟨p, hp, rfl⟩
simp only [Set.mem_insert_iff] at hp
cases' hp with hy hy
· rw [hy]
refine φ.isIntegralElem_localization_at_leadingCoeff ((Quotient.mk P) X)
(pX.map (Quotient.mk P')) ?_ M ?_
· rwa [eval₂_map, hφ', ← hom_eval₂, Quotient.eq_zero_iff_mem, eval₂_C_X]
· use 1
simp only [pow_one]
· rw [Set.mem_setOf_eq, degree_le_zero_iff] at hy
-- Porting note: was `refine' hy.symm ▸`
-- `⟨X - C (algebraMap _ _ ((Quotient.mk P') (p.coeff 0))), monic_X_sub_C _, _⟩`
rw [hy]
use X - C (algebraMap (R ⧸ P') Rₘ ((Quotient.mk P') (p.coeff 0)))
constructor
· apply monic_X_sub_C
· simp only [eval₂_sub, eval₂_X, eval₂_C]
rw [sub_eq_zero, ← φ'.comp_apply]
simp only [IsLocalization.map_comp _]
rfl
· obtain ⟨p, rfl⟩ := Quotient.mk_surjective p'
rw [← RingHom.comp_apply]
apply Subring.mem_closure_image_of
apply Polynomial.mem_closure_X_union_C
| [
" g x ∈ Subring.closure (⇑g '' u)",
" ∀ (S_1 : Subring T), ⇑g '' u ⊆ ↑S_1 → g x ∈ S_1",
" g x ∈ T₁",
" x ∈ Subring.comap g T₁",
" u ⊆ ↑(Subring.comap g T₁)",
" ⇑g '' u ⊆ ↑T₁",
" p ∈ Subring.closure (insert X {f | f.degree ≤ 0})",
" ∀ (a : R), C a ∈ Subring.closure (insert X {f | f.degree ≤ 0})",
" C... | [
" g x ∈ Subring.closure (⇑g '' u)",
" ∀ (S_1 : Subring T), ⇑g '' u ⊆ ↑S_1 → g x ∈ S_1",
" g x ∈ T₁",
" x ∈ Subring.comap g T₁",
" u ⊆ ↑(Subring.comap g T₁)",
" ⇑g '' u ⊆ ↑T₁",
" p ∈ Subring.closure (insert X {f | f.degree ≤ 0})",
" ∀ (a : R), C a ∈ Subring.closure (insert X {f | f.degree ≤ 0})",
" C... |
import Mathlib.Geometry.Euclidean.Angle.Oriented.Affine
import Mathlib.Geometry.Euclidean.Angle.Unoriented.RightAngle
#align_import geometry.euclidean.angle.oriented.right_angle from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
noncomputable section
open scoped EuclideanGeometry
open scoped Real
open scoped RealInnerProductSpace
namespace Orientation
open FiniteDimensional
variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
variable [hd2 : Fact (finrank ℝ V = 2)] (o : Orientation ℝ V (Fin 2))
theorem oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arccos (‖x‖ / ‖x + y‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arccos_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h)]
#align orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arccos (‖y‖ / ‖x + y‖) := by
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arccos_of_oangle_eq_pi_div_two h
#align orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arccos_of_oangle_eq_pi_div_two
theorem oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arcsin (‖y‖ / ‖x + y‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arcsin_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h)
(Or.inl (o.left_ne_zero_of_oangle_eq_pi_div_two h))]
#align orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arcsin (‖x‖ / ‖x + y‖) := by
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arcsin_of_oangle_eq_pi_div_two h
#align orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two Orientation.oangle_add_left_eq_arcsin_of_oangle_eq_pi_div_two
theorem oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle x (x + y) = Real.arctan (‖y‖ / ‖x‖) := by
have hs : (o.oangle x (x + y)).sign = 1 := by
rw [oangle_sign_add_right, h, Real.Angle.sign_coe_pi_div_two]
rw [o.oangle_eq_angle_of_sign_eq_one hs,
InnerProductGeometry.angle_add_eq_arctan_of_inner_eq_zero
(o.inner_eq_zero_of_oangle_eq_pi_div_two h) (o.left_ne_zero_of_oangle_eq_pi_div_two h)]
#align orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two Orientation.oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two
| Mathlib/Geometry/Euclidean/Angle/Oriented/RightAngle.lean | 83 | 87 | theorem oangle_add_left_eq_arctan_of_oangle_eq_pi_div_two {x y : V} (h : o.oangle x y = ↑(π / 2)) :
o.oangle (x + y) y = Real.arctan (‖x‖ / ‖y‖) := by |
rw [← neg_inj, oangle_rev, ← oangle_neg_orientation_eq_neg, neg_inj] at h ⊢
rw [add_comm]
exact (-o).oangle_add_right_eq_arctan_of_oangle_eq_pi_div_two h
| [
" o.oangle x (x + y) = ↑(‖x‖ / ‖x + y‖).arccos",
" (o.oangle x (x + y)).sign = 1",
" o.oangle (x + y) y = ↑(‖y‖ / ‖x + y‖).arccos",
" (-o).oangle y (x + y) = ↑(‖y‖ / ‖x + y‖).arccos",
" (-o).oangle y (y + x) = ↑(‖y‖ / ‖y + x‖).arccos",
" o.oangle x (x + y) = ↑(‖y‖ / ‖x + y‖).arcsin",
" o.oangle (x + y) ... | [
" o.oangle x (x + y) = ↑(‖x‖ / ‖x + y‖).arccos",
" (o.oangle x (x + y)).sign = 1",
" o.oangle (x + y) y = ↑(‖y‖ / ‖x + y‖).arccos",
" (-o).oangle y (x + y) = ↑(‖y‖ / ‖x + y‖).arccos",
" (-o).oangle y (y + x) = ↑(‖y‖ / ‖y + x‖).arccos",
" o.oangle x (x + y) = ↑(‖y‖ / ‖x + y‖).arcsin",
" o.oangle (x + y) ... |
import Mathlib.Algebra.ContinuedFractions.Computation.CorrectnessTerminating
import Mathlib.Algebra.Order.Group.Basic
import Mathlib.Algebra.Order.Ring.Basic
import Mathlib.Data.Nat.Fib.Basic
import Mathlib.Tactic.Monotonicity
#align_import algebra.continued_fractions.computation.approximations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
open GeneralizedContinuedFraction (of)
open Int
variable {K : Type*} {v : K} {n : ℕ} [LinearOrderedField K] [FloorRing K]
namespace IntFractPair
| Mathlib/Algebra/ContinuedFractions/Computation/Approximations.lean | 70 | 80 | theorem nth_stream_fr_nonneg_lt_one {ifp_n : IntFractPair K}
(nth_stream_eq : IntFractPair.stream v n = some ifp_n) : 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1 := by |
cases n with
| zero =>
have : IntFractPair.of v = ifp_n := by injection nth_stream_eq
rw [← this, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| succ =>
rcases succ_nth_stream_eq_some_iff.1 nth_stream_eq with ⟨_, _, _, ifp_of_eq_ifp_n⟩
rw [← ifp_of_eq_ifp_n, IntFractPair.of]
exact ⟨fract_nonneg _, fract_lt_one _⟩
| [
" 0 ≤ ifp_n.fr ∧ ifp_n.fr < 1",
" IntFractPair.of v = ifp_n",
" 0 ≤ { b := ⌊v⌋, fr := fract v }.fr ∧ { b := ⌊v⌋, fr := fract v }.fr < 1",
" 0 ≤ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr ∧ { b := ⌊w✝.fr⁻¹⌋, fr := fract w✝.fr⁻¹ }.fr < 1"
] | [] |
import Mathlib.Data.Set.Pointwise.SMul
import Mathlib.GroupTheory.GroupAction.Hom
open Set Pointwise
theorem MulAction.smul_bijective_of_is_unit
{M : Type*} [Monoid M] {α : Type*} [MulAction M α] {m : M} (hm : IsUnit m) :
Function.Bijective (fun (a : α) ↦ m • a) := by
lift m to Mˣ using hm
rw [Function.bijective_iff_has_inverse]
use fun a ↦ m⁻¹ • a
constructor
· intro x; simp [← Units.smul_def]
· intro x; simp [← Units.smul_def]
variable {R S : Type*} (M M₁ M₂ N : Type*)
variable [Monoid R] [Monoid S] (σ : R → S)
variable [MulAction R M] [MulAction S N] [MulAction R M₁] [MulAction R M₂]
variable {F : Type*} (h : F)
section MulActionSemiHomClass
variable [FunLike F M N] [MulActionSemiHomClass F σ M N]
(c : R) (s : Set M) (t : Set N)
-- @[simp] -- In #8386, the `simp_nf` linter complains:
-- "Left-hand side does not simplify, when using the simp lemma on itself."
-- For now we will have to manually add `image_smul_setₛₗ _` to the `simp` argument list.
-- TODO: when lean4#3107 is fixed, mark this as `@[simp]`.
| Mathlib/GroupTheory/GroupAction/Pointwise.lean | 58 | 60 | theorem image_smul_setₛₗ :
h '' (c • s) = σ c • h '' s := by |
simp only [← image_smul, image_image, map_smulₛₗ h]
| [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... | [
" Function.Bijective fun a => m • a",
" Function.Bijective fun a => ↑m • a",
" ∃ g, (Function.LeftInverse g fun a => ↑m • a) ∧ Function.RightInverse g fun a => ↑m • a",
" (Function.LeftInverse (fun a => m⁻¹ • a) fun a => ↑m • a) ∧ Function.RightInverse (fun a => m⁻¹ • a) fun a => ↑m • a",
" Function.LeftInv... |
import Mathlib.Algebra.Module.Submodule.Localization
import Mathlib.LinearAlgebra.Dimension.DivisionRing
import Mathlib.RingTheory.Localization.FractionRing
import Mathlib.RingTheory.OreLocalization.OreSet
open Cardinal nonZeroDivisors
section CommRing
universe u u' v v'
variable {R : Type u} (S : Type u') {M : Type v} {N : Type v'}
variable [CommRing R] [CommRing S] [AddCommGroup M] [AddCommGroup N]
variable [Module R M] [Module R N] [Algebra R S] [Module S N] [IsScalarTower R S N]
variable (p : Submonoid R) [IsLocalization p S] (f : M →ₗ[R] N) [IsLocalizedModule p f]
variable (hp : p ≤ R⁰)
variable {S} in
lemma IsLocalizedModule.linearIndependent_lift {ι} {v : ι → N} (hf : LinearIndependent S v) :
∃ w : ι → M, LinearIndependent R w := by
choose sec hsec using IsLocalizedModule.surj p f
use fun i ↦ (sec (v i)).1
rw [linearIndependent_iff'] at hf ⊢
intro t g hg i hit
apply hp (sec (v i)).2.prop
apply IsLocalization.injective S hp
rw [map_zero]
refine hf t (fun i ↦ algebraMap R S (g i * (sec (v i)).2)) ?_ _ hit
simp only [map_mul, mul_smul, algebraMap_smul, ← Submonoid.smul_def,
hsec, ← map_smul, ← map_sum, hg, map_zero]
lemma IsLocalizedModule.lift_rank_eq :
Cardinal.lift.{v} (Module.rank S N) = Cardinal.lift.{v'} (Module.rank R M) := by
cases' subsingleton_or_nontrivial R
· have := (algebraMap R S).codomain_trivial; simp only [rank_subsingleton, lift_one]
have := (IsLocalization.injective S hp).nontrivial
apply le_antisymm
· rw [Module.rank_def, lift_iSup (bddAbove_range.{v', v'} _)]
apply ciSup_le'
intro ⟨s, hs⟩
exact (IsLocalizedModule.linearIndependent_lift p f hp hs).choose_spec.cardinal_lift_le_rank
· rw [Module.rank_def, lift_iSup (bddAbove_range.{v, v} _)]
apply ciSup_le'
intro ⟨s, hs⟩
choose sec hsec using IsLocalization.surj p (S := S)
refine LinearIndependent.cardinal_lift_le_rank (ι := s) (v := fun i ↦ f i) ?_
rw [linearIndependent_iff'] at hs ⊢
intro t g hg i hit
apply (IsLocalization.map_units S (sec (g i)).2).mul_left_injective
classical
let u := fun (i : s) ↦ (t.erase i).prod (fun j ↦ (sec (g j)).2)
have : f (t.sum fun i ↦ u i • (sec (g i)).1 • i) = f 0 := by
convert congr_arg (t.prod (fun j ↦ (sec (g j)).2) • ·) hg
· simp only [map_sum, map_smul, Submonoid.smul_def, Finset.smul_sum]
apply Finset.sum_congr rfl
intro j hj
simp only [u, ← @IsScalarTower.algebraMap_smul R S N, Submonoid.coe_finset_prod, map_prod]
rw [← hsec, mul_comm (g j), mul_smul, ← mul_smul, Finset.prod_erase_mul (h := hj)]
rw [map_zero, smul_zero]
obtain ⟨c, hc⟩ := IsLocalizedModule.exists_of_eq (S := p) this
simp_rw [smul_zero, Finset.smul_sum, ← mul_smul, Submonoid.smul_def, ← mul_smul, mul_comm] at hc
simp only [hsec, zero_mul, map_eq_zero_iff (algebraMap R S) (IsLocalization.injective S hp)]
apply hp (c * u i).prop
exact hs t _ hc _ hit
lemma IsLocalizedModule.rank_eq {N : Type v} [AddCommGroup N]
[Module R N] [Module S N] [IsScalarTower R S N] (f : M →ₗ[R] N) [IsLocalizedModule p f] :
Module.rank S N = Module.rank R M := by simpa using IsLocalizedModule.lift_rank_eq S p f hp
variable (R M) in
| Mathlib/LinearAlgebra/Dimension/Localization.lean | 85 | 93 | theorem exists_set_linearIndependent_of_isDomain [IsDomain R] :
∃ s : Set M, #s = Module.rank R M ∧ LinearIndependent (ι := s) R Subtype.val := by |
obtain ⟨w, hw⟩ :=
IsLocalizedModule.linearIndependent_lift R⁰ (LocalizedModule.mkLinearMap R⁰ M) le_rfl
(Module.Free.chooseBasis (FractionRing R) (LocalizedModule R⁰ M)).linearIndependent
refine ⟨Set.range w, ?_, (linearIndependent_subtype_range hw.injective).mpr hw⟩
apply Cardinal.lift_injective.{max u v}
rw [Cardinal.mk_range_eq_of_injective hw.injective, ← Module.Free.rank_eq_card_chooseBasisIndex,
IsLocalizedModule.lift_rank_eq (FractionRing R) R⁰ (LocalizedModule.mkLinearMap R⁰ M) le_rfl]
| [
" ∃ w, LinearIndependent R w",
" LinearIndependent R fun i => (sec (v i)).1",
" ∀ (s : Finset ι) (g : ι → R), ∑ i ∈ s, g i • (sec (v i)).1 = 0 → ∀ i ∈ s, g i = 0",
" g i = 0",
" g i * ↑(sec (v i)).2 = 0",
" (algebraMap R S) (g i * ↑(sec (v i)).2) = (algebraMap R S) 0",
" (algebraMap R S) (g i * ↑(sec (v... | [
" ∃ w, LinearIndependent R w",
" LinearIndependent R fun i => (sec (v i)).1",
" ∀ (s : Finset ι) (g : ι → R), ∑ i ∈ s, g i • (sec (v i)).1 = 0 → ∀ i ∈ s, g i = 0",
" g i = 0",
" g i * ↑(sec (v i)).2 = 0",
" (algebraMap R S) (g i * ↑(sec (v i)).2) = (algebraMap R S) 0",
" (algebraMap R S) (g i * ↑(sec (v... |
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Order.Filter.IndicatorFunction
open MeasureTheory
section DominatedConvergenceTheorem
open Set Filter TopologicalSpace ENNReal
open scoped Topology
namespace MeasureTheory
variable {α E G: Type*}
[NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
[NormedAddCommGroup G] [NormedSpace ℝ G]
{f g : α → E} {m : MeasurableSpace α} {μ : Measure α}
theorem tendsto_integral_of_dominated_convergence {F : ℕ → α → G} {f : α → G} (bound : α → ℝ)
(F_measurable : ∀ n, AEStronglyMeasurable (F n) μ) (bound_integrable : Integrable bound μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) atTop (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) atTop (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound F_measurable bound_integrable h_bound h_lim
· simp [integral, hG]
#align measure_theory.tendsto_integral_of_dominated_convergence MeasureTheory.tendsto_integral_of_dominated_convergence
theorem tendsto_integral_filter_of_dominated_convergence {ι} {l : Filter ι} [l.IsCountablyGenerated]
{F : ι → α → G} {f : α → G} (bound : α → ℝ) (hF_meas : ∀ᶠ n in l, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ᶠ n in l, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound a) (bound_integrable : Integrable bound μ)
(h_lim : ∀ᵐ a ∂μ, Tendsto (fun n => F n a) l (𝓝 (f a))) :
Tendsto (fun n => ∫ a, F n a ∂μ) l (𝓝 <| ∫ a, f a ∂μ) := by
by_cases hG : CompleteSpace G
· simp only [integral, hG, L1.integral]
exact tendsto_setToFun_filter_of_dominated_convergence (dominatedFinMeasAdditive_weightedSMul μ)
bound hF_meas h_bound bound_integrable h_lim
· simp [integral, hG, tendsto_const_nhds]
#align measure_theory.tendsto_integral_filter_of_dominated_convergence MeasureTheory.tendsto_integral_filter_of_dominated_convergence
theorem hasSum_integral_of_dominated_convergence {ι} [Countable ι] {F : ι → α → G} {f : α → G}
(bound : ι → α → ℝ) (hF_meas : ∀ n, AEStronglyMeasurable (F n) μ)
(h_bound : ∀ n, ∀ᵐ a ∂μ, ‖F n a‖ ≤ bound n a)
(bound_summable : ∀ᵐ a ∂μ, Summable fun n => bound n a)
(bound_integrable : Integrable (fun a => ∑' n, bound n a) μ)
(h_lim : ∀ᵐ a ∂μ, HasSum (fun n => F n a) (f a)) :
HasSum (fun n => ∫ a, F n a ∂μ) (∫ a, f a ∂μ) := by
have hb_nonneg : ∀ᵐ a ∂μ, ∀ n, 0 ≤ bound n a :=
eventually_countable_forall.2 fun n => (h_bound n).mono fun a => (norm_nonneg _).trans
have hb_le_tsum : ∀ n, bound n ≤ᵐ[μ] fun a => ∑' n, bound n a := by
intro n
filter_upwards [hb_nonneg, bound_summable]
with _ ha0 ha_sum using le_tsum ha_sum _ fun i _ => ha0 i
have hF_integrable : ∀ n, Integrable (F n) μ := by
refine fun n => bound_integrable.mono' (hF_meas n) ?_
exact EventuallyLE.trans (h_bound n) (hb_le_tsum n)
simp only [HasSum, ← integral_finset_sum _ fun n _ => hF_integrable n]
refine tendsto_integral_filter_of_dominated_convergence
(fun a => ∑' n, bound n a) ?_ ?_ bound_integrable h_lim
· exact eventually_of_forall fun s => s.aestronglyMeasurable_sum fun n _ => hF_meas n
· filter_upwards with s
filter_upwards [eventually_countable_forall.2 h_bound, hb_nonneg, bound_summable]
with a hFa ha0 has
calc
‖∑ n ∈ s, F n a‖ ≤ ∑ n ∈ s, bound n a := norm_sum_le_of_le _ fun n _ => hFa n
_ ≤ ∑' n, bound n a := sum_le_tsum _ (fun n _ => ha0 n) has
#align measure_theory.has_sum_integral_of_dominated_convergence MeasureTheory.hasSum_integral_of_dominated_convergence
| Mathlib/MeasureTheory/Integral/DominatedConvergence.lean | 107 | 137 | theorem integral_tsum {ι} [Countable ι] {f : ι → α → G} (hf : ∀ i, AEStronglyMeasurable (f i) μ)
(hf' : ∑' i, ∫⁻ a : α, ‖f i a‖₊ ∂μ ≠ ∞) :
∫ a : α, ∑' i, f i a ∂μ = ∑' i, ∫ a : α, f i a ∂μ := by |
by_cases hG : CompleteSpace G; swap
· simp [integral, hG]
have hf'' : ∀ i, AEMeasurable (fun x => (‖f i x‖₊ : ℝ≥0∞)) μ := fun i => (hf i).ennnorm
have hhh : ∀ᵐ a : α ∂μ, Summable fun n => (‖f n a‖₊ : ℝ) := by
rw [← lintegral_tsum hf''] at hf'
refine (ae_lt_top' (AEMeasurable.ennreal_tsum hf'') hf').mono ?_
intro x hx
rw [← ENNReal.tsum_coe_ne_top_iff_summable_coe]
exact hx.ne
convert (MeasureTheory.hasSum_integral_of_dominated_convergence (fun i a => ‖f i a‖₊) hf _ hhh
⟨_, _⟩ _).tsum_eq.symm
· intro n
filter_upwards with x
rfl
· simp_rw [← NNReal.coe_tsum]
rw [aestronglyMeasurable_iff_aemeasurable]
apply AEMeasurable.coe_nnreal_real
apply AEMeasurable.nnreal_tsum
exact fun i => (hf i).nnnorm.aemeasurable
· dsimp [HasFiniteIntegral]
have : ∫⁻ a, ∑' n, ‖f n a‖₊ ∂μ < ⊤ := by rwa [lintegral_tsum hf'', lt_top_iff_ne_top]
convert this using 1
apply lintegral_congr_ae
simp_rw [← coe_nnnorm, ← NNReal.coe_tsum, NNReal.nnnorm_eq]
filter_upwards [hhh] with a ha
exact ENNReal.coe_tsum (NNReal.summable_coe.mp ha)
· filter_upwards [hhh] with x hx
exact hx.of_norm.hasSum
| [
" Tendsto (fun n => ∫ (a : α), F n a ∂μ) atTop (𝓝 (∫ (a : α), f a ∂μ))",
" Tendsto\n (fun n =>\n if h : True then\n if hf : Integrable (fun a => F n a) μ then L1.integralCLM (Integrable.toL1 (fun a => F n a) hf) else 0\n else 0)\n atTop\n (𝓝\n (if h : True then\n if hf : In... | [
" Tendsto (fun n => ∫ (a : α), F n a ∂μ) atTop (𝓝 (∫ (a : α), f a ∂μ))",
" Tendsto\n (fun n =>\n if h : True then\n if hf : Integrable (fun a => F n a) μ then L1.integralCLM (Integrable.toL1 (fun a => F n a) hf) else 0\n else 0)\n atTop\n (𝓝\n (if h : True then\n if hf : In... |
import Mathlib.Analysis.NormedSpace.PiTensorProduct.ProjectiveSeminorm
import Mathlib.LinearAlgebra.Isomorphisms
universe uι u𝕜 uE uF
variable {ι : Type uι} [Fintype ι]
variable {𝕜 : Type u𝕜} [NontriviallyNormedField 𝕜]
variable {E : ι → Type uE} [∀ i, SeminormedAddCommGroup (E i)] [∀ i, NormedSpace 𝕜 (E i)]
variable {F : Type uF} [SeminormedAddCommGroup F] [NormedSpace 𝕜 F]
open scoped TensorProduct
namespace PiTensorProduct
section seminorm
variable (F) in
@[simps!]
noncomputable def toDualContinuousMultilinearMap : (⨂[𝕜] i, E i) →ₗ[𝕜]
ContinuousMultilinearMap 𝕜 E F →L[𝕜] F where
toFun x := LinearMap.mkContinuous
((LinearMap.flip (lift (R := 𝕜) (s := E) (E := F)).toLinearMap x) ∘ₗ
ContinuousMultilinearMap.toMultilinearMapLinear)
(projectiveSeminorm x)
(fun _ ↦ by simp only [LinearMap.coe_comp, Function.comp_apply,
ContinuousMultilinearMap.toMultilinearMapLinear_apply, LinearMap.flip_apply,
LinearEquiv.coe_coe]
exact norm_eval_le_projectiveSeminorm _ _ _)
map_add' x y := by
ext _
simp only [map_add, LinearMap.mkContinuous_apply, LinearMap.coe_comp, Function.comp_apply,
ContinuousMultilinearMap.toMultilinearMapLinear_apply, LinearMap.add_apply,
LinearMap.flip_apply, LinearEquiv.coe_coe, ContinuousLinearMap.add_apply]
map_smul' a x := by
ext _
simp only [map_smul, LinearMap.mkContinuous_apply, LinearMap.coe_comp, Function.comp_apply,
ContinuousMultilinearMap.toMultilinearMapLinear_apply, LinearMap.smul_apply,
LinearMap.flip_apply, LinearEquiv.coe_coe, RingHom.id_apply, ContinuousLinearMap.coe_smul',
Pi.smul_apply]
theorem toDualContinuousMultilinearMap_le_projectiveSeminorm (x : ⨂[𝕜] i, E i) :
‖toDualContinuousMultilinearMap F x‖ ≤ projectiveSeminorm x := by
simp only [toDualContinuousMultilinearMap, LinearMap.coe_mk, AddHom.coe_mk]
apply LinearMap.mkContinuous_norm_le _ (apply_nonneg _ _)
noncomputable irreducible_def injectiveSeminorm : Seminorm 𝕜 (⨂[𝕜] i, E i) :=
sSup {p | ∃ (G : Type (max uι u𝕜 uE)) (_ : SeminormedAddCommGroup G)
(_ : NormedSpace 𝕜 G), p = Seminorm.comp (normSeminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G →L[𝕜] G))
(toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E))}
lemma dualSeminorms_bounded : BddAbove {p | ∃ (G : Type (max uι u𝕜 uE))
(_ : SeminormedAddCommGroup G) (_ : NormedSpace 𝕜 G),
p = Seminorm.comp (normSeminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G →L[𝕜] G))
(toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E))} := by
existsi projectiveSeminorm
rw [mem_upperBounds]
simp only [Set.mem_setOf_eq, forall_exists_index]
intro p G _ _ hp
rw [hp]
intro x
simp only [Seminorm.comp_apply, coe_normSeminorm]
exact toDualContinuousMultilinearMap_le_projectiveSeminorm _
theorem injectiveSeminorm_apply (x : ⨂[𝕜] i, E i) :
injectiveSeminorm x = ⨆ p : {p | ∃ (G : Type (max uι u𝕜 uE))
(_ : SeminormedAddCommGroup G) (_ : NormedSpace 𝕜 G), p = Seminorm.comp (normSeminorm 𝕜
(ContinuousMultilinearMap 𝕜 E G →L[𝕜] G))
(toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E))}, p.1 x := by
simp [injectiveSeminorm]
exact Seminorm.sSup_apply dualSeminorms_bounded
| Mathlib/Analysis/NormedSpace/PiTensorProduct/InjectiveSeminorm.lean | 152 | 202 | theorem norm_eval_le_injectiveSeminorm (f : ContinuousMultilinearMap 𝕜 E F) (x : ⨂[𝕜] i, E i) :
‖lift f.toMultilinearMap x‖ ≤ ‖f‖ * injectiveSeminorm x := by |
/- If `F` were in `Type (max uι u𝕜 uE)` (which is the type of `⨂[𝕜] i, E i`), then the
property that we want to prove would hold by definition of `injectiveSeminorm`. This is
not necessarily true, but we will show that there exists a normed vector space `G` in
`Type (max uι u𝕜 uE)` and an injective isometry from `G` to `F` such that `f` factors
through a continuous multilinear map `f'` from `E = Π i, E i` to `G`, to which we can apply
the definition of `injectiveSeminorm`. The desired inequality for `f` then follows
immediately.
The idea is very simple: the multilinear map `f` corresponds by `PiTensorProduct.lift`
to a linear map from `⨂[𝕜] i, E i` to `F`, say `l`. We want to take `G` to be the image of
`l`, with the norm induced from that of `F`; to make sure that we are in the correct universe,
it is actually more convenient to take `G` equal to the coimage of `l` (i.e. the quotient
of `⨂[𝕜] i, E i` by the kernel of `l`), which is canonically isomorphic to its image by
`LinearMap.quotKerEquivRange`. -/
set G := (⨂[𝕜] i, E i) ⧸ LinearMap.ker (lift f.toMultilinearMap)
set G' := LinearMap.range (lift f.toMultilinearMap)
set e := LinearMap.quotKerEquivRange (lift f.toMultilinearMap)
letI := SeminormedAddCommGroup.induced G G' e
letI := NormedSpace.induced 𝕜 G G' e
set f'₀ := lift.symm (e.symm.toLinearMap ∘ₗ LinearMap.rangeRestrict (lift f.toMultilinearMap))
have hf'₀ : ∀ (x : Π (i : ι), E i), ‖f'₀ x‖ ≤ ‖f‖ * ∏ i, ‖x i‖ := fun x ↦ by
change ‖e (f'₀ x)‖ ≤ _
simp only [lift_symm, LinearMap.compMultilinearMap_apply, LinearMap.coe_comp,
LinearEquiv.coe_coe, Function.comp_apply, LinearEquiv.apply_symm_apply, Submodule.coe_norm,
LinearMap.codRestrict_apply, lift.tprod, ContinuousMultilinearMap.coe_coe, e, f'₀]
exact f.le_opNorm x
set f' := MultilinearMap.mkContinuous f'₀ ‖f‖ hf'₀
have hnorm : ‖f'‖ ≤ ‖f‖ := (f'.opNorm_le_iff (norm_nonneg f)).mpr hf'₀
have heq : e (lift f'.toMultilinearMap x) = lift f.toMultilinearMap x := by
induction' x using PiTensorProduct.induction_on with a m _ _ hx hy
· simp only [lift_symm, map_smul, lift.tprod, ContinuousMultilinearMap.coe_coe,
MultilinearMap.coe_mkContinuous, LinearMap.compMultilinearMap_apply, LinearMap.coe_comp,
LinearEquiv.coe_coe, Function.comp_apply, LinearEquiv.apply_symm_apply, SetLike.val_smul,
LinearMap.codRestrict_apply, f', f'₀]
· simp only [map_add, AddSubmonoid.coe_add, Submodule.coe_toAddSubmonoid, hx, hy]
suffices h : ‖lift f'.toMultilinearMap x‖ ≤ ‖f'‖ * injectiveSeminorm x by
change ‖(e (lift f'.toMultilinearMap x)).1‖ ≤ _ at h
rw [heq] at h
exact le_trans h (mul_le_mul_of_nonneg_right hnorm (apply_nonneg _ _))
have hle : Seminorm.comp (normSeminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G →L[𝕜] G))
(toDualContinuousMultilinearMap G (𝕜 := 𝕜) (E := E)) ≤ injectiveSeminorm := by
simp only [injectiveSeminorm]
refine le_csSup dualSeminorms_bounded ?_
rw [Set.mem_setOf]
existsi G, inferInstance, inferInstance
rfl
refine le_trans ?_ (mul_le_mul_of_nonneg_left (hle x) (norm_nonneg f'))
simp only [Seminorm.comp_apply, coe_normSeminorm, ← toDualContinuousMultilinearMap_apply_apply]
rw [mul_comm]
exact ContinuousLinearMap.le_opNorm _ _
| [
" ‖((↑lift).flip x ∘ₗ ContinuousMultilinearMap.toMultilinearMapLinear) x✝‖ ≤ projectiveSeminorm x * ‖x✝‖",
" ‖(lift x✝.toMultilinearMap) x‖ ≤ projectiveSeminorm x * ‖x✝‖",
" (fun x => ((↑lift).flip x ∘ₗ ContinuousMultilinearMap.toMultilinearMapLinear).mkContinuous (projectiveSeminorm x) ⋯)\n (x + y) =\n ... | [
" ‖((↑lift).flip x ∘ₗ ContinuousMultilinearMap.toMultilinearMapLinear) x✝‖ ≤ projectiveSeminorm x * ‖x✝‖",
" ‖(lift x✝.toMultilinearMap) x‖ ≤ projectiveSeminorm x * ‖x✝‖",
" (fun x => ((↑lift).flip x ∘ₗ ContinuousMultilinearMap.toMultilinearMapLinear).mkContinuous (projectiveSeminorm x) ⋯)\n (x + y) =\n ... |
import Mathlib.AlgebraicGeometry.Morphisms.Basic
import Mathlib.RingTheory.LocalProperties
#align_import algebraic_geometry.morphisms.ring_hom_properties from "leanprover-community/mathlib"@"d39590fc8728fbf6743249802486f8c91ffe07bc"
-- Explicit universe annotations were used in this file to improve perfomance #12737
universe u
open CategoryTheory Opposite TopologicalSpace CategoryTheory.Limits AlgebraicGeometry
variable (P : ∀ {R S : Type u} [CommRing R] [CommRing S], (R →+* S) → Prop)
namespace RingHom
variable {P}
| Mathlib/AlgebraicGeometry/Morphisms/RingHomProperties.lean | 48 | 70 | theorem RespectsIso.basicOpen_iff (hP : RespectsIso @P) {X Y : Scheme.{u}} [IsAffine X] [IsAffine Y]
(f : X ⟶ Y) (r : Y.presheaf.obj (Opposite.op ⊤)) :
P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔
P (@IsLocalization.Away.map (Y.presheaf.obj (Opposite.op ⊤)) _
(Y.presheaf.obj (Opposite.op <| Y.basicOpen r)) _ _ (X.presheaf.obj (Opposite.op ⊤)) _
(X.presheaf.obj (Opposite.op <| X.basicOpen (Scheme.Γ.map f.op r))) _ _
(Scheme.Γ.map f.op) r _ <| @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)) := by |
rw [Γ_map_morphismRestrict, hP.cancel_left_isIso, hP.cancel_right_isIso,
← hP.cancel_right_isIso (f.val.c.app (Opposite.op (Y.basicOpen r)))
(X.presheaf.map (eqToHom (Scheme.preimage_basicOpen f r).symm).op), ← eq_iff_iff]
congr
delta IsLocalization.Away.map
refine IsLocalization.ringHom_ext (Submonoid.powers r) ?_
generalize_proofs
haveI i1 := @isLocalization_away_of_isAffine X _ (Scheme.Γ.map f.op r)
-- Porting note: needs to be very explicit here
convert
(@IsLocalization.map_comp (hy := ‹_ ≤ _›) (Y.presheaf.obj <| Opposite.op (Scheme.basicOpen Y r))
_ _ (isLocalization_away_of_isAffine _) _ _ _ i1).symm using 1
change Y.presheaf.map _ ≫ _ = _ ≫ X.presheaf.map _
rw [f.val.c.naturality_assoc]
simp only [TopCat.Presheaf.pushforwardObj_map, ← X.presheaf.map_comp]
congr 1
| [
" P (Scheme.Γ.map (f ∣_ Y.basicOpen r).op) ↔\n P\n (IsLocalization.Away.map (↑(Y.presheaf.obj { unop := Y.basicOpen r }))\n (↑(X.presheaf.obj { unop := X.basicOpen ((Scheme.Γ.map f.op) r) })) (Scheme.Γ.map f.op) r)",
" P (f.val.c.app { unop := Y.basicOpen r } ≫ X.presheaf.map (eqToHom ⋯).op) =\n ... | [] |
import Mathlib.Geometry.Manifold.MFDeriv.SpecificFunctions
noncomputable section
open scoped Manifold
open Bundle Set Topology
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
{E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E] {H : Type*} [TopologicalSpace H]
(I : ModelWithCorners 𝕜 E H) {M : Type*} [TopologicalSpace M] [ChartedSpace H M]
{E' : Type*} [NormedAddCommGroup E'] [NormedSpace 𝕜 E'] {H' : Type*} [TopologicalSpace H']
(I' : ModelWithCorners 𝕜 E' H') {M' : Type*} [TopologicalSpace M'] [ChartedSpace H' M']
{E'' : Type*} [NormedAddCommGroup E''] [NormedSpace 𝕜 E''] {H'' : Type*} [TopologicalSpace H'']
(I'' : ModelWithCorners 𝕜 E'' H'') {M'' : Type*} [TopologicalSpace M''] [ChartedSpace H'' M'']
section Charts
variable [SmoothManifoldWithCorners I M] [SmoothManifoldWithCorners I' M']
[SmoothManifoldWithCorners I'' M''] {e : PartialHomeomorph M H}
theorem mdifferentiableAt_atlas (h : e ∈ atlas H M) {x : M} (hx : x ∈ e.source) :
MDifferentiableAt I I e x := by
rw [mdifferentiableAt_iff]
refine ⟨(e.continuousOn x hx).continuousAt (e.open_source.mem_nhds hx), ?_⟩
have mem :
I ((chartAt H x : M → H) x) ∈ I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).source ∩ range I := by
simp only [hx, mfld_simps]
have : (chartAt H x).symm.trans e ∈ contDiffGroupoid ∞ I :=
HasGroupoid.compatible (chart_mem_atlas H x) h
have A :
ContDiffOn 𝕜 ∞ (I ∘ (chartAt H x).symm.trans e ∘ I.symm)
(I.symm ⁻¹' ((chartAt H x).symm.trans e).source ∩ range I) :=
this.1
have B := A.differentiableOn le_top (I ((chartAt H x : M → H) x)) mem
simp only [mfld_simps] at B
rw [inter_comm, differentiableWithinAt_inter] at B
· simpa only [mfld_simps]
· apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
#align mdifferentiable_at_atlas mdifferentiableAt_atlas
theorem mdifferentiableOn_atlas (h : e ∈ atlas H M) : MDifferentiableOn I I e e.source :=
fun _x hx => (mdifferentiableAt_atlas I h hx).mdifferentiableWithinAt
#align mdifferentiable_on_atlas mdifferentiableOn_atlas
| Mathlib/Geometry/Manifold/MFDeriv/Atlas.lean | 113 | 129 | theorem mdifferentiableAt_atlas_symm (h : e ∈ atlas H M) {x : H} (hx : x ∈ e.target) :
MDifferentiableAt I I e.symm x := by |
rw [mdifferentiableAt_iff]
refine ⟨(e.continuousOn_symm x hx).continuousAt (e.open_target.mem_nhds hx), ?_⟩
have mem : I x ∈ I.symm ⁻¹' (e.symm ≫ₕ chartAt H (e.symm x)).source ∩ range I := by
simp only [hx, mfld_simps]
have : e.symm.trans (chartAt H (e.symm x)) ∈ contDiffGroupoid ∞ I :=
HasGroupoid.compatible h (chart_mem_atlas H _)
have A :
ContDiffOn 𝕜 ∞ (I ∘ e.symm.trans (chartAt H (e.symm x)) ∘ I.symm)
(I.symm ⁻¹' (e.symm.trans (chartAt H (e.symm x))).source ∩ range I) :=
this.1
have B := A.differentiableOn le_top (I x) mem
simp only [mfld_simps] at B
rw [inter_comm, differentiableWithinAt_inter] at B
· simpa only [mfld_simps]
· apply IsOpen.mem_nhds ((PartialHomeomorph.open_source _).preimage I.continuous_symm) mem.1
| [
" MDifferentiableAt I I (↑e) x",
" ContinuousAt (↑e) x ∧ DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I x ↑e) (range ↑I) (↑(extChartAt I x) x)",
" DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I x ↑e) (range ↑I) (↑(extChartAt I x) x)",
" ↑I (↑(chartAt H x) x) ∈ ↑I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).sou... | [
" MDifferentiableAt I I (↑e) x",
" ContinuousAt (↑e) x ∧ DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I x ↑e) (range ↑I) (↑(extChartAt I x) x)",
" DifferentiableWithinAt 𝕜 (writtenInExtChartAt I I x ↑e) (range ↑I) (↑(extChartAt I x) x)",
" ↑I (↑(chartAt H x) x) ∈ ↑I.symm ⁻¹' ((chartAt H x).symm ≫ₕ e).sou... |
import Mathlib.Algebra.Homology.Homotopy
import Mathlib.AlgebraicTopology.DoldKan.Notations
#align_import algebraic_topology.dold_kan.homotopies from "leanprover-community/mathlib"@"b12099d3b7febf4209824444dd836ef5ad96db55"
open CategoryTheory CategoryTheory.Category CategoryTheory.Limits CategoryTheory.Preadditive
CategoryTheory.SimplicialObject Homotopy Opposite Simplicial DoldKan
noncomputable section
namespace AlgebraicTopology
namespace DoldKan
variable {C : Type*} [Category C] [Preadditive C]
variable {X : SimplicialObject C}
abbrev c :=
ComplexShape.down ℕ
#align algebraic_topology.dold_kan.c AlgebraicTopology.DoldKan.c
theorem c_mk (i j : ℕ) (h : j + 1 = i) : c.Rel i j :=
ComplexShape.down_mk i j h
#align algebraic_topology.dold_kan.c_mk AlgebraicTopology.DoldKan.c_mk
theorem cs_down_0_not_rel_left (j : ℕ) : ¬c.Rel 0 j := by
intro hj
dsimp at hj
apply Nat.not_succ_le_zero j
rw [Nat.succ_eq_add_one, hj]
#align algebraic_topology.dold_kan.cs_down_0_not_rel_left AlgebraicTopology.DoldKan.cs_down_0_not_rel_left
def hσ (q : ℕ) (n : ℕ) : X _[n] ⟶ X _[n + 1] :=
if n < q then 0 else (-1 : ℤ) ^ (n - q) • X.σ ⟨n - q, Nat.lt_succ_of_le (Nat.sub_le _ _)⟩
#align algebraic_topology.dold_kan.hσ AlgebraicTopology.DoldKan.hσ
def hσ' (q : ℕ) : ∀ n m, c.Rel m n → (K[X].X n ⟶ K[X].X m) := fun n m hnm =>
hσ q n ≫ eqToHom (by congr)
#align algebraic_topology.dold_kan.hσ' AlgebraicTopology.DoldKan.hσ'
theorem hσ'_eq_zero {q n m : ℕ} (hnq : n < q) (hnm : c.Rel m n) :
(hσ' q n m hnm : X _[n] ⟶ X _[m]) = 0 := by
simp only [hσ', hσ]
split_ifs
exact zero_comp
#align algebraic_topology.dold_kan.hσ'_eq_zero AlgebraicTopology.DoldKan.hσ'_eq_zero
theorem hσ'_eq {q n a m : ℕ} (ha : n = a + q) (hnm : c.Rel m n) :
(hσ' q n m hnm : X _[n] ⟶ X _[m]) =
((-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩) ≫
eqToHom (by congr) := by
simp only [hσ', hσ]
split_ifs
· omega
· have h' := tsub_eq_of_eq_add ha
congr
#align algebraic_topology.dold_kan.hσ'_eq AlgebraicTopology.DoldKan.hσ'_eq
theorem hσ'_eq' {q n a : ℕ} (ha : n = a + q) :
(hσ' q n (n + 1) rfl : X _[n] ⟶ X _[n + 1]) =
(-1 : ℤ) ^ a • X.σ ⟨a, Nat.lt_succ_iff.mpr (Nat.le.intro (Eq.symm ha))⟩ := by
rw [hσ'_eq ha rfl, eqToHom_refl, comp_id]
#align algebraic_topology.dold_kan.hσ'_eq' AlgebraicTopology.DoldKan.hσ'_eq'
def Hσ (q : ℕ) : K[X] ⟶ K[X] :=
nullHomotopicMap' (hσ' q)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.Hσ AlgebraicTopology.DoldKan.hσ
def homotopyHσToZero (q : ℕ) : Homotopy (Hσ q : K[X] ⟶ K[X]) 0 :=
nullHomotopy' (hσ' q)
set_option linter.uppercaseLean3 false in
#align algebraic_topology.dold_kan.homotopy_Hσ_to_zero AlgebraicTopology.DoldKan.homotopyHσToZero
| Mathlib/AlgebraicTopology/DoldKan/Homotopies.lean | 141 | 151 | theorem Hσ_eq_zero (q : ℕ) : (Hσ q : K[X] ⟶ K[X]).f 0 = 0 := by |
unfold Hσ
rw [nullHomotopicMap'_f_of_not_rel_left (c_mk 1 0 rfl) cs_down_0_not_rel_left]
rcases q with (_|q)
· rw [hσ'_eq (show 0 = 0 + 0 by rfl) (c_mk 1 0 rfl)]
simp only [pow_zero, Fin.mk_zero, one_zsmul, eqToHom_refl, Category.comp_id]
erw [ChainComplex.of_d]
rw [AlternatingFaceMapComplex.objD, Fin.sum_univ_two, Fin.val_zero, Fin.val_one, pow_zero,
pow_one, one_smul, neg_smul, one_smul, comp_add, comp_neg, add_neg_eq_zero]
erw [δ_comp_σ_self, δ_comp_σ_succ]
· rw [hσ'_eq_zero (Nat.succ_pos q) (c_mk 1 0 rfl), zero_comp]
| [
" ¬c.Rel 0 j",
" False",
" j.succ ≤ 0",
" X _[n + 1] = K[X].X m",
" hσ' q n m hnm = 0",
" (if n < q then 0 else (-1) ^ (n - q) • X.σ ⟨n - q, ⋯⟩) ≫ eqToHom ⋯ = 0",
" 0 ≫ eqToHom ⋯ = 0",
" hσ' q n m hnm = ((-1) ^ a • X.σ ⟨a, ⋯⟩) ≫ eqToHom ⋯",
" (if n < q then 0 else (-1) ^ (n - q) • X.σ ⟨n - q, ⋯⟩) ≫ ... | [
" ¬c.Rel 0 j",
" False",
" j.succ ≤ 0",
" X _[n + 1] = K[X].X m",
" hσ' q n m hnm = 0",
" (if n < q then 0 else (-1) ^ (n - q) • X.σ ⟨n - q, ⋯⟩) ≫ eqToHom ⋯ = 0",
" 0 ≫ eqToHom ⋯ = 0",
" hσ' q n m hnm = ((-1) ^ a • X.σ ⟨a, ⋯⟩) ≫ eqToHom ⋯",
" (if n < q then 0 else (-1) ^ (n - q) • X.σ ⟨n - q, ⋯⟩) ≫ ... |
import Mathlib.Algebra.Lie.Abelian
import Mathlib.Algebra.Lie.IdealOperations
import Mathlib.Order.Hom.Basic
#align_import algebra.lie.solvable from "leanprover-community/mathlib"@"a50170a88a47570ed186b809ca754110590f9476"
universe u v w w₁ w₂
variable (R : Type u) (L : Type v) (M : Type w) {L' : Type w₁}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L']
variable (I J : LieIdeal R L) {f : L' →ₗ⁅R⁆ L}
namespace LieAlgebra
def derivedSeriesOfIdeal (k : ℕ) : LieIdeal R L → LieIdeal R L :=
(fun I => ⁅I, I⁆)^[k]
#align lie_algebra.derived_series_of_ideal LieAlgebra.derivedSeriesOfIdeal
@[simp]
theorem derivedSeriesOfIdeal_zero : derivedSeriesOfIdeal R L 0 I = I :=
rfl
#align lie_algebra.derived_series_of_ideal_zero LieAlgebra.derivedSeriesOfIdeal_zero
@[simp]
theorem derivedSeriesOfIdeal_succ (k : ℕ) :
derivedSeriesOfIdeal R L (k + 1) I =
⁅derivedSeriesOfIdeal R L k I, derivedSeriesOfIdeal R L k I⁆ :=
Function.iterate_succ_apply' (fun I => ⁅I, I⁆) k I
#align lie_algebra.derived_series_of_ideal_succ LieAlgebra.derivedSeriesOfIdeal_succ
abbrev derivedSeries (k : ℕ) : LieIdeal R L :=
derivedSeriesOfIdeal R L k ⊤
#align lie_algebra.derived_series LieAlgebra.derivedSeries
theorem derivedSeries_def (k : ℕ) : derivedSeries R L k = derivedSeriesOfIdeal R L k ⊤ :=
rfl
#align lie_algebra.derived_series_def LieAlgebra.derivedSeries_def
variable {R L}
local notation "D" => derivedSeriesOfIdeal R L
theorem derivedSeriesOfIdeal_add (k l : ℕ) : D (k + l) I = D k (D l I) := by
induction' k with k ih
· rw [Nat.zero_add, derivedSeriesOfIdeal_zero]
· rw [Nat.succ_add k l, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ, ih]
#align lie_algebra.derived_series_of_ideal_add LieAlgebra.derivedSeriesOfIdeal_add
@[mono]
theorem derivedSeriesOfIdeal_le {I J : LieIdeal R L} {k l : ℕ} (h₁ : I ≤ J) (h₂ : l ≤ k) :
D k I ≤ D l J := by
revert l; induction' k with k ih <;> intro l h₂
· rw [le_zero_iff] at h₂; rw [h₂, derivedSeriesOfIdeal_zero]; exact h₁
· have h : l = k.succ ∨ l ≤ k := by rwa [le_iff_eq_or_lt, Nat.lt_succ_iff] at h₂
cases' h with h h
· rw [h, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ]
exact LieSubmodule.mono_lie _ _ _ _ (ih (le_refl k)) (ih (le_refl k))
· rw [derivedSeriesOfIdeal_succ]; exact le_trans (LieSubmodule.lie_le_left _ _) (ih h)
#align lie_algebra.derived_series_of_ideal_le LieAlgebra.derivedSeriesOfIdeal_le
theorem derivedSeriesOfIdeal_succ_le (k : ℕ) : D (k + 1) I ≤ D k I :=
derivedSeriesOfIdeal_le (le_refl I) k.le_succ
#align lie_algebra.derived_series_of_ideal_succ_le LieAlgebra.derivedSeriesOfIdeal_succ_le
theorem derivedSeriesOfIdeal_le_self (k : ℕ) : D k I ≤ I :=
derivedSeriesOfIdeal_le (le_refl I) (zero_le k)
#align lie_algebra.derived_series_of_ideal_le_self LieAlgebra.derivedSeriesOfIdeal_le_self
theorem derivedSeriesOfIdeal_mono {I J : LieIdeal R L} (h : I ≤ J) (k : ℕ) : D k I ≤ D k J :=
derivedSeriesOfIdeal_le h (le_refl k)
#align lie_algebra.derived_series_of_ideal_mono LieAlgebra.derivedSeriesOfIdeal_mono
theorem derivedSeriesOfIdeal_antitone {k l : ℕ} (h : l ≤ k) : D k I ≤ D l I :=
derivedSeriesOfIdeal_le (le_refl I) h
#align lie_algebra.derived_series_of_ideal_antitone LieAlgebra.derivedSeriesOfIdeal_antitone
theorem derivedSeriesOfIdeal_add_le_add (J : LieIdeal R L) (k l : ℕ) :
D (k + l) (I + J) ≤ D k I + D l J := by
let D₁ : LieIdeal R L →o LieIdeal R L :=
{ toFun := fun I => ⁅I, I⁆
monotone' := fun I J h => LieSubmodule.mono_lie I J I J h h }
have h₁ : ∀ I J : LieIdeal R L, D₁ (I ⊔ J) ≤ D₁ I ⊔ J := by
simp [D₁, LieSubmodule.lie_le_right, LieSubmodule.lie_le_left, le_sup_of_le_right]
rw [← D₁.iterate_sup_le_sup_iff] at h₁
exact h₁ k l I J
#align lie_algebra.derived_series_of_ideal_add_le_add LieAlgebra.derivedSeriesOfIdeal_add_le_add
| Mathlib/Algebra/Lie/Solvable.lean | 127 | 128 | theorem derivedSeries_of_bot_eq_bot (k : ℕ) : derivedSeriesOfIdeal R L k ⊥ = ⊥ := by |
rw [eq_bot_iff]; exact derivedSeriesOfIdeal_le_self ⊥ k
| [
" D (k + l) I = D k (D l I)",
" D (0 + l) I = D 0 (D l I)",
" D (k + 1 + l) I = D (k + 1) (D l I)",
" D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k → D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ 0 → D 0 I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k + 1 → D (k + 1) I ≤ D l J",
" D 0 I ≤ D l J",
" I ≤ D 0 J",
" D (k + 1) I ≤ D l J",
"... | [
" D (k + l) I = D k (D l I)",
" D (0 + l) I = D 0 (D l I)",
" D (k + 1 + l) I = D (k + 1) (D l I)",
" D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k → D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ 0 → D 0 I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k + 1 → D (k + 1) I ≤ D l J",
" D 0 I ≤ D l J",
" I ≤ D 0 J",
" D (k + 1) I ≤ D l J",
"... |
import Mathlib.NumberTheory.Divisors
import Mathlib.Data.Nat.Digits
import Mathlib.Data.Nat.MaxPowDiv
import Mathlib.Data.Nat.Multiplicity
import Mathlib.Tactic.IntervalCases
#align_import number_theory.padics.padic_val from "leanprover-community/mathlib"@"60fa54e778c9e85d930efae172435f42fb0d71f7"
universe u
open Nat
open Rat
open multiplicity
def padicValNat (p : ℕ) (n : ℕ) : ℕ :=
if h : p ≠ 1 ∧ 0 < n then (multiplicity p n).get (multiplicity.finite_nat_iff.2 h) else 0
#align padic_val_nat padicValNat
namespace padicValNat
open multiplicity
variable {p : ℕ}
@[simp]
protected theorem zero : padicValNat p 0 = 0 := by simp [padicValNat]
#align padic_val_nat.zero padicValNat.zero
@[simp]
protected theorem one : padicValNat p 1 = 0 := by
unfold padicValNat
split_ifs
· simp
· rfl
#align padic_val_nat.one padicValNat.one
@[simp]
theorem self (hp : 1 < p) : padicValNat p p = 1 := by
have neq_one : ¬p = 1 ↔ True := iff_of_true hp.ne' trivial
have eq_zero_false : p = 0 ↔ False := iff_false_intro (zero_lt_one.trans hp).ne'
simp [padicValNat, neq_one, eq_zero_false]
#align padic_val_nat.self padicValNat.self
@[simp]
theorem eq_zero_iff {n : ℕ} : padicValNat p n = 0 ↔ p = 1 ∨ n = 0 ∨ ¬p ∣ n := by
simp only [padicValNat, dite_eq_right_iff, PartENat.get_eq_iff_eq_coe, Nat.cast_zero,
multiplicity_eq_zero, and_imp, pos_iff_ne_zero, Ne, ← or_iff_not_imp_left]
#align padic_val_nat.eq_zero_iff padicValNat.eq_zero_iff
theorem eq_zero_of_not_dvd {n : ℕ} (h : ¬p ∣ n) : padicValNat p n = 0 :=
eq_zero_iff.2 <| Or.inr <| Or.inr h
#align padic_val_nat.eq_zero_of_not_dvd padicValNat.eq_zero_of_not_dvd
open Nat.maxPowDiv
theorem maxPowDiv_eq_multiplicity {p n : ℕ} (hp : 1 < p) (hn : 0 < n) :
p.maxPowDiv n = multiplicity p n := by
apply multiplicity.unique <| pow_dvd p n
intro h
apply Nat.not_lt.mpr <| le_of_dvd hp hn h
simp
| Mathlib/NumberTheory/Padics/PadicVal.lean | 126 | 129 | theorem maxPowDiv_eq_multiplicity_get {p n : ℕ} (hp : 1 < p) (hn : 0 < n) (h : Finite p n) :
p.maxPowDiv n = (multiplicity p n).get h := by |
rw [PartENat.get_eq_iff_eq_coe.mpr]
apply maxPowDiv_eq_multiplicity hp hn|>.symm
| [
" padicValNat p 0 = 0",
" padicValNat p 1 = 0",
" (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0",
" (multiplicity p 1).get ⋯ = 0",
" 0 = 0",
" padicValNat p p = 1",
" padicValNat p n = 0 ↔ p = 1 ∨ n = 0 ∨ ¬p ∣ n",
" ↑(p.maxPowDiv n) = multiplicity p n",
" ¬p ^ (p.maxPowDiv n + 1) ∣... | [
" padicValNat p 0 = 0",
" padicValNat p 1 = 0",
" (if h : p ≠ 1 ∧ 0 < 1 then (multiplicity p 1).get ⋯ else 0) = 0",
" (multiplicity p 1).get ⋯ = 0",
" 0 = 0",
" padicValNat p p = 1",
" padicValNat p n = 0 ↔ p = 1 ∨ n = 0 ∨ ¬p ∣ n",
" ↑(p.maxPowDiv n) = multiplicity p n",
" ¬p ^ (p.maxPowDiv n + 1) ∣... |
import Mathlib.Analysis.Analytic.Composition
import Mathlib.Analysis.Analytic.Constructions
import Mathlib.Analysis.Complex.CauchyIntegral
import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv
open Complex Set
open scoped Topology
variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℂ E]
variable {f g : E → ℂ} {z : ℂ} {x : E} {s : Set E}
theorem analyticOn_cexp : AnalyticOn ℂ exp univ := by
rw [analyticOn_univ_iff_differentiable]; exact differentiable_exp
theorem analyticAt_cexp : AnalyticAt ℂ exp z :=
analyticOn_cexp z (mem_univ _)
theorem AnalyticAt.cexp (fa : AnalyticAt ℂ f x) : AnalyticAt ℂ (fun z ↦ exp (f z)) x :=
analyticAt_cexp.comp fa
theorem AnalyticOn.cexp (fs : AnalyticOn ℂ f s) : AnalyticOn ℂ (fun z ↦ exp (f z)) s :=
fun z n ↦ analyticAt_cexp.comp (fs z n)
| Mathlib/Analysis/SpecialFunctions/Complex/Analytic.lean | 40 | 44 | theorem analyticAt_clog (m : z ∈ slitPlane) : AnalyticAt ℂ log z := by |
rw [analyticAt_iff_eventually_differentiableAt]
filter_upwards [isOpen_slitPlane.eventually_mem m]
intro z m
exact differentiableAt_id.clog m
| [
" AnalyticOn ℂ cexp univ",
" Differentiable ℂ cexp",
" AnalyticAt ℂ log z",
" ∀ᶠ (z : ℂ) in 𝓝 z, DifferentiableAt ℂ log z",
" ∀ a ∈ slitPlane, DifferentiableAt ℂ log a",
" DifferentiableAt ℂ log z"
] | [
" AnalyticOn ℂ cexp univ",
" Differentiable ℂ cexp"
] |
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
| Mathlib/Algebra/Category/ModuleCat/Monoidal/Basic.lean | 151 | 155 | 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
| [
" tensorHom (𝟙 M) (𝟙 N) = 𝟙 (of R (↑M ⊗[R] ↑N))",
" (TensorProduct.mk R ↑M ↑N).compr₂ (tensorHom (𝟙 M) (𝟙 N)) = (TensorProduct.mk R ↑M ↑N).compr₂ (𝟙 (of R (↑M ⊗[R] ↑N)))",
" tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂",
" (TensorProduct.mk R ↑X₁ ↑X₂).compr₂ (tensorHom (f₁ ≫ g₁) (f₂... | [
" tensorHom (𝟙 M) (𝟙 N) = 𝟙 (of R (↑M ⊗[R] ↑N))",
" (TensorProduct.mk R ↑M ↑N).compr₂ (tensorHom (𝟙 M) (𝟙 N)) = (TensorProduct.mk R ↑M ↑N).compr₂ (𝟙 (of R (↑M ⊗[R] ↑N)))",
" tensorHom (f₁ ≫ g₁) (f₂ ≫ g₂) = tensorHom f₁ f₂ ≫ tensorHom g₁ g₂",
" (TensorProduct.mk R ↑X₁ ↑X₂).compr₂ (tensorHom (f₁ ≫ g₁) (f₂... |
import Mathlib.Algebra.Group.Indicator
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.Field.Rat
import Mathlib.GroupTheory.GroupAction.Group
import Mathlib.GroupTheory.GroupAction.Pi
#align_import algebra.module.basic from "leanprover-community/mathlib"@"30413fc89f202a090a54d78e540963ed3de0056e"
open Function Set
universe u v
variable {α R M M₂ : Type*}
@[deprecated (since := "2024-04-17")]
alias map_nat_cast_smul := map_natCast_smul
theorem map_inv_natCast_smul [AddCommMonoid M] [AddCommMonoid M₂] {F : Type*} [FunLike F M M₂]
[AddMonoidHomClass F M M₂] (f : F) (R S : Type*)
[DivisionSemiring R] [DivisionSemiring S] [Module R M]
[Module S M₂] (n : ℕ) (x : M) : f ((n⁻¹ : R) • x) = (n⁻¹ : S) • f x := by
by_cases hR : (n : R) = 0 <;> by_cases hS : (n : S) = 0
· simp [hR, hS, map_zero f]
· suffices ∀ y, f y = 0 by rw [this, this, smul_zero]
clear x
intro x
rw [← inv_smul_smul₀ hS (f x), ← map_natCast_smul f R S]
simp [hR, map_zero f]
· suffices ∀ y, f y = 0 by simp [this]
clear x
intro x
rw [← smul_inv_smul₀ hR x, map_natCast_smul f R S, hS, zero_smul]
· rw [← inv_smul_smul₀ hS (f _), ← map_natCast_smul f R S, smul_inv_smul₀ hR]
#align map_inv_nat_cast_smul map_inv_natCast_smul
@[deprecated (since := "2024-04-17")]
alias map_inv_nat_cast_smul := map_inv_natCast_smul
| Mathlib/Algebra/Module/Basic.lean | 49 | 55 | theorem map_inv_intCast_smul [AddCommGroup M] [AddCommGroup M₂] {F : Type*} [FunLike F M M₂]
[AddMonoidHomClass F M M₂] (f : F) (R S : Type*) [DivisionRing R] [DivisionRing S] [Module R M]
[Module S M₂] (z : ℤ) (x : M) : f ((z⁻¹ : R) • x) = (z⁻¹ : S) • f x := by |
obtain ⟨n, rfl | rfl⟩ := z.eq_nat_or_neg
· rw [Int.cast_natCast, Int.cast_natCast, map_inv_natCast_smul _ R S]
· simp_rw [Int.cast_neg, Int.cast_natCast, inv_neg, neg_smul, map_neg,
map_inv_natCast_smul _ R S]
| [
" f ((↑n)⁻¹ • x) = (↑n)⁻¹ • f x",
" ∀ (y : M), f y = 0",
" f x = 0",
" (↑n)⁻¹ • f (↑n • x) = 0",
" f ((↑z)⁻¹ • x) = (↑z)⁻¹ • f x",
" f ((↑↑n)⁻¹ • x) = (↑↑n)⁻¹ • f x",
" f ((↑(-↑n))⁻¹ • x) = (↑(-↑n))⁻¹ • f x"
] | [
" f ((↑n)⁻¹ • x) = (↑n)⁻¹ • f x",
" ∀ (y : M), f y = 0",
" f x = 0",
" (↑n)⁻¹ • f (↑n • x) = 0"
] |
import Mathlib.Data.List.Nodup
import Mathlib.Data.List.Range
#align_import data.list.nat_antidiagonal from "leanprover-community/mathlib"@"7b78d1776212a91ecc94cf601f83bdcc46b04213"
open List Function Nat
namespace List
namespace Nat
def antidiagonal (n : ℕ) : List (ℕ × ℕ) :=
(range (n + 1)).map fun i ↦ (i, n - i)
#align list.nat.antidiagonal List.Nat.antidiagonal
@[simp]
theorem mem_antidiagonal {n : ℕ} {x : ℕ × ℕ} : x ∈ antidiagonal n ↔ x.1 + x.2 = n := by
rw [antidiagonal, mem_map]; constructor
· rintro ⟨i, hi, rfl⟩
rw [mem_range, Nat.lt_succ_iff] at hi
exact Nat.add_sub_cancel' hi
· rintro rfl
refine ⟨x.fst, ?_, ?_⟩
· rw [mem_range]
omega
· exact Prod.ext rfl (by simp only [Nat.add_sub_cancel_left])
#align list.nat.mem_antidiagonal List.Nat.mem_antidiagonal
@[simp]
theorem length_antidiagonal (n : ℕ) : (antidiagonal n).length = n + 1 := by
rw [antidiagonal, length_map, length_range]
#align list.nat.length_antidiagonal List.Nat.length_antidiagonal
@[simp]
theorem antidiagonal_zero : antidiagonal 0 = [(0, 0)] :=
rfl
#align list.nat.antidiagonal_zero List.Nat.antidiagonal_zero
theorem nodup_antidiagonal (n : ℕ) : Nodup (antidiagonal n) :=
(nodup_range _).map ((@LeftInverse.injective ℕ (ℕ × ℕ) Prod.fst fun i ↦ (i, n - i)) fun _ ↦ rfl)
#align list.nat.nodup_antidiagonal List.Nat.nodup_antidiagonal
@[simp]
| Mathlib/Data/List/NatAntidiagonal.lean | 68 | 73 | theorem antidiagonal_succ {n : ℕ} :
antidiagonal (n + 1) = (0, n + 1) :: (antidiagonal n).map (Prod.map Nat.succ id) := by |
simp only [antidiagonal, range_succ_eq_map, map_cons, true_and_iff, Nat.add_succ_sub_one,
Nat.add_zero, id, eq_self_iff_true, Nat.sub_zero, map_map, Prod.map_mk]
apply congr rfl (congr rfl _)
ext; simp
| [
" x ∈ antidiagonal n ↔ x.1 + x.2 = n",
" (∃ a ∈ range (n + 1), (a, n - a) = x) ↔ x.1 + x.2 = n",
" (∃ a ∈ range (n + 1), (a, n - a) = x) → x.1 + x.2 = n",
" (i, n - i).1 + (i, n - i).2 = n",
" x.1 + x.2 = n → ∃ a ∈ range (n + 1), (a, n - a) = x",
" ∃ a ∈ range (x.1 + x.2 + 1), (a, x.1 + x.2 - a) = x",
"... | [
" x ∈ antidiagonal n ↔ x.1 + x.2 = n",
" (∃ a ∈ range (n + 1), (a, n - a) = x) ↔ x.1 + x.2 = n",
" (∃ a ∈ range (n + 1), (a, n - a) = x) → x.1 + x.2 = n",
" (i, n - i).1 + (i, n - i).2 = n",
" x.1 + x.2 = n → ∃ a ∈ range (n + 1), (a, n - a) = x",
" ∃ a ∈ range (x.1 + x.2 + 1), (a, x.1 + x.2 - a) = x",
"... |
import Mathlib.LinearAlgebra.Matrix.DotProduct
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.Diagonal
#align_import data.matrix.rank from "leanprover-community/mathlib"@"17219820a8aa8abe85adf5dfde19af1dd1bd8ae7"
open Matrix
namespace Matrix
open FiniteDimensional
variable {l m n o R : Type*} [Fintype n] [Fintype o]
section CommRing
variable [CommRing R]
noncomputable def rank (A : Matrix m n R) : ℕ :=
finrank R <| LinearMap.range A.mulVecLin
#align matrix.rank Matrix.rank
@[simp]
theorem rank_one [StrongRankCondition R] [DecidableEq n] :
rank (1 : Matrix n n R) = Fintype.card n := by
rw [rank, mulVecLin_one, LinearMap.range_id, finrank_top, finrank_pi]
#align matrix.rank_one Matrix.rank_one
@[simp]
| Mathlib/Data/Matrix/Rank.lean | 55 | 56 | theorem rank_zero [Nontrivial R] : rank (0 : Matrix m n R) = 0 := by |
rw [rank, mulVecLin_zero, LinearMap.range_zero, finrank_bot]
| [
" rank 1 = Fintype.card n",
" rank 0 = 0"
] | [
" rank 1 = Fintype.card n"
] |
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 (μ)
| Mathlib/MeasureTheory/Integral/Marginal.lean | 88 | 96 | 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 _
| [
" Measurable (∫⋯∫⁻_s, f ∂μ)",
" Measurable (uncurry fun x y => f (updateFinset x s y))",
" Measurable fun a => updateFinset a.1 s a.2",
" ∀ (a : δ), Measurable fun x => updateFinset x.1 s x.2 a",
" Measurable fun x => updateFinset x.1 s x.2 i",
" Measurable fun x => x.2 ⟨i, ⋯⟩",
" Measurable fun x => x.... | [] |
import Mathlib.Topology.Constructions
#align_import topology.continuous_on from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
open Set Filter Function Topology Filter
variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*}
variable [TopologicalSpace α]
@[simp]
theorem nhds_bind_nhdsWithin {a : α} {s : Set α} : ((𝓝 a).bind fun x => 𝓝[s] x) = 𝓝[s] a :=
bind_inf_principal.trans <| congr_arg₂ _ nhds_bind_nhds rfl
#align nhds_bind_nhds_within nhds_bind_nhdsWithin
@[simp]
theorem eventually_nhds_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ y in 𝓝 a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x :=
Filter.ext_iff.1 nhds_bind_nhdsWithin { x | p x }
#align eventually_nhds_nhds_within eventually_nhds_nhdsWithin
theorem eventually_nhdsWithin_iff {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ x in 𝓝[s] a, p x) ↔ ∀ᶠ x in 𝓝 a, x ∈ s → p x :=
eventually_inf_principal
#align eventually_nhds_within_iff eventually_nhdsWithin_iff
theorem frequently_nhdsWithin_iff {z : α} {s : Set α} {p : α → Prop} :
(∃ᶠ x in 𝓝[s] z, p x) ↔ ∃ᶠ x in 𝓝 z, p x ∧ x ∈ s :=
frequently_inf_principal.trans <| by simp only [and_comm]
#align frequently_nhds_within_iff frequently_nhdsWithin_iff
theorem mem_closure_ne_iff_frequently_within {z : α} {s : Set α} :
z ∈ closure (s \ {z}) ↔ ∃ᶠ x in 𝓝[≠] z, x ∈ s := by
simp [mem_closure_iff_frequently, frequently_nhdsWithin_iff]
#align mem_closure_ne_iff_frequently_within mem_closure_ne_iff_frequently_within
@[simp]
theorem eventually_nhdsWithin_nhdsWithin {a : α} {s : Set α} {p : α → Prop} :
(∀ᶠ y in 𝓝[s] a, ∀ᶠ x in 𝓝[s] y, p x) ↔ ∀ᶠ x in 𝓝[s] a, p x := by
refine ⟨fun h => ?_, fun h => (eventually_nhds_nhdsWithin.2 h).filter_mono inf_le_left⟩
simp only [eventually_nhdsWithin_iff] at h ⊢
exact h.mono fun x hx hxs => (hx hxs).self_of_nhds hxs
#align eventually_nhds_within_nhds_within eventually_nhdsWithin_nhdsWithin
theorem nhdsWithin_eq (a : α) (s : Set α) :
𝓝[s] a = ⨅ t ∈ { t : Set α | a ∈ t ∧ IsOpen t }, 𝓟 (t ∩ s) :=
((nhds_basis_opens a).inf_principal s).eq_biInf
#align nhds_within_eq nhdsWithin_eq
theorem nhdsWithin_univ (a : α) : 𝓝[Set.univ] a = 𝓝 a := by
rw [nhdsWithin, principal_univ, inf_top_eq]
#align nhds_within_univ nhdsWithin_univ
theorem nhdsWithin_hasBasis {p : β → Prop} {s : β → Set α} {a : α} (h : (𝓝 a).HasBasis p s)
(t : Set α) : (𝓝[t] a).HasBasis p fun i => s i ∩ t :=
h.inf_principal t
#align nhds_within_has_basis nhdsWithin_hasBasis
theorem nhdsWithin_basis_open (a : α) (t : Set α) :
(𝓝[t] a).HasBasis (fun u => a ∈ u ∧ IsOpen u) fun u => u ∩ t :=
nhdsWithin_hasBasis (nhds_basis_opens a) t
#align nhds_within_basis_open nhdsWithin_basis_open
| Mathlib/Topology/ContinuousOn.lean | 89 | 91 | theorem mem_nhdsWithin {t : Set α} {a : α} {s : Set α} :
t ∈ 𝓝[s] a ↔ ∃ u, IsOpen u ∧ a ∈ u ∧ u ∩ s ⊆ t := by |
simpa only [and_assoc, and_left_comm] using (nhdsWithin_basis_open a s).mem_iff
| [
" (∃ᶠ (x : α) in 𝓝 z, x ∈ s ∧ p x) ↔ ∃ᶠ (x : α) in 𝓝 z, p x ∧ x ∈ s",
" z ∈ closure (s \\ {z}) ↔ ∃ᶠ (x : α) in 𝓝[≠] z, x ∈ s",
" (∀ᶠ (y : α) in 𝓝[s] a, ∀ᶠ (x : α) in 𝓝[s] y, p x) ↔ ∀ᶠ (x : α) in 𝓝[s] a, p x",
" ∀ᶠ (x : α) in 𝓝[s] a, p x",
" ∀ᶠ (x : α) in 𝓝 a, x ∈ s → p x",
" 𝓝[univ] a = 𝓝 a",
... | [
" (∃ᶠ (x : α) in 𝓝 z, x ∈ s ∧ p x) ↔ ∃ᶠ (x : α) in 𝓝 z, p x ∧ x ∈ s",
" z ∈ closure (s \\ {z}) ↔ ∃ᶠ (x : α) in 𝓝[≠] z, x ∈ s",
" (∀ᶠ (y : α) in 𝓝[s] a, ∀ᶠ (x : α) in 𝓝[s] y, p x) ↔ ∀ᶠ (x : α) in 𝓝[s] a, p x",
" ∀ᶠ (x : α) in 𝓝[s] a, p x",
" ∀ᶠ (x : α) in 𝓝 a, x ∈ s → p x",
" 𝓝[univ] a = 𝓝 a"
] |
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]
| Mathlib/Topology/NhdsSet.lean | 110 | 112 | 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]
| [
" 𝓝ˢ (diagonal X) = ⨆ x, 𝓝 (x, x)",
" sSup (range (𝓝 ∘ fun x => (x, x))) = ⨆ x, 𝓝 (x, x)",
" s ∈ 𝓝ˢ t ↔ ∀ x ∈ t, s ∈ 𝓝 x",
" 𝓝ˢ s ≤ f ↔ ∀ x ∈ s, 𝓝 x ≤ f",
" s ⊆ interior t ↔ t ∈ 𝓝ˢ s",
" Disjoint (𝓟 s) (𝓝ˢ t) ↔ Disjoint (closure s) t",
" Disjoint (𝓝ˢ s) (𝓟 t) ↔ Disjoint s (closure t)",
" ... | [
" 𝓝ˢ (diagonal X) = ⨆ x, 𝓝 (x, x)",
" sSup (range (𝓝 ∘ fun x => (x, x))) = ⨆ x, 𝓝 (x, x)",
" s ∈ 𝓝ˢ t ↔ ∀ x ∈ t, s ∈ 𝓝 x",
" 𝓝ˢ s ≤ f ↔ ∀ x ∈ s, 𝓝 x ≤ f",
" s ⊆ interior t ↔ t ∈ 𝓝ˢ s",
" Disjoint (𝓟 s) (𝓝ˢ t) ↔ Disjoint (closure s) t",
" Disjoint (𝓝ˢ s) (𝓟 t) ↔ Disjoint s (closure t)",
" ... |
import Mathlib.Data.Set.Image
#align_import data.nat.set from "leanprover-community/mathlib"@"cf9386b56953fb40904843af98b7a80757bbe7f9"
namespace Nat
section Set
open Set
theorem zero_union_range_succ : {0} ∪ range succ = univ := by
ext n
cases n <;> simp
#align nat.zero_union_range_succ Nat.zero_union_range_succ
@[simp]
protected theorem range_succ : range succ = { i | 0 < i } := by
ext (_ | i) <;> simp [succ_pos, succ_ne_zero, Set.mem_setOf]
#align nat.range_succ Nat.range_succ
variable {α : Type*}
theorem range_of_succ (f : ℕ → α) : {f 0} ∪ range (f ∘ succ) = range f := by
rw [← image_singleton, range_comp, ← image_union, zero_union_range_succ, image_univ]
#align nat.range_of_succ Nat.range_of_succ
| Mathlib/Data/Nat/Set.lean | 37 | 46 | theorem range_rec {α : Type*} (x : α) (f : ℕ → α → α) :
(Set.range fun n => Nat.rec x f n : Set α) =
{x} ∪ Set.range fun n => Nat.rec (f 0 x) (f ∘ succ) n := by |
convert (range_of_succ (fun n => Nat.rec x f n : ℕ → α)).symm using 4
dsimp
rename_i n
induction' n with n ihn
· rfl
· dsimp at ihn ⊢
rw [ihn]
| [
" {0} ∪ range succ = univ",
" n ∈ {0} ∪ range succ ↔ n ∈ univ",
" 0 ∈ {0} ∪ range succ ↔ 0 ∈ univ",
" n✝ + 1 ∈ {0} ∪ range succ ↔ n✝ + 1 ∈ univ",
" range succ = {i | 0 < i}",
" 0 ∈ range succ ↔ 0 ∈ {i | 0 < i}",
" i + 1 ∈ range succ ↔ i + 1 ∈ {i | 0 < i}",
" {f 0} ∪ range (f ∘ succ) = range f",
" (r... | [
" {0} ∪ range succ = univ",
" n ∈ {0} ∪ range succ ↔ n ∈ univ",
" 0 ∈ {0} ∪ range succ ↔ 0 ∈ univ",
" n✝ + 1 ∈ {0} ∪ range succ ↔ n✝ + 1 ∈ univ",
" range succ = {i | 0 < i}",
" 0 ∈ range succ ↔ 0 ∈ {i | 0 < i}",
" i + 1 ∈ range succ ↔ i + 1 ∈ {i | 0 < i}",
" {f 0} ∪ range (f ∘ succ) = range f"
] |
import Mathlib.RingTheory.Localization.Basic
#align_import ring_theory.localization.integer from "leanprover-community/mathlib"@"9556784a5b84697562e9c6acb40500d4a82e675a"
variable {R : Type*} [CommSemiring R] {M : Submonoid R} {S : Type*} [CommSemiring S]
variable [Algebra R S] {P : Type*} [CommSemiring P]
open Function
namespace IsLocalization
section
variable (R)
-- TODO: define a subalgebra of `IsInteger`s
def IsInteger (a : S) : Prop :=
a ∈ (algebraMap R S).rangeS
#align is_localization.is_integer IsLocalization.IsInteger
end
theorem isInteger_zero : IsInteger R (0 : S) :=
Subsemiring.zero_mem _
#align is_localization.is_integer_zero IsLocalization.isInteger_zero
theorem isInteger_one : IsInteger R (1 : S) :=
Subsemiring.one_mem _
#align is_localization.is_integer_one IsLocalization.isInteger_one
theorem isInteger_add {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a + b) :=
Subsemiring.add_mem _ ha hb
#align is_localization.is_integer_add IsLocalization.isInteger_add
theorem isInteger_mul {a b : S} (ha : IsInteger R a) (hb : IsInteger R b) : IsInteger R (a * b) :=
Subsemiring.mul_mem _ ha hb
#align is_localization.is_integer_mul IsLocalization.isInteger_mul
theorem isInteger_smul {a : R} {b : S} (hb : IsInteger R b) : IsInteger R (a • b) := by
rcases hb with ⟨b', hb⟩
use a * b'
rw [← hb, (algebraMap R S).map_mul, Algebra.smul_def]
#align is_localization.is_integer_smul IsLocalization.isInteger_smul
variable (M)
variable [IsLocalization M S]
theorem exists_integer_multiple' (a : S) : ∃ b : M, IsInteger R (a * algebraMap R S b) :=
let ⟨⟨Num, denom⟩, h⟩ := IsLocalization.surj _ a
⟨denom, Set.mem_range.mpr ⟨Num, h.symm⟩⟩
#align is_localization.exists_integer_multiple' IsLocalization.exists_integer_multiple'
theorem exists_integer_multiple (a : S) : ∃ b : M, IsInteger R ((b : R) • a) := by
simp_rw [Algebra.smul_def, mul_comm _ a]
apply exists_integer_multiple'
#align is_localization.exists_integer_multiple IsLocalization.exists_integer_multiple
theorem exist_integer_multiples {ι : Type*} (s : Finset ι) (f : ι → S) :
∃ b : M, ∀ i ∈ s, IsLocalization.IsInteger R ((b : R) • f i) := by
haveI := Classical.propDecidable
refine ⟨∏ i ∈ s, (sec M (f i)).2, fun i hi => ⟨?_, ?_⟩⟩
· exact (∏ j ∈ s.erase i, (sec M (f j)).2) * (sec M (f i)).1
rw [RingHom.map_mul, sec_spec', ← mul_assoc, ← (algebraMap R S).map_mul, ← Algebra.smul_def]
congr 2
refine _root_.trans ?_ (map_prod (Submonoid.subtype M) _ _).symm
rw [mul_comm,Submonoid.coe_finset_prod,
-- Porting note: explicitly supplied `f`
← Finset.prod_insert (f := fun i => ((sec M (f i)).snd : R)) (s.not_mem_erase i),
Finset.insert_erase hi]
rfl
#align is_localization.exist_integer_multiples IsLocalization.exist_integer_multiples
theorem exist_integer_multiples_of_finite {ι : Type*} [Finite ι] (f : ι → S) :
∃ b : M, ∀ i, IsLocalization.IsInteger R ((b : R) • f i) := by
cases nonempty_fintype ι
obtain ⟨b, hb⟩ := exist_integer_multiples M Finset.univ f
exact ⟨b, fun i => hb i (Finset.mem_univ _)⟩
#align is_localization.exist_integer_multiples_of_finite IsLocalization.exist_integer_multiples_of_finite
theorem exist_integer_multiples_of_finset (s : Finset S) :
∃ b : M, ∀ a ∈ s, IsInteger R ((b : R) • a) :=
exist_integer_multiples M s id
#align is_localization.exist_integer_multiples_of_finset IsLocalization.exist_integer_multiples_of_finset
noncomputable def commonDenom {ι : Type*} (s : Finset ι) (f : ι → S) : M :=
(exist_integer_multiples M s f).choose
#align is_localization.common_denom IsLocalization.commonDenom
noncomputable def integerMultiple {ι : Type*} (s : Finset ι) (f : ι → S) (i : s) : R :=
((exist_integer_multiples M s f).choose_spec i i.prop).choose
#align is_localization.integer_multiple IsLocalization.integerMultiple
@[simp]
theorem map_integerMultiple {ι : Type*} (s : Finset ι) (f : ι → S) (i : s) :
algebraMap R S (integerMultiple M s f i) = commonDenom M s f • f i :=
((exist_integer_multiples M s f).choose_spec _ i.prop).choose_spec
#align is_localization.map_integer_multiple IsLocalization.map_integerMultiple
noncomputable def commonDenomOfFinset (s : Finset S) : M :=
commonDenom M s id
#align is_localization.common_denom_of_finset IsLocalization.commonDenomOfFinset
noncomputable def finsetIntegerMultiple [DecidableEq R] (s : Finset S) : Finset R :=
s.attach.image fun t => integerMultiple M s id t
#align is_localization.finset_integer_multiple IsLocalization.finsetIntegerMultiple
open Pointwise
| Mathlib/RingTheory/Localization/Integer.lean | 149 | 159 | theorem finsetIntegerMultiple_image [DecidableEq R] (s : Finset S) :
algebraMap R S '' finsetIntegerMultiple M s = commonDenomOfFinset M s • (s : Set S) := by |
delta finsetIntegerMultiple commonDenom
rw [Finset.coe_image]
ext
constructor
· rintro ⟨_, ⟨x, -, rfl⟩, rfl⟩
rw [map_integerMultiple]
exact Set.mem_image_of_mem _ x.prop
· rintro ⟨x, hx, rfl⟩
exact ⟨_, ⟨⟨x, hx⟩, s.mem_attach _, rfl⟩, map_integerMultiple M s id _⟩
| [
" IsInteger R (a • b)",
" (algebraMap R S) (a * b') = a • b",
" ∃ b, IsInteger R (↑b • a)",
" ∃ b, IsInteger R (a * (algebraMap R S) ↑b)",
" ∃ b, ∀ i ∈ s, IsInteger R (↑b • f i)",
" R",
" (algebraMap R S) (↑(∏ j ∈ s.erase i, (sec M (f j)).2) * (sec M (f i)).1) = ↑(∏ i ∈ s, (sec M (f i)).2) • f i",
" (... | [
" IsInteger R (a • b)",
" (algebraMap R S) (a * b') = a • b",
" ∃ b, IsInteger R (↑b • a)",
" ∃ b, IsInteger R (a * (algebraMap R S) ↑b)",
" ∃ b, ∀ i ∈ s, IsInteger R (↑b • f i)",
" R",
" (algebraMap R S) (↑(∏ j ∈ s.erase i, (sec M (f j)).2) * (sec M (f i)).1) = ↑(∏ i ∈ s, (sec M (f i)).2) • f i",
" (... |
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 CompositionVector
open ContinuousLinearMap
variable {l : F → E} {l' : F →L[𝕜] E} {y : F}
variable (x)
theorem HasFDerivWithinAt.comp_hasDerivWithinAt {t : Set F} (hl : HasFDerivWithinAt l l' t (f x))
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasFDerivWithinAt hst).hasDerivWithinAt
#align has_fderiv_within_at.comp_has_deriv_within_at HasFDerivWithinAt.comp_hasDerivWithinAt
theorem HasFDerivWithinAt.comp_hasDerivWithinAt_of_eq {t : Set F}
(hl : HasFDerivWithinAt l l' t y)
(hf : HasDerivWithinAt f f' s x) (hst : MapsTo f s t) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf hst
theorem HasFDerivAt.comp_hasDerivWithinAt (hl : HasFDerivAt l l' (f x))
(hf : HasDerivWithinAt f f' s x) : HasDerivWithinAt (l ∘ f) (l' f') s x :=
hl.hasFDerivWithinAt.comp_hasDerivWithinAt x hf (mapsTo_univ _ _)
#align has_fderiv_at.comp_has_deriv_within_at HasFDerivAt.comp_hasDerivWithinAt
theorem HasFDerivAt.comp_hasDerivWithinAt_of_eq (hl : HasFDerivAt l l' y)
(hf : HasDerivWithinAt f f' s x) (hy : y = f x) :
HasDerivWithinAt (l ∘ f) (l' f') s x := by
rw [hy] at hl; exact hl.comp_hasDerivWithinAt x hf
theorem HasFDerivAt.comp_hasDerivAt (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ∘ f) (l' f') x :=
hasDerivWithinAt_univ.mp <| hl.comp_hasDerivWithinAt x hf.hasDerivWithinAt
#align has_fderiv_at.comp_has_deriv_at HasFDerivAt.comp_hasDerivAt
theorem HasFDerivAt.comp_hasDerivAt_of_eq
(hl : HasFDerivAt l l' y) (hf : HasDerivAt f f' x) (hy : y = f x) :
HasDerivAt (l ∘ f) (l' f') x := by
rw [hy] at hl; exact hl.comp_hasDerivAt x hf
theorem HasStrictFDerivAt.comp_hasStrictDerivAt (hl : HasStrictFDerivAt l l' (f x))
(hf : HasStrictDerivAt f f' x) : HasStrictDerivAt (l ∘ f) (l' f') x := by
simpa only [one_apply, one_smul, smulRight_apply, coe_comp', (· ∘ ·)] using
(hl.comp x hf.hasStrictFDerivAt).hasStrictDerivAt
#align has_strict_fderiv_at.comp_has_strict_deriv_at HasStrictFDerivAt.comp_hasStrictDerivAt
| Mathlib/Analysis/Calculus/Deriv/Comp.lean | 393 | 396 | theorem HasStrictFDerivAt.comp_hasStrictDerivAt_of_eq (hl : HasStrictFDerivAt l l' y)
(hf : HasStrictDerivAt f f' x) (hy : y = f x) :
HasStrictDerivAt (l ∘ f) (l' f') x := by |
rw [hy] at hl; exact hl.comp_hasStrictDerivAt x hf
| [
" HasDerivWithinAt (l ∘ f) (l' f') s x",
" HasDerivAt (l ∘ f) (l' f') x",
" HasStrictDerivAt (l ∘ f) (l' f') x"
] | [
" HasDerivWithinAt (l ∘ f) (l' f') s x",
" HasDerivAt (l ∘ f) (l' f') x",
" HasStrictDerivAt (l ∘ f) (l' f') x"
] |
import Mathlib.Data.Finset.Basic
import Mathlib.ModelTheory.Syntax
import Mathlib.Data.List.ProdSigma
#align_import model_theory.semantics from "leanprover-community/mathlib"@"d565b3df44619c1498326936be16f1a935df0728"
universe u v w u' v'
namespace FirstOrder
namespace Language
variable {L : Language.{u, v}} {L' : Language}
variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P]
variable {α : Type u'} {β : Type v'} {γ : Type*}
open FirstOrder Cardinal
open Structure Cardinal Fin
namespace Term
-- Porting note: universes in different order
def realize (v : α → M) : ∀ _t : L.Term α, M
| var k => v k
| func f ts => funMap f fun i => (ts i).realize v
#align first_order.language.term.realize FirstOrder.Language.Term.realize
@[simp]
theorem realize_var (v : α → M) (k) : realize v (var k : L.Term α) = v k := rfl
@[simp]
theorem realize_func (v : α → M) {n} (f : L.Functions n) (ts) :
realize v (func f ts : L.Term α) = funMap f fun i => (ts i).realize v := rfl
@[simp]
theorem realize_relabel {t : L.Term α} {g : α → β} {v : β → M} :
(t.relabel g).realize v = t.realize (v ∘ g) := by
induction' t with _ n f ts ih
· rfl
· simp [ih]
#align first_order.language.term.realize_relabel FirstOrder.Language.Term.realize_relabel
@[simp]
theorem realize_liftAt {n n' m : ℕ} {t : L.Term (Sum α (Fin n))} {v : Sum α (Fin (n + n')) → M} :
(t.liftAt n' m).realize v =
t.realize (v ∘ Sum.map id fun i : Fin _ =>
if ↑i < m then Fin.castAdd n' i else Fin.addNat i n') :=
realize_relabel
#align first_order.language.term.realize_lift_at FirstOrder.Language.Term.realize_liftAt
@[simp]
theorem realize_constants {c : L.Constants} {v : α → M} : c.term.realize v = c :=
funMap_eq_coe_constants
#align first_order.language.term.realize_constants FirstOrder.Language.Term.realize_constants
@[simp]
theorem realize_functions_apply₁ {f : L.Functions 1} {t : L.Term α} {v : α → M} :
(f.apply₁ t).realize v = funMap f ![t.realize v] := by
rw [Functions.apply₁, Term.realize]
refine congr rfl (funext fun i => ?_)
simp only [Matrix.cons_val_fin_one]
#align first_order.language.term.realize_functions_apply₁ FirstOrder.Language.Term.realize_functions_apply₁
@[simp]
theorem realize_functions_apply₂ {f : L.Functions 2} {t₁ t₂ : L.Term α} {v : α → M} :
(f.apply₂ t₁ t₂).realize v = funMap f ![t₁.realize v, t₂.realize v] := by
rw [Functions.apply₂, Term.realize]
refine congr rfl (funext (Fin.cases ?_ ?_))
· simp only [Matrix.cons_val_zero]
· simp only [Matrix.cons_val_succ, Matrix.cons_val_fin_one, forall_const]
#align first_order.language.term.realize_functions_apply₂ FirstOrder.Language.Term.realize_functions_apply₂
theorem realize_con {A : Set M} {a : A} {v : α → M} : (L.con a).term.realize v = a :=
rfl
#align first_order.language.term.realize_con FirstOrder.Language.Term.realize_con
@[simp]
| Mathlib/ModelTheory/Semantics.lean | 130 | 134 | theorem realize_subst {t : L.Term α} {tf : α → L.Term β} {v : β → M} :
(t.subst tf).realize v = t.realize fun a => (tf a).realize v := by |
induction' t with _ _ _ _ ih
· rfl
· simp [ih]
| [
" realize v (relabel g t) = realize (v ∘ g) t",
" realize v (relabel g (var a✝)) = realize (v ∘ g) (var a✝)",
" realize v (relabel g (func f ts)) = realize (v ∘ g) (func f ts)",
" realize v (f.apply₁ t) = funMap f ![realize v t]",
" (funMap f fun i => realize v (![t] i)) = funMap f ![realize v t]",
" real... | [
" realize v (relabel g t) = realize (v ∘ g) t",
" realize v (relabel g (var a✝)) = realize (v ∘ g) (var a✝)",
" realize v (relabel g (func f ts)) = realize (v ∘ g) (func f ts)",
" realize v (f.apply₁ t) = funMap f ![realize v t]",
" (funMap f fun i => realize v (![t] i)) = funMap f ![realize v t]",
" real... |
import Mathlib.Algebra.Order.AbsoluteValue
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.MinMax
import Mathlib.Algebra.Ring.Pi
import Mathlib.GroupTheory.GroupAction.Pi
import Mathlib.GroupTheory.GroupAction.Ring
import Mathlib.Init.Align
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Ring
#align_import data.real.cau_seq from "leanprover-community/mathlib"@"9116dd6709f303dcf781632e15fdef382b0fc579"
assert_not_exists Finset
assert_not_exists Module
assert_not_exists Submonoid
assert_not_exists FloorRing
variable {α β : Type*}
open IsAbsoluteValue
section
variable [LinearOrderedField α] [Ring β] (abv : β → α) [IsAbsoluteValue abv]
theorem rat_add_continuous_lemma {ε : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ →
abv (a₁ + a₂ - (b₁ + b₂)) < ε :=
⟨ε / 2, half_pos ε0, fun {a₁ a₂ b₁ b₂} h₁ h₂ => by
simpa [add_halves, sub_eq_add_neg, add_comm, add_left_comm, add_assoc] using
lt_of_le_of_lt (abv_add abv _ _) (add_lt_add h₁ h₂)⟩
#align rat_add_continuous_lemma rat_add_continuous_lemma
| Mathlib/Algebra/Order/CauSeq/Basic.lean | 58 | 71 | theorem rat_mul_continuous_lemma {ε K₁ K₂ : α} (ε0 : 0 < ε) :
∃ δ > 0, ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ →
abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε := by |
have K0 : (0 : α) < max 1 (max K₁ K₂) := lt_of_lt_of_le zero_lt_one (le_max_left _ _)
have εK := div_pos (half_pos ε0) K0
refine ⟨_, εK, fun {a₁ a₂ b₁ b₂} ha₁ hb₂ h₁ h₂ => ?_⟩
replace ha₁ := lt_of_lt_of_le ha₁ (le_trans (le_max_left _ K₂) (le_max_right 1 _))
replace hb₂ := lt_of_lt_of_le hb₂ (le_trans (le_max_right K₁ _) (le_max_right 1 _))
set M := max 1 (max K₁ K₂)
have : abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M := by
gcongr
rw [← abv_mul abv, mul_comm, div_mul_cancel₀ _ (ne_of_gt K0), ← abv_mul abv, add_halves] at this
simpa [sub_eq_add_neg, mul_add, add_mul, add_left_comm] using
lt_of_le_of_lt (abv_add abv _ _) this
| [
" abv (a₁ + a₂ - (b₁ + b₂)) < ε",
" ∃ δ > 0,\n ∀ {a₁ a₂ b₁ b₂ : β}, abv a₁ < K₁ → abv b₂ < K₂ → abv (a₁ - b₁) < δ → abv (a₂ - b₂) < δ → abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ * a₂ - b₁ * b₂) < ε",
" abv (a₁ - b₁) * abv b₂ + abv (a₂ - b₂) * abv a₁ < ε / 2 / M * M + ε / 2 / M * M"
] | [
" abv (a₁ + a₂ - (b₁ + b₂)) < ε"
] |
import Mathlib.Algebra.Algebra.Hom
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.ring_quot from "leanprover-community/mathlib"@"e5820f6c8fcf1b75bcd7738ae4da1c5896191f72"
universe uR uS uT uA u₄
variable {R : Type uR} [Semiring R]
variable {S : Type uS} [CommSemiring S]
variable {T : Type uT}
variable {A : Type uA} [Semiring A] [Algebra S A]
namespace RingQuot
inductive Rel (r : R → R → Prop) : R → R → Prop
| of ⦃x y : R⦄ (h : r x y) : Rel r x y
| add_left ⦃a b c⦄ : Rel r a b → Rel r (a + c) (b + c)
| mul_left ⦃a b c⦄ : Rel r a b → Rel r (a * c) (b * c)
| mul_right ⦃a b c⦄ : Rel r b c → Rel r (a * b) (a * c)
#align ring_quot.rel RingQuot.Rel
theorem Rel.add_right {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r b c) : Rel r (a + b) (a + c) := by
rw [add_comm a b, add_comm a c]
exact Rel.add_left h
#align ring_quot.rel.add_right RingQuot.Rel.add_right
theorem Rel.neg {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b : R⦄ (h : Rel r a b) :
Rel r (-a) (-b) := by simp only [neg_eq_neg_one_mul a, neg_eq_neg_one_mul b, Rel.mul_right h]
#align ring_quot.rel.neg RingQuot.Rel.neg
| Mathlib/Algebra/RingQuot.lean | 71 | 72 | theorem Rel.sub_left {R : Type uR} [Ring R] {r : R → R → Prop} ⦃a b c : R⦄ (h : Rel r a b) :
Rel r (a - c) (b - c) := by | simp only [sub_eq_add_neg, h.add_left]
| [
" Rel r (a + b) (a + c)",
" Rel r (b + a) (c + a)",
" Rel r (-a) (-b)",
" Rel r (a - c) (b - c)"
] | [
" Rel r (a + b) (a + c)",
" Rel r (b + a) (c + a)",
" Rel r (-a) (-b)"
] |
import Mathlib.Algebra.Module.Zlattice.Basic
import Mathlib.NumberTheory.NumberField.Embeddings
import Mathlib.NumberTheory.NumberField.FractionalIdeal
#align_import number_theory.number_field.canonical_embedding from "leanprover-community/mathlib"@"60da01b41bbe4206f05d34fd70c8dd7498717a30"
variable (K : Type*) [Field K]
namespace NumberField.mixedEmbedding
open NumberField NumberField.InfinitePlace FiniteDimensional Finset
local notation "E" K =>
({w : InfinitePlace K // IsReal w} → ℝ) × ({w : InfinitePlace K // IsComplex w} → ℂ)
noncomputable def _root_.NumberField.mixedEmbedding : K →+* (E K) :=
RingHom.prod (Pi.ringHom fun w => embedding_of_isReal w.prop)
(Pi.ringHom fun w => w.val.embedding)
instance [NumberField K] : Nontrivial (E K) := by
obtain ⟨w⟩ := (inferInstance : Nonempty (InfinitePlace K))
obtain hw | hw := w.isReal_or_isComplex
· have : Nonempty {w : InfinitePlace K // IsReal w} := ⟨⟨w, hw⟩⟩
exact nontrivial_prod_left
· have : Nonempty {w : InfinitePlace K // IsComplex w} := ⟨⟨w, hw⟩⟩
exact nontrivial_prod_right
protected theorem finrank [NumberField K] : finrank ℝ (E K) = finrank ℚ K := by
classical
rw [finrank_prod, finrank_pi, finrank_pi_fintype, Complex.finrank_real_complex, sum_const,
card_univ, ← NrRealPlaces, ← NrComplexPlaces, ← card_real_embeddings, Algebra.id.smul_eq_mul,
mul_comm, ← card_complex_embeddings, ← NumberField.Embeddings.card K ℂ,
Fintype.card_subtype_compl, Nat.add_sub_of_le (Fintype.card_subtype_le _)]
theorem _root_.NumberField.mixedEmbedding_injective [NumberField K] :
Function.Injective (NumberField.mixedEmbedding K) := by
exact RingHom.injective _
noncomputable section norm
open scoped Classical
variable {K}
def normAtPlace (w : InfinitePlace K) : (E K) →*₀ ℝ where
toFun x := if hw : IsReal w then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, not_isReal_iff_isComplex.mp hw⟩‖
map_zero' := by simp
map_one' := by simp
map_mul' x y := by split_ifs <;> simp
theorem normAtPlace_nonneg (w : InfinitePlace K) (x : E K) :
0 ≤ normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_nonneg _
theorem normAtPlace_neg (w : InfinitePlace K) (x : E K) :
normAtPlace w (- x) = normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> simp
theorem normAtPlace_add_le (w : InfinitePlace K) (x y : E K) :
normAtPlace w (x + y) ≤ normAtPlace w x + normAtPlace w y := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs <;> exact norm_add_le _ _
theorem normAtPlace_smul (w : InfinitePlace K) (x : E K) (c : ℝ) :
normAtPlace w (c • x) = |c| * normAtPlace w x := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk]
split_ifs
· rw [Prod.smul_fst, Pi.smul_apply, norm_smul, Real.norm_eq_abs]
· rw [Prod.smul_snd, Pi.smul_apply, norm_smul, Real.norm_eq_abs, Complex.norm_eq_abs]
theorem normAtPlace_real (w : InfinitePlace K) (c : ℝ) :
normAtPlace w ((fun _ ↦ c, fun _ ↦ c) : (E K)) = |c| := by
rw [show ((fun _ ↦ c, fun _ ↦ c) : (E K)) = c • 1 by ext <;> simp, normAtPlace_smul, map_one,
mul_one]
theorem normAtPlace_apply_isReal {w : InfinitePlace K} (hw : IsReal w) (x : E K):
normAtPlace w x = ‖x.1 ⟨w, hw⟩‖ := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, dif_pos]
theorem normAtPlace_apply_isComplex {w : InfinitePlace K} (hw : IsComplex w) (x : E K) :
normAtPlace w x = ‖x.2 ⟨w, hw⟩‖ := by
rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk,
dif_neg (not_isReal_iff_isComplex.mpr hw)]
@[simp]
theorem normAtPlace_apply (w : InfinitePlace K) (x : K) :
normAtPlace w (mixedEmbedding K x) = w x := by
simp_rw [normAtPlace, MonoidWithZeroHom.coe_mk, ZeroHom.coe_mk, mixedEmbedding,
RingHom.prod_apply, Pi.ringHom_apply, norm_embedding_of_isReal, norm_embedding_eq, dite_eq_ite,
ite_id]
| Mathlib/NumberTheory/NumberField/CanonicalEmbedding/Basic.lean | 302 | 308 | theorem normAtPlace_eq_zero {x : E K} :
(∀ w, normAtPlace w x = 0) ↔ x = 0 := by |
refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩
· ext w
· exact norm_eq_zero'.mp (normAtPlace_apply_isReal w.prop _ ▸ h w.1)
· exact norm_eq_zero'.mp (normAtPlace_apply_isComplex w.prop _ ▸ h w.1)
· simp_rw [h, map_zero, implies_true]
| [
" Nontrivial (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))",
" finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)) = finrank ℚ K",
" Function.Injective ⇑(mixedEmbedding K)",
" (fun x => if hw : w.IsReal then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, ⋯⟩‖) 0 = 0",
" { toFun := fun x => if hw : w.IsRea... | [
" Nontrivial (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ))",
" finrank ℝ (({ w // w.IsReal } → ℝ) × ({ w // w.IsComplex } → ℂ)) = finrank ℚ K",
" Function.Injective ⇑(mixedEmbedding K)",
" (fun x => if hw : w.IsReal then ‖x.1 ⟨w, hw⟩‖ else ‖x.2 ⟨w, ⋯⟩‖) 0 = 0",
" { toFun := fun x => if hw : w.IsRea... |
import Mathlib.Analysis.BoxIntegral.Partition.Basic
#align_import analysis.box_integral.partition.split from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
noncomputable section
open scoped Classical
open Filter
open Function Set Filter
namespace BoxIntegral
variable {ι M : Type*} {n : ℕ}
namespace Box
variable {I : Box ι} {i : ι} {x : ℝ} {y : ι → ℝ}
def splitLower (I : Box ι) (i : ι) (x : ℝ) : WithBot (Box ι) :=
mk' I.lower (update I.upper i (min x (I.upper i)))
#align box_integral.box.split_lower BoxIntegral.Box.splitLower
@[simp]
theorem coe_splitLower : (splitLower I i x : Set (ι → ℝ)) = ↑I ∩ { y | y i ≤ x } := by
rw [splitLower, coe_mk']
ext y
simp only [mem_univ_pi, mem_Ioc, mem_inter_iff, mem_coe, mem_setOf_eq, forall_and, ← Pi.le_def,
le_update_iff, le_min_iff, and_assoc, and_forall_ne (p := fun j => y j ≤ upper I j) i, mem_def]
rw [and_comm (a := y i ≤ x)]
#align box_integral.box.coe_split_lower BoxIntegral.Box.coe_splitLower
theorem splitLower_le : I.splitLower i x ≤ I :=
withBotCoe_subset_iff.1 <| by simp
#align box_integral.box.split_lower_le BoxIntegral.Box.splitLower_le
@[simp]
theorem splitLower_eq_bot {i x} : I.splitLower i x = ⊥ ↔ x ≤ I.lower i := by
rw [splitLower, mk'_eq_bot, exists_update_iff I.upper fun j y => y ≤ I.lower j]
simp [(I.lower_lt_upper _).not_le]
#align box_integral.box.split_lower_eq_bot BoxIntegral.Box.splitLower_eq_bot
@[simp]
| Mathlib/Analysis/BoxIntegral/Partition/Split.lean | 84 | 85 | theorem splitLower_eq_self : I.splitLower i x = I ↔ I.upper i ≤ x := by |
simp [splitLower, update_eq_iff]
| [
" ↑(I.splitLower i x) = ↑I ∩ {y | y i ≤ x}",
" (univ.pi fun i_1 => Ioc (I.lower i_1) (update I.upper i (min x (I.upper i)) i_1)) = ↑I ∩ {y | y i ≤ x}",
" (y ∈ univ.pi fun i_1 => Ioc (I.lower i_1) (update I.upper i (min x (I.upper i)) i_1)) ↔ y ∈ ↑I ∩ {y | y i ≤ x}",
" ((∀ (x : ι), I.lower x < y x) ∧ y i ≤ x ∧... | [
" ↑(I.splitLower i x) = ↑I ∩ {y | y i ≤ x}",
" (univ.pi fun i_1 => Ioc (I.lower i_1) (update I.upper i (min x (I.upper i)) i_1)) = ↑I ∩ {y | y i ≤ x}",
" (y ∈ univ.pi fun i_1 => Ioc (I.lower i_1) (update I.upper i (min x (I.upper i)) i_1)) ↔ y ∈ ↑I ∩ {y | y i ≤ x}",
" ((∀ (x : ι), I.lower x < y x) ∧ y i ≤ x ∧... |
import Mathlib.Analysis.Asymptotics.Asymptotics
import Mathlib.Analysis.Asymptotics.Theta
import Mathlib.Analysis.Normed.Order.Basic
#align_import analysis.asymptotics.asymptotic_equivalent from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
namespace Asymptotics
open Filter Function
open Topology
section NormedAddCommGroup
variable {α β : Type*} [NormedAddCommGroup β]
def IsEquivalent (l : Filter α) (u v : α → β) :=
(u - v) =o[l] v
#align asymptotics.is_equivalent Asymptotics.IsEquivalent
@[inherit_doc] scoped notation:50 u " ~[" l:50 "] " v:50 => Asymptotics.IsEquivalent l u v
variable {u v w : α → β} {l : Filter α}
theorem IsEquivalent.isLittleO (h : u ~[l] v) : (u - v) =o[l] v := h
#align asymptotics.is_equivalent.is_o Asymptotics.IsEquivalent.isLittleO
nonrec theorem IsEquivalent.isBigO (h : u ~[l] v) : u =O[l] v :=
(IsBigO.congr_of_sub h.isBigO.symm).mp (isBigO_refl _ _)
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O Asymptotics.IsEquivalent.isBigO
theorem IsEquivalent.isBigO_symm (h : u ~[l] v) : v =O[l] u := by
convert h.isLittleO.right_isBigO_add
simp
set_option linter.uppercaseLean3 false in
#align asymptotics.is_equivalent.is_O_symm Asymptotics.IsEquivalent.isBigO_symm
theorem IsEquivalent.isTheta (h : u ~[l] v) : u =Θ[l] v :=
⟨h.isBigO, h.isBigO_symm⟩
theorem IsEquivalent.isTheta_symm (h : u ~[l] v) : v =Θ[l] u :=
⟨h.isBigO_symm, h.isBigO⟩
@[refl]
theorem IsEquivalent.refl : u ~[l] u := by
rw [IsEquivalent, sub_self]
exact isLittleO_zero _ _
#align asymptotics.is_equivalent.refl Asymptotics.IsEquivalent.refl
@[symm]
theorem IsEquivalent.symm (h : u ~[l] v) : v ~[l] u :=
(h.isLittleO.trans_isBigO h.isBigO_symm).symm
#align asymptotics.is_equivalent.symm Asymptotics.IsEquivalent.symm
@[trans]
theorem IsEquivalent.trans {l : Filter α} {u v w : α → β} (huv : u ~[l] v) (hvw : v ~[l] w) :
u ~[l] w :=
(huv.isLittleO.trans_isBigO hvw.isBigO).triangle hvw.isLittleO
#align asymptotics.is_equivalent.trans Asymptotics.IsEquivalent.trans
theorem IsEquivalent.congr_left {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (huw : u =ᶠ[l] w) :
w ~[l] v :=
huv.congr' (huw.sub (EventuallyEq.refl _ _)) (EventuallyEq.refl _ _)
#align asymptotics.is_equivalent.congr_left Asymptotics.IsEquivalent.congr_left
theorem IsEquivalent.congr_right {u v w : α → β} {l : Filter α} (huv : u ~[l] v) (hvw : v =ᶠ[l] w) :
u ~[l] w :=
(huv.symm.congr_left hvw).symm
#align asymptotics.is_equivalent.congr_right Asymptotics.IsEquivalent.congr_right
theorem isEquivalent_zero_iff_eventually_zero : u ~[l] 0 ↔ u =ᶠ[l] 0 := by
rw [IsEquivalent, sub_zero]
exact isLittleO_zero_right_iff
#align asymptotics.is_equivalent_zero_iff_eventually_zero Asymptotics.isEquivalent_zero_iff_eventually_zero
| Mathlib/Analysis/Asymptotics/AsymptoticEquivalent.lean | 133 | 136 | theorem isEquivalent_zero_iff_isBigO_zero : u ~[l] 0 ↔ u =O[l] (0 : α → β) := by |
refine ⟨IsEquivalent.isBigO, fun h ↦ ?_⟩
rw [isEquivalent_zero_iff_eventually_zero, eventuallyEq_iff_exists_mem]
exact ⟨{ x : α | u x = 0 }, isBigO_zero_right_iff.mp h, fun x hx ↦ hx⟩
| [
" v =O[l] u",
" u x✝ = (u - v) x✝ + v x✝",
" u ~[l] u",
" 0 =o[l] u",
" u ~[l] 0 ↔ u =ᶠ[l] 0",
" u =o[l] 0 ↔ u =ᶠ[l] 0",
" u ~[l] 0 ↔ u =O[l] 0",
" u ~[l] 0",
" ∃ s ∈ l, Set.EqOn u 0 s"
] | [
" v =O[l] u",
" u x✝ = (u - v) x✝ + v x✝",
" u ~[l] u",
" 0 =o[l] u",
" u ~[l] 0 ↔ u =ᶠ[l] 0",
" u =o[l] 0 ↔ u =ᶠ[l] 0"
] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.Div
#align_import data.polynomial.ring_division from "leanprover-community/mathlib"@"8efcf8022aac8e01df8d302dcebdbc25d6a886c8"
noncomputable section
open Polynomial
open Finset
namespace Polynomial
universe u v w z
variable {R : Type u} {S : Type v} {T : Type w} {a b : R} {n : ℕ}
section NoZeroDivisors
variable [CommSemiring R] [NoZeroDivisors R] {p q : R[X]}
theorem irreducible_of_monic (hp : p.Monic) (hp1 : p ≠ 1) :
Irreducible p ↔ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1 := by
refine
⟨fun h f g hf hg hp => (h.2 f g hp.symm).imp hf.eq_one_of_isUnit hg.eq_one_of_isUnit, fun h =>
⟨hp1 ∘ hp.eq_one_of_isUnit, fun f g hfg =>
(h (g * C f.leadingCoeff) (f * C g.leadingCoeff) ?_ ?_ ?_).symm.imp
(isUnit_of_mul_eq_one f _)
(isUnit_of_mul_eq_one g _)⟩⟩
· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, mul_comm, ← hfg, ← Monic]
· rwa [Monic, leadingCoeff_mul, leadingCoeff_C, ← leadingCoeff_mul, ← hfg, ← Monic]
· rw [mul_mul_mul_comm, ← C_mul, ← leadingCoeff_mul, ← hfg, hp.leadingCoeff, C_1, mul_one,
mul_comm, ← hfg]
#align polynomial.irreducible_of_monic Polynomial.irreducible_of_monic
| Mathlib/Algebra/Polynomial/RingDivision.lean | 259 | 265 | theorem Monic.irreducible_iff_natDegree (hp : p.Monic) :
Irreducible p ↔
p ≠ 1 ∧ ∀ f g : R[X], f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = 0 := by |
by_cases hp1 : p = 1; · simp [hp1]
rw [irreducible_of_monic hp hp1, and_iff_right hp1]
refine forall₄_congr fun a b ha hb => ?_
rw [ha.natDegree_eq_zero_iff_eq_one, hb.natDegree_eq_zero_iff_eq_one]
| [
" Irreducible p ↔ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1",
" (g * C f.leadingCoeff).Monic",
" (f * C g.leadingCoeff).Monic",
" g * C f.leadingCoeff * (f * C g.leadingCoeff) = p",
" Irreducible p ↔ p ≠ 1 ∧ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f.natDegree = 0 ∨ g.natDegree = ... | [
" Irreducible p ↔ ∀ (f g : R[X]), f.Monic → g.Monic → f * g = p → f = 1 ∨ g = 1",
" (g * C f.leadingCoeff).Monic",
" (f * C g.leadingCoeff).Monic",
" g * C f.leadingCoeff * (f * C g.leadingCoeff) = p"
] |
import Mathlib.Order.Interval.Finset.Fin
#align_import data.fintype.fin from "leanprover-community/mathlib"@"759575657f189ccb424b990164c8b1fa9f55cdfe"
open Finset
open Fintype
namespace Fin
variable {α β : Type*} {n : ℕ}
theorem map_valEmbedding_univ : (Finset.univ : Finset (Fin n)).map Fin.valEmbedding = Iio n := by
ext
simp [orderIsoSubtype.symm.surjective.exists, OrderIso.symm]
#align fin.map_subtype_embedding_univ Fin.map_valEmbedding_univ
@[simp]
theorem Ioi_zero_eq_map : Ioi (0 : Fin n.succ) = univ.map (Fin.succEmb _) :=
coe_injective <| by ext; simp [pos_iff_ne_zero]
#align fin.Ioi_zero_eq_map Fin.Ioi_zero_eq_map
@[simp]
theorem Iio_last_eq_map : Iio (Fin.last n) = Finset.univ.map Fin.castSuccEmb :=
coe_injective <| by ext; simp [lt_def]
#align fin.Iio_last_eq_map Fin.Iio_last_eq_map
@[simp]
theorem Ioi_succ (i : Fin n) : Ioi i.succ = (Ioi i).map (Fin.succEmb _) := by
ext i
simp only [mem_filter, mem_Ioi, mem_map, mem_univ, true_and_iff, Function.Embedding.coeFn_mk,
exists_true_left]
constructor
· refine cases ?_ ?_ i
· rintro ⟨⟨⟩⟩
· intro i hi
exact ⟨i, succ_lt_succ_iff.mp hi, rfl⟩
· rintro ⟨i, hi, rfl⟩
simpa
#align fin.Ioi_succ Fin.Ioi_succ
@[simp]
theorem Iio_castSucc (i : Fin n) : Iio (castSucc i) = (Iio i).map Fin.castSuccEmb := by
apply Finset.map_injective Fin.valEmbedding
rw [Finset.map_map, Fin.map_valEmbedding_Iio]
exact (Fin.map_valEmbedding_Iio i).symm
#align fin.Iio_cast_succ Fin.Iio_castSucc
theorem card_filter_univ_succ' (p : Fin (n + 1) → Prop) [DecidablePred p] :
(univ.filter p).card = ite (p 0) 1 0 + (univ.filter (p ∘ Fin.succ)).card := by
rw [Fin.univ_succ, filter_cons, card_disjUnion, filter_map, card_map]
split_ifs <;> simp
#align fin.card_filter_univ_succ' Fin.card_filter_univ_succ'
theorem card_filter_univ_succ (p : Fin (n + 1) → Prop) [DecidablePred p] :
(univ.filter p).card =
if p 0 then (univ.filter (p ∘ Fin.succ)).card + 1 else (univ.filter (p ∘ Fin.succ)).card :=
(card_filter_univ_succ' p).trans (by split_ifs <;> simp [add_comm 1])
#align fin.card_filter_univ_succ Fin.card_filter_univ_succ
| Mathlib/Data/Fintype/Fin.lean | 73 | 78 | theorem card_filter_univ_eq_vector_get_eq_count [DecidableEq α] (a : α) (v : Vector α n) :
(univ.filter fun i => a = v.get i).card = v.toList.count a := by |
induction' v with n x xs hxs
· simp
· simp_rw [card_filter_univ_succ', Vector.get_cons_zero, Vector.toList_cons, Function.comp,
Vector.get_cons_succ, hxs, List.count_cons, add_comm (ite (a = x) 1 0)]
| [
" map valEmbedding univ = Iio n",
" a✝ ∈ map valEmbedding univ ↔ a✝ ∈ Iio n",
" ↑(Ioi 0) = ↑(map (succEmb n) univ)",
" x✝ ∈ ↑(Ioi 0) ↔ x✝ ∈ ↑(map (succEmb n) univ)",
" ↑(Iio (last n)) = ↑(map castSuccEmb univ)",
" x✝ ∈ ↑(Iio (last n)) ↔ x✝ ∈ ↑(map castSuccEmb univ)",
" Ioi i.succ = map (succEmb n) (Ioi ... | [
" map valEmbedding univ = Iio n",
" a✝ ∈ map valEmbedding univ ↔ a✝ ∈ Iio n",
" ↑(Ioi 0) = ↑(map (succEmb n) univ)",
" x✝ ∈ ↑(Ioi 0) ↔ x✝ ∈ ↑(map (succEmb n) univ)",
" ↑(Iio (last n)) = ↑(map castSuccEmb univ)",
" x✝ ∈ ↑(Iio (last n)) ↔ x✝ ∈ ↑(map castSuccEmb univ)",
" Ioi i.succ = map (succEmb n) (Ioi ... |
import Mathlib.CategoryTheory.Opposites
#align_import category_theory.eq_to_hom from "leanprover-community/mathlib"@"dc6c365e751e34d100e80fe6e314c3c3e0fd2988"
universe v₁ v₂ v₃ u₁ u₂ u₃
-- morphism levels before object levels. See note [CategoryTheory universes].
namespace CategoryTheory
open Opposite
variable {C : Type u₁} [Category.{v₁} C]
def eqToHom {X Y : C} (p : X = Y) : X ⟶ Y := by rw [p]; exact 𝟙 _
#align category_theory.eq_to_hom CategoryTheory.eqToHom
@[simp]
theorem eqToHom_refl (X : C) (p : X = X) : eqToHom p = 𝟙 X :=
rfl
#align category_theory.eq_to_hom_refl CategoryTheory.eqToHom_refl
@[reassoc (attr := simp)]
theorem eqToHom_trans {X Y Z : C} (p : X = Y) (q : Y = Z) :
eqToHom p ≫ eqToHom q = eqToHom (p.trans q) := by
cases p
cases q
simp
#align category_theory.eq_to_hom_trans CategoryTheory.eqToHom_trans
theorem comp_eqToHom_iff {X Y Y' : C} (p : Y = Y') (f : X ⟶ Y) (g : X ⟶ Y') :
f ≫ eqToHom p = g ↔ f = g ≫ eqToHom p.symm :=
{ mp := fun h => h ▸ by simp
mpr := fun h => by simp [eq_whisker h (eqToHom p)] }
#align category_theory.comp_eq_to_hom_iff CategoryTheory.comp_eqToHom_iff
theorem eqToHom_comp_iff {X X' Y : C} (p : X = X') (f : X ⟶ Y) (g : X' ⟶ Y) :
eqToHom p ≫ g = f ↔ g = eqToHom p.symm ≫ f :=
{ mp := fun h => h ▸ by simp
mpr := fun h => h ▸ by simp [whisker_eq _ h] }
#align category_theory.eq_to_hom_comp_iff CategoryTheory.eqToHom_comp_iff
variable {β : Sort*}
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_naturality {f g : β → C} (z : ∀ b, f b ⟶ g b) {j j' : β} (w : j = j') :
z j ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ z j' := by
cases w
simp
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
theorem eqToHom_iso_hom_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).hom ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').hom := by
cases w
simp
-- The simpNF linter incorrectly claims that this will never apply.
-- https://github.com/leanprover-community/mathlib4/issues/5049
@[reassoc (attr := simp, nolint simpNF)]
| Mathlib/CategoryTheory/EqToHom.lean | 95 | 98 | theorem eqToHom_iso_inv_naturality {f g : β → C} (z : ∀ b, f b ≅ g b) {j j' : β} (w : j = j') :
(z j).inv ≫ eqToHom (by simp [w]) = eqToHom (by simp [w]) ≫ (z j').inv := by |
cases w
simp
| [
" X ⟶ Y",
" Y ⟶ Y",
" eqToHom p ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom ⋯ = eqToHom ⋯",
" f = (f ≫ eqToHom p) ≫ eqToHom ⋯",
" f ≫ eqToHom p = g",
" g = eqToHom ⋯ ≫ eqToHom p ≫ g",
" eqToHom p ≫ eqToHom ⋯ ≫ f = f",
" g j = g j'",
" f j = f j'",
" z ... | [
" X ⟶ Y",
" Y ⟶ Y",
" eqToHom p ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom q = eqToHom ⋯",
" eqToHom ⋯ ≫ eqToHom ⋯ = eqToHom ⋯",
" f = (f ≫ eqToHom p) ≫ eqToHom ⋯",
" f ≫ eqToHom p = g",
" g = eqToHom ⋯ ≫ eqToHom p ≫ g",
" eqToHom p ≫ eqToHom ⋯ ≫ f = f",
" g j = g j'",
" f j = f j'",
" z ... |
import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaar
import Mathlib.MeasureTheory.Measure.Haar.Quotient
import Mathlib.MeasureTheory.Constructions.Polish
import Mathlib.MeasureTheory.Integral.IntervalIntegral
import Mathlib.Topology.Algebra.Order.Floor
#align_import measure_theory.integral.periodic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Function MeasureTheory MeasureTheory.Measure TopologicalSpace AddSubgroup intervalIntegral
open scoped MeasureTheory NNReal ENNReal
@[measurability]
protected theorem AddCircle.measurable_mk' {a : ℝ} :
Measurable (β := AddCircle a) ((↑) : ℝ → AddCircle a) :=
Continuous.measurable <| AddCircle.continuous_mk' a
#align add_circle.measurable_mk' AddCircle.measurable_mk'
theorem isAddFundamentalDomain_Ioc {T : ℝ} (hT : 0 < T) (t : ℝ)
(μ : Measure ℝ := by volume_tac) :
IsAddFundamentalDomain (AddSubgroup.zmultiples T) (Ioc t (t + T)) μ := by
refine IsAddFundamentalDomain.mk' measurableSet_Ioc.nullMeasurableSet fun x => ?_
have : Bijective (codRestrict (fun n : ℤ => n • T) (AddSubgroup.zmultiples T) _) :=
(Equiv.ofInjective (fun n : ℤ => n • T) (zsmul_strictMono_left hT).injective).bijective
refine this.existsUnique_iff.2 ?_
simpa only [add_comm x] using existsUnique_add_zsmul_mem_Ioc hT x t
#align is_add_fundamental_domain_Ioc isAddFundamentalDomain_Ioc
theorem isAddFundamentalDomain_Ioc' {T : ℝ} (hT : 0 < T) (t : ℝ) (μ : Measure ℝ := by volume_tac) :
IsAddFundamentalDomain (AddSubgroup.op <| .zmultiples T) (Ioc t (t + T)) μ := by
refine IsAddFundamentalDomain.mk' measurableSet_Ioc.nullMeasurableSet fun x => ?_
have : Bijective (codRestrict (fun n : ℤ => n • T) (AddSubgroup.zmultiples T) _) :=
(Equiv.ofInjective (fun n : ℤ => n • T) (zsmul_strictMono_left hT).injective).bijective
refine (AddSubgroup.equivOp _).bijective.comp this |>.existsUnique_iff.2 ?_
simpa using existsUnique_add_zsmul_mem_Ioc hT x t
#align is_add_fundamental_domain_Ioc' isAddFundamentalDomain_Ioc'
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [CompleteSpace E]
namespace Function
namespace Periodic
variable {f : ℝ → E} {T : ℝ}
theorem intervalIntegral_add_eq_of_pos (hf : Periodic f T) (hT : 0 < T) (t s : ℝ) :
∫ x in t..t + T, f x = ∫ x in s..s + T, f x := by
simp only [integral_of_le, hT.le, le_add_iff_nonneg_right]
haveI : VAddInvariantMeasure (AddSubgroup.zmultiples T) ℝ volume :=
⟨fun c s _ => measure_preimage_add _ _ _⟩
apply IsAddFundamentalDomain.setIntegral_eq (G := AddSubgroup.zmultiples T)
exacts [isAddFundamentalDomain_Ioc hT t, isAddFundamentalDomain_Ioc hT s, hf.map_vadd_zmultiples]
#align function.periodic.interval_integral_add_eq_of_pos Function.Periodic.intervalIntegral_add_eq_of_pos
theorem intervalIntegral_add_eq (hf : Periodic f T) (t s : ℝ) :
∫ x in t..t + T, f x = ∫ x in s..s + T, f x := by
rcases lt_trichotomy (0 : ℝ) T with (hT | rfl | hT)
· exact hf.intervalIntegral_add_eq_of_pos hT t s
· simp
· rw [← neg_inj, ← integral_symm, ← integral_symm]
simpa only [← sub_eq_add_neg, add_sub_cancel_right] using
hf.neg.intervalIntegral_add_eq_of_pos (neg_pos.2 hT) (t + T) (s + T)
#align function.periodic.interval_integral_add_eq Function.Periodic.intervalIntegral_add_eq
theorem intervalIntegral_add_eq_add (hf : Periodic f T) (t s : ℝ)
(h_int : ∀ t₁ t₂, IntervalIntegrable f MeasureSpace.volume t₁ t₂) :
∫ x in t..s + T, f x = (∫ x in t..s, f x) + ∫ x in t..t + T, f x := by
rw [hf.intervalIntegral_add_eq t s, integral_add_adjacent_intervals (h_int t s) (h_int s _)]
#align function.periodic.interval_integral_add_eq_add Function.Periodic.intervalIntegral_add_eq_add
| Mathlib/MeasureTheory/Integral/Periodic.lean | 287 | 306 | theorem intervalIntegral_add_zsmul_eq (hf : Periodic f T) (n : ℤ) (t : ℝ)
(h_int : ∀ t₁ t₂, IntervalIntegrable f MeasureSpace.volume t₁ t₂) :
∫ x in t..t + n • T, f x = n • ∫ x in t..t + T, f x := by |
-- Reduce to the case `b = 0`
suffices (∫ x in (0)..(n • T), f x) = n • ∫ x in (0)..T, f x by
simp only [hf.intervalIntegral_add_eq t 0, (hf.zsmul n).intervalIntegral_add_eq t 0, zero_add,
this]
-- First prove it for natural numbers
have : ∀ m : ℕ, (∫ x in (0)..m • T, f x) = m • ∫ x in (0)..T, f x := fun m ↦ by
induction' m with m ih
· simp
· simp only [succ_nsmul, hf.intervalIntegral_add_eq_add 0 (m • T) h_int, ih, zero_add]
-- Then prove it for all integers
cases' n with n n
· simp [← this n]
· conv_rhs => rw [negSucc_zsmul]
have h₀ : Int.negSucc n • T + (n + 1) • T = 0 := by simp; linarith
rw [integral_symm, ← (hf.nsmul (n + 1)).funext, neg_inj]
simp_rw [integral_comp_add_right, h₀, zero_add, this (n + 1), add_comm T,
hf.intervalIntegral_add_eq ((n + 1) • T) 0, zero_add]
| [
" IsAddFundamentalDomain (↥(zmultiples T)) (Ioc t (t + T)) μ",
" ∃! g, g +ᵥ x ∈ Ioc t (t + T)",
" ∃! x_1, codRestrict (fun n => n • T) ↑(zmultiples T) ⋯ x_1 +ᵥ x ∈ Ioc t (t + T)",
" IsAddFundamentalDomain (↥(zmultiples T).op) (Ioc t (t + T)) μ",
" ∃! x_1, (⇑(zmultiples T).equivOp ∘ codRestrict (fun n => n •... | [
" IsAddFundamentalDomain (↥(zmultiples T)) (Ioc t (t + T)) μ",
" ∃! g, g +ᵥ x ∈ Ioc t (t + T)",
" ∃! x_1, codRestrict (fun n => n • T) ↑(zmultiples T) ⋯ x_1 +ᵥ x ∈ Ioc t (t + T)",
" IsAddFundamentalDomain (↥(zmultiples T).op) (Ioc t (t + T)) μ",
" ∃! x_1, (⇑(zmultiples T).equivOp ∘ codRestrict (fun n => n •... |
import Mathlib.Algebra.Module.Defs
import Mathlib.LinearAlgebra.Finsupp
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.TensorProduct.Tower
#align_import algebra.module.projective from "leanprover-community/mathlib"@"405ea5cee7a7070ff8fb8dcb4cfb003532e34bce"
universe u v
open LinearMap hiding id
open Finsupp
class Module.Projective (R : Type*) [Semiring R] (P : Type*) [AddCommMonoid P] [Module R P] :
Prop where
out : ∃ s : P →ₗ[R] P →₀ R, Function.LeftInverse (Finsupp.total P P R id) s
#align module.projective Module.Projective
namespace Module
section Semiring
variable {R : Type*} [Semiring R] {P : Type*} [AddCommMonoid P] [Module R P] {M : Type*}
[AddCommMonoid M] [Module R M] {N : Type*} [AddCommMonoid N] [Module R N]
theorem projective_def :
Projective R P ↔ ∃ s : P →ₗ[R] P →₀ R, Function.LeftInverse (Finsupp.total P P R id) s :=
⟨fun h => h.1, fun h => ⟨h⟩⟩
#align module.projective_def Module.projective_def
theorem projective_def' :
Projective R P ↔ ∃ s : P →ₗ[R] P →₀ R, Finsupp.total P P R id ∘ₗ s = .id := by
simp_rw [projective_def, DFunLike.ext_iff, Function.LeftInverse, comp_apply, id_apply]
#align module.projective_def' Module.projective_def'
| Mathlib/Algebra/Module/Projective.lean | 98 | 116 | theorem projective_lifting_property [h : Projective R P] (f : M →ₗ[R] N) (g : P →ₗ[R] N)
(hf : Function.Surjective f) : ∃ h : P →ₗ[R] M, f.comp h = g := by |
/-
Here's the first step of the proof.
Recall that `X →₀ R` is Lean's way of talking about the free `R`-module
on a type `X`. The universal property `Finsupp.total` says that to a map
`X → N` from a type to an `R`-module, we get an associated R-module map
`(X →₀ R) →ₗ N`. Apply this to a (noncomputable) map `P → M` coming from the map
`P →ₗ N` and a random splitting of the surjection `M →ₗ N`, and we get
a map `φ : (P →₀ R) →ₗ M`.
-/
let φ : (P →₀ R) →ₗ[R] M := Finsupp.total _ _ _ fun p => Function.surjInv hf (g p)
-- By projectivity we have a map `P →ₗ (P →₀ R)`;
cases' h.out with s hs
-- Compose to get `P →ₗ M`. This works.
use φ.comp s
ext p
conv_rhs => rw [← hs p]
simp [φ, Finsupp.total_apply, Function.surjInv_eq hf, map_finsupp_sum]
| [
" Projective R P ↔ ∃ s, Finsupp.total P P R id ∘ₗ s = LinearMap.id",
" ∃ h, f ∘ₗ h = g",
" f ∘ₗ φ ∘ₗ s = g",
" (f ∘ₗ φ ∘ₗ s) p = g p",
"R : Type u_1\ninst✝⁶ : Semiring R\nP : Type u_2\ninst✝⁵ : AddCommMonoid P\ninst✝⁴ : Module R P\nM : Type u_3\ninst✝³ : AddCommMonoid M\ninst✝² : Module R M\nN : Type u_4\ni... | [
" Projective R P ↔ ∃ s, Finsupp.total P P R id ∘ₗ s = LinearMap.id"
] |
import Mathlib.Data.Real.Basic
#align_import data.real.sign from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
namespace Real
noncomputable def sign (r : ℝ) : ℝ :=
if r < 0 then -1 else if 0 < r then 1 else 0
#align real.sign Real.sign
theorem sign_of_neg {r : ℝ} (hr : r < 0) : sign r = -1 := by rw [sign, if_pos hr]
#align real.sign_of_neg Real.sign_of_neg
theorem sign_of_pos {r : ℝ} (hr : 0 < r) : sign r = 1 := by rw [sign, if_pos hr, if_neg hr.not_lt]
#align real.sign_of_pos Real.sign_of_pos
@[simp]
theorem sign_zero : sign 0 = 0 := by rw [sign, if_neg (lt_irrefl _), if_neg (lt_irrefl _)]
#align real.sign_zero Real.sign_zero
@[simp]
theorem sign_one : sign 1 = 1 :=
sign_of_pos <| by norm_num
#align real.sign_one Real.sign_one
theorem sign_apply_eq (r : ℝ) : sign r = -1 ∨ sign r = 0 ∨ sign r = 1 := by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
· exact Or.inl <| sign_of_neg hn
· exact Or.inr <| Or.inl <| sign_zero
· exact Or.inr <| Or.inr <| sign_of_pos hp
#align real.sign_apply_eq Real.sign_apply_eq
theorem sign_apply_eq_of_ne_zero (r : ℝ) (h : r ≠ 0) : sign r = -1 ∨ sign r = 1 :=
h.lt_or_lt.imp sign_of_neg sign_of_pos
#align real.sign_apply_eq_of_ne_zero Real.sign_apply_eq_of_ne_zero
@[simp]
theorem sign_eq_zero_iff {r : ℝ} : sign r = 0 ↔ r = 0 := by
refine ⟨fun h => ?_, fun h => h.symm ▸ sign_zero⟩
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
· rw [sign_of_neg hn, neg_eq_zero] at h
exact (one_ne_zero h).elim
· rfl
· rw [sign_of_pos hp] at h
exact (one_ne_zero h).elim
#align real.sign_eq_zero_iff Real.sign_eq_zero_iff
theorem sign_intCast (z : ℤ) : sign (z : ℝ) = ↑(Int.sign z) := by
obtain hn | rfl | hp := lt_trichotomy z (0 : ℤ)
· rw [sign_of_neg (Int.cast_lt_zero.mpr hn), Int.sign_eq_neg_one_of_neg hn, Int.cast_neg,
Int.cast_one]
· rw [Int.cast_zero, sign_zero, Int.sign_zero, Int.cast_zero]
· rw [sign_of_pos (Int.cast_pos.mpr hp), Int.sign_eq_one_of_pos hp, Int.cast_one]
#align real.sign_int_cast Real.sign_intCast
@[deprecated (since := "2024-04-17")]
alias sign_int_cast := sign_intCast
theorem sign_neg {r : ℝ} : sign (-r) = -sign r := by
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
· rw [sign_of_neg hn, sign_of_pos (neg_pos.mpr hn), neg_neg]
· rw [sign_zero, neg_zero, sign_zero]
· rw [sign_of_pos hp, sign_of_neg (neg_lt_zero.mpr hp)]
#align real.sign_neg Real.sign_neg
| Mathlib/Data/Real/Sign.lean | 92 | 98 | theorem sign_mul_nonneg (r : ℝ) : 0 ≤ sign r * r := by |
obtain hn | rfl | hp := lt_trichotomy r (0 : ℝ)
· rw [sign_of_neg hn]
exact mul_nonneg_of_nonpos_of_nonpos (by norm_num) hn.le
· rw [mul_zero]
· rw [sign_of_pos hp, one_mul]
exact hp.le
| [
" r.sign = -1",
" r.sign = 1",
" sign 0 = 0",
" 0 < 1",
" r.sign = -1 ∨ r.sign = 0 ∨ r.sign = 1",
" sign 0 = -1 ∨ sign 0 = 0 ∨ sign 0 = 1",
" r.sign = 0 ↔ r = 0",
" r = 0",
" 0 = 0",
" (↑z).sign = ↑z.sign",
" (↑0).sign = ↑(Int.sign 0)",
" (-r).sign = -r.sign",
" (-0).sign = -sign 0",
" 0 ≤... | [
" r.sign = -1",
" r.sign = 1",
" sign 0 = 0",
" 0 < 1",
" r.sign = -1 ∨ r.sign = 0 ∨ r.sign = 1",
" sign 0 = -1 ∨ sign 0 = 0 ∨ sign 0 = 1",
" r.sign = 0 ↔ r = 0",
" r = 0",
" 0 = 0",
" (↑z).sign = ↑z.sign",
" (↑0).sign = ↑(Int.sign 0)",
" (-r).sign = -r.sign",
" (-0).sign = -sign 0"
] |
import Mathlib.Algebra.Polynomial.AlgebraMap
import Mathlib.Algebra.Polynomial.Degree.Lemmas
import Mathlib.Algebra.Polynomial.HasseDeriv
#align_import data.polynomial.taylor from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
noncomputable section
namespace Polynomial
open Polynomial
variable {R : Type*} [Semiring R] (r : R) (f : R[X])
def taylor (r : R) : R[X] →ₗ[R] R[X] where
toFun f := f.comp (X + C r)
map_add' f g := add_comp
map_smul' c f := by simp only [smul_eq_C_mul, C_mul_comp, RingHom.id_apply]
#align polynomial.taylor Polynomial.taylor
theorem taylor_apply : taylor r f = f.comp (X + C r) :=
rfl
#align polynomial.taylor_apply Polynomial.taylor_apply
@[simp]
theorem taylor_X : taylor r X = X + C r := by simp only [taylor_apply, X_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_X Polynomial.taylor_X
@[simp]
theorem taylor_C (x : R) : taylor r (C x) = C x := by simp only [taylor_apply, C_comp]
set_option linter.uppercaseLean3 false in
#align polynomial.taylor_C Polynomial.taylor_C
@[simp]
theorem taylor_zero' : taylor (0 : R) = LinearMap.id := by
ext
simp only [taylor_apply, add_zero, comp_X, _root_.map_zero, LinearMap.id_comp,
Function.comp_apply, LinearMap.coe_comp]
#align polynomial.taylor_zero' Polynomial.taylor_zero'
theorem taylor_zero (f : R[X]) : taylor 0 f = f := by rw [taylor_zero', LinearMap.id_apply]
#align polynomial.taylor_zero Polynomial.taylor_zero
@[simp]
theorem taylor_one : taylor r (1 : R[X]) = C 1 := by rw [← C_1, taylor_C]
#align polynomial.taylor_one Polynomial.taylor_one
@[simp]
theorem taylor_monomial (i : ℕ) (k : R) : taylor r (monomial i k) = C k * (X + C r) ^ i := by
simp [taylor_apply]
#align polynomial.taylor_monomial Polynomial.taylor_monomial
theorem taylor_coeff (n : ℕ) : (taylor r f).coeff n = (hasseDeriv n f).eval r :=
show (lcoeff R n).comp (taylor r) f = (leval r).comp (hasseDeriv n) f by
congr 1; clear! f; ext i
simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul,
hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i,
map_sum]
simp only [lcoeff_apply, ← C_eq_natCast, mul_assoc, ← C_pow, ← C_mul, coeff_mul_C,
(Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range]
split_ifs with h; · rfl
push_neg at h; rw [Nat.choose_eq_zero_of_lt h, Nat.cast_zero, mul_zero]
#align polynomial.taylor_coeff Polynomial.taylor_coeff
@[simp]
theorem taylor_coeff_zero : (taylor r f).coeff 0 = f.eval r := by
rw [taylor_coeff, hasseDeriv_zero, LinearMap.id_apply]
#align polynomial.taylor_coeff_zero Polynomial.taylor_coeff_zero
@[simp]
theorem taylor_coeff_one : (taylor r f).coeff 1 = f.derivative.eval r := by
rw [taylor_coeff, hasseDeriv_one]
#align polynomial.taylor_coeff_one Polynomial.taylor_coeff_one
@[simp]
| Mathlib/Algebra/Polynomial/Taylor.lean | 98 | 102 | theorem natDegree_taylor (p : R[X]) (r : R) : natDegree (taylor r p) = natDegree p := by |
refine map_natDegree_eq_natDegree _ ?_
nontriviality R
intro n c c0
simp [taylor_monomial, natDegree_C_mul_eq_of_mul_ne_zero, natDegree_pow_X_add_C, c0]
| [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... | [
" { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun (c • f) =\n (RingHom.id R) c • { toFun := fun f => f.comp (X + C r), map_add' := ⋯ }.toFun f",
" (taylor r) X = X + C r",
" (taylor r) (C x) = C x",
" taylor 0 = LinearMap.id",
" ((taylor 0 ∘ₗ monomial n✝¹) 1).coeff n✝ = ((LinearMap.id ∘ₗ mono... |
import Mathlib.SetTheory.Game.State
#align_import set_theory.game.domineering from "leanprover-community/mathlib"@"b134b2f5cf6dd25d4bbfd3c498b6e36c11a17225"
namespace SetTheory
namespace PGame
namespace Domineering
open Function
@[simps!]
def shiftUp : ℤ × ℤ ≃ ℤ × ℤ :=
(Equiv.refl ℤ).prodCongr (Equiv.addRight (1 : ℤ))
#align pgame.domineering.shift_up SetTheory.PGame.Domineering.shiftUp
@[simps!]
def shiftRight : ℤ × ℤ ≃ ℤ × ℤ :=
(Equiv.addRight (1 : ℤ)).prodCongr (Equiv.refl ℤ)
#align pgame.domineering.shift_right SetTheory.PGame.Domineering.shiftRight
-- Porting note: reducibility cannot be `local`. For now there are no dependents of this file so
-- being globally reducible is fine.
abbrev Board :=
Finset (ℤ × ℤ)
#align pgame.domineering.board SetTheory.PGame.Domineering.Board
def left (b : Board) : Finset (ℤ × ℤ) :=
b ∩ b.map shiftUp
#align pgame.domineering.left SetTheory.PGame.Domineering.left
def right (b : Board) : Finset (ℤ × ℤ) :=
b ∩ b.map shiftRight
#align pgame.domineering.right SetTheory.PGame.Domineering.right
theorem mem_left {b : Board} (x : ℤ × ℤ) : x ∈ left b ↔ x ∈ b ∧ (x.1, x.2 - 1) ∈ b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_left SetTheory.PGame.Domineering.mem_left
theorem mem_right {b : Board} (x : ℤ × ℤ) : x ∈ right b ↔ x ∈ b ∧ (x.1 - 1, x.2) ∈ b :=
Finset.mem_inter.trans (and_congr Iff.rfl Finset.mem_map_equiv)
#align pgame.domineering.mem_right SetTheory.PGame.Domineering.mem_right
def moveLeft (b : Board) (m : ℤ × ℤ) : Board :=
(b.erase m).erase (m.1, m.2 - 1)
#align pgame.domineering.move_left SetTheory.PGame.Domineering.moveLeft
def moveRight (b : Board) (m : ℤ × ℤ) : Board :=
(b.erase m).erase (m.1 - 1, m.2)
#align pgame.domineering.move_right SetTheory.PGame.Domineering.moveRight
theorem fst_pred_mem_erase_of_mem_right {b : Board} {m : ℤ × ℤ} (h : m ∈ right b) :
(m.1 - 1, m.2) ∈ b.erase m := by
rw [mem_right] at h
apply Finset.mem_erase_of_ne_of_mem _ h.2
exact ne_of_apply_ne Prod.fst (pred_ne_self m.1)
#align pgame.domineering.fst_pred_mem_erase_of_mem_right SetTheory.PGame.Domineering.fst_pred_mem_erase_of_mem_right
theorem snd_pred_mem_erase_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) :
(m.1, m.2 - 1) ∈ b.erase m := by
rw [mem_left] at h
apply Finset.mem_erase_of_ne_of_mem _ h.2
exact ne_of_apply_ne Prod.snd (pred_ne_self m.2)
#align pgame.domineering.snd_pred_mem_erase_of_mem_left SetTheory.PGame.Domineering.snd_pred_mem_erase_of_mem_left
| Mathlib/SetTheory/Game/Domineering.lean | 93 | 98 | theorem card_of_mem_left {b : Board} {m : ℤ × ℤ} (h : m ∈ left b) : 2 ≤ Finset.card b := by |
have w₁ : m ∈ b := (Finset.mem_inter.1 h).1
have w₂ : (m.1, m.2 - 1) ∈ b.erase m := snd_pred_mem_erase_of_mem_left h
have i₁ := Finset.card_erase_lt_of_mem w₁
have i₂ := Nat.lt_of_le_of_lt (Nat.zero_le _) (Finset.card_erase_lt_of_mem w₂)
exact Nat.lt_of_le_of_lt i₂ i₁
| [
" (m.1 - 1, m.2) ∈ Finset.erase b m",
" (m.1 - 1, m.2) ≠ m",
" (m.1, m.2 - 1) ∈ Finset.erase b m",
" (m.1, m.2 - 1) ≠ m",
" 2 ≤ Finset.card b"
] | [
" (m.1 - 1, m.2) ∈ Finset.erase b m",
" (m.1 - 1, m.2) ≠ m",
" (m.1, m.2 - 1) ∈ Finset.erase b m",
" (m.1, m.2 - 1) ≠ m"
] |
import Mathlib.Algebra.Module.BigOperators
import Mathlib.Algebra.Module.Defs
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Data.Nat.ModEq
import Mathlib.Data.Set.Finite
#align_import combinatorics.pigeonhole from "leanprover-community/mathlib"@"d6fad0e5bf2d6f48da9175d25c3dc5706b3834ce"
universe u v w
variable {α : Type u} {β : Type v} {M : Type w} [DecidableEq β]
open Nat
namespace Finset
variable {s : Finset α} {t : Finset β} {f : α → β} {w : α → M} {b : M} {n : ℕ}
section
variable [LinearOrderedCancelAddCommMonoid M]
theorem exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum (hf : ∀ a ∈ s, f a ∈ t)
(hb : t.card • b < ∑ x ∈ s, w x) : ∃ y ∈ t, b < ∑ x ∈ s.filter fun x => f x = y, w x :=
exists_lt_of_sum_lt <| by simpa only [sum_fiberwise_of_maps_to hf, sum_const]
#align finset.exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum Finset.exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum
theorem exists_sum_fiber_lt_of_maps_to_of_sum_lt_nsmul (hf : ∀ a ∈ s, f a ∈ t)
(hb : ∑ x ∈ s, w x < t.card • b) : ∃ y ∈ t, ∑ x ∈ s.filter fun x => f x = y, w x < b :=
exists_lt_sum_fiber_of_maps_to_of_nsmul_lt_sum (M := Mᵒᵈ) hf hb
#align finset.exists_sum_fiber_lt_of_maps_to_of_sum_lt_nsmul Finset.exists_sum_fiber_lt_of_maps_to_of_sum_lt_nsmul
| Mathlib/Combinatorics/Pigeonhole.lean | 134 | 141 | theorem exists_lt_sum_fiber_of_sum_fiber_nonpos_of_nsmul_lt_sum
(ht : ∀ y ∉ t, ∑ x ∈ s.filter fun x => f x = y, w x ≤ 0)
(hb : t.card • b < ∑ x ∈ s, w x) : ∃ y ∈ t, b < ∑ x ∈ s.filter fun x => f x = y, w x :=
exists_lt_of_sum_lt <|
calc
∑ _y ∈ t, b < ∑ x ∈ s, w x := by | simpa
_ ≤ ∑ y ∈ t, ∑ x ∈ s.filter fun x => f x = y, w x :=
sum_le_sum_fiberwise_of_sum_fiber_nonpos ht
| [
" ∑ i ∈ t, b < ∑ i ∈ t, ∑ x ∈ filter (fun x => f x = i) s, w x",
" ∑ _y ∈ t, b < ∑ x ∈ s, w x"
] | [
" ∑ i ∈ t, b < ∑ i ∈ t, ∑ x ∈ filter (fun x => f x = i) s, w x"
] |
import Mathlib.Data.Complex.Basic
import Mathlib.MeasureTheory.Integral.CircleIntegral
#align_import measure_theory.integral.circle_transform from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
open Set MeasureTheory Metric Filter Function
open scoped Interval Real
noncomputable section
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] (R : ℝ) (z w : ℂ)
namespace Complex
def circleTransform (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • (circleMap z R θ - w)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform Complex.circleTransform
def circleTransformDeriv (f : ℂ → E) (θ : ℝ) : E :=
(2 * ↑π * I)⁻¹ • deriv (circleMap z R) θ • ((circleMap z R θ - w) ^ 2)⁻¹ • f (circleMap z R θ)
#align complex.circle_transform_deriv Complex.circleTransformDeriv
theorem circleTransformDeriv_periodic (f : ℂ → E) :
Periodic (circleTransformDeriv R z w f) (2 * π) := by
have := periodic_circleMap
simp_rw [Periodic] at *
intro x
simp_rw [circleTransformDeriv, this]
congr 2
simp [this]
#align complex.circle_transform_deriv_periodic Complex.circleTransformDeriv_periodic
theorem circleTransformDeriv_eq (f : ℂ → E) : circleTransformDeriv R z w f =
fun θ => (circleMap z R θ - w)⁻¹ • circleTransform R z w f θ := by
ext
simp_rw [circleTransformDeriv, circleTransform, ← mul_smul, ← mul_assoc]
ring_nf
rw [inv_pow]
congr
ring
#align complex.circle_transform_deriv_eq Complex.circleTransformDeriv_eq
| Mathlib/MeasureTheory/Integral/CircleTransform.lean | 68 | 72 | theorem integral_circleTransform (f : ℂ → E) :
(∫ θ : ℝ in (0)..2 * π, circleTransform R z w f θ) =
(2 * ↑π * I)⁻¹ • ∮ z in C(z, R), (z - w)⁻¹ • f z := by |
simp_rw [circleTransform, circleIntegral, deriv_circleMap, circleMap]
simp
| [
" Periodic (circleTransformDeriv R z w f) (2 * π)",
" ∀ (x : ℝ), circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" (2 * ↑π * I)⁻¹ • deriv (circleMap z R) (x + 2 * π) • ((circleMap z R x - w) ^ 2)⁻¹ • f (c... | [
" Periodic (circleTransformDeriv R z w f) (2 * π)",
" ∀ (x : ℝ), circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" circleTransformDeriv R z w f (x + 2 * π) = circleTransformDeriv R z w f x",
" (2 * ↑π * I)⁻¹ • deriv (circleMap z R) (x + 2 * π) • ((circleMap z R x - w) ^ 2)⁻¹ • f (c... |
import Mathlib.Algebra.ContinuedFractions.Basic
import Mathlib.Algebra.GroupWithZero.Basic
#align_import algebra.continued_fractions.translations from "leanprover-community/mathlib"@"a7e36e48519ab281320c4d192da6a7b348ce40ad"
namespace GeneralizedContinuedFraction
section General
variable {α : Type*} {g : GeneralizedContinuedFraction α} {n : ℕ}
theorem terminatedAt_iff_s_terminatedAt : g.TerminatedAt n ↔ g.s.TerminatedAt n := by rfl
#align generalized_continued_fraction.terminated_at_iff_s_terminated_at GeneralizedContinuedFraction.terminatedAt_iff_s_terminatedAt
theorem terminatedAt_iff_s_none : g.TerminatedAt n ↔ g.s.get? n = none := by rfl
#align generalized_continued_fraction.terminated_at_iff_s_none GeneralizedContinuedFraction.terminatedAt_iff_s_none
theorem part_num_none_iff_s_none : g.partialNumerators.get? n = none ↔ g.s.get? n = none := by
cases s_nth_eq : g.s.get? n <;> simp [partialNumerators, s_nth_eq]
#align generalized_continued_fraction.part_num_none_iff_s_none GeneralizedContinuedFraction.part_num_none_iff_s_none
| Mathlib/Algebra/ContinuedFractions/Translations.lean | 45 | 46 | theorem terminatedAt_iff_part_num_none : g.TerminatedAt n ↔ g.partialNumerators.get? n = none := by |
rw [terminatedAt_iff_s_none, part_num_none_iff_s_none]
| [
" g.TerminatedAt n ↔ g.s.TerminatedAt n",
" g.TerminatedAt n ↔ g.s.get? n = none",
" g.partialNumerators.get? n = none ↔ g.s.get? n = none",
" g.partialNumerators.get? n = none ↔ none = none",
" g.partialNumerators.get? n = none ↔ some val✝ = none",
" g.TerminatedAt n ↔ g.partialNumerators.get? n = none"
... | [
" g.TerminatedAt n ↔ g.s.TerminatedAt n",
" g.TerminatedAt n ↔ g.s.get? n = none",
" g.partialNumerators.get? n = none ↔ g.s.get? n = none",
" g.partialNumerators.get? n = none ↔ none = none",
" g.partialNumerators.get? n = none ↔ some val✝ = none"
] |
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
| Mathlib/Data/ZMod/Basic.lean | 94 | 96 | 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]
| [
" a.val < n",
" a.val < 0",
" a.val < n✝ + 1",
" (↑a).val = a % n",
" (↑a).val = a % 0",
" (↑a).val = a",
" (↑a).val = a % (n✝ + 1)",
" IsUnit n ↔ n.val = 1",
" IsUnit n ↔ Int.natAbs n = 1"
] | [
" a.val < n",
" a.val < 0",
" a.val < n✝ + 1",
" (↑a).val = a % n",
" (↑a).val = a % 0",
" (↑a).val = a",
" (↑a).val = a % (n✝ + 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 TypeclassesLeftRightLT
variable [LT α] [CovariantClass α α (· * ·) (· < ·)] [CovariantClass α α (swap (· * ·)) (· < ·)]
{a b c d : α}
@[to_additive (attr := simp)]
| Mathlib/Algebra/Order/Group/Defs.lean | 382 | 384 | theorem inv_lt_inv_iff : a⁻¹ < b⁻¹ ↔ b < a := by |
rw [← mul_lt_mul_iff_left a, ← mul_lt_mul_iff_right b]
simp
| [
" b ≤ c",
" a⁻¹ < b⁻¹ ↔ b < a",
" a * a⁻¹ * b < a * b⁻¹ * b ↔ b < a"
] | [
" b ≤ c"
] |
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Group.Int
import Mathlib.Data.Nat.Dist
import Mathlib.Data.Ordmap.Ordnode
import Mathlib.Tactic.Abel
import Mathlib.Tactic.Linarith
#align_import data.ordmap.ordset from "leanprover-community/mathlib"@"47b51515e69f59bca5cf34ef456e6000fe205a69"
variable {α : Type*}
namespace Ordnode
theorem not_le_delta {s} (H : 1 ≤ s) : ¬s ≤ delta * 0 :=
not_le_of_gt H
#align ordnode.not_le_delta Ordnode.not_le_delta
theorem delta_lt_false {a b : ℕ} (h₁ : delta * a < b) (h₂ : delta * b < a) : False :=
not_le_of_lt (lt_trans ((mul_lt_mul_left (by decide)).2 h₁) h₂) <| by
simpa [mul_assoc] using Nat.mul_le_mul_right a (by decide : 1 ≤ delta * delta)
#align ordnode.delta_lt_false Ordnode.delta_lt_false
def realSize : Ordnode α → ℕ
| nil => 0
| node _ l _ r => realSize l + realSize r + 1
#align ordnode.real_size Ordnode.realSize
def Sized : Ordnode α → Prop
| nil => True
| node s l _ r => s = size l + size r + 1 ∧ Sized l ∧ Sized r
#align ordnode.sized Ordnode.Sized
theorem Sized.node' {l x r} (hl : @Sized α l) (hr : Sized r) : Sized (node' l x r) :=
⟨rfl, hl, hr⟩
#align ordnode.sized.node' Ordnode.Sized.node'
theorem Sized.eq_node' {s l x r} (h : @Sized α (node s l x r)) : node s l x r = .node' l x r := by
rw [h.1]
#align ordnode.sized.eq_node' Ordnode.Sized.eq_node'
theorem Sized.size_eq {s l x r} (H : Sized (@node α s l x r)) :
size (@node α s l x r) = size l + size r + 1 :=
H.1
#align ordnode.sized.size_eq Ordnode.Sized.size_eq
@[elab_as_elim]
theorem Sized.induction {t} (hl : @Sized α t) {C : Ordnode α → Prop} (H0 : C nil)
(H1 : ∀ l x r, C l → C r → C (.node' l x r)) : C t := by
induction t with
| nil => exact H0
| node _ _ _ _ t_ih_l t_ih_r =>
rw [hl.eq_node']
exact H1 _ _ _ (t_ih_l hl.2.1) (t_ih_r hl.2.2)
#align ordnode.sized.induction Ordnode.Sized.induction
theorem size_eq_realSize : ∀ {t : Ordnode α}, Sized t → size t = realSize t
| nil, _ => rfl
| node s l x r, ⟨h₁, h₂, h₃⟩ => by
rw [size, h₁, size_eq_realSize h₂, size_eq_realSize h₃]; rfl
#align ordnode.size_eq_real_size Ordnode.size_eq_realSize
@[simp]
theorem Sized.size_eq_zero {t : Ordnode α} (ht : Sized t) : size t = 0 ↔ t = nil := by
cases t <;> [simp;simp [ht.1]]
#align ordnode.sized.size_eq_zero Ordnode.Sized.size_eq_zero
| Mathlib/Data/Ordmap/Ordset.lean | 144 | 145 | theorem Sized.pos {s l x r} (h : Sized (@node α s l x r)) : 0 < s := by |
rw [h.1]; apply Nat.le_add_left
| [
" 0 < delta",
" a ≤ delta * (delta * a)",
" 1 ≤ delta * delta",
" node s l x r = l.node' x r",
" C t",
" C nil",
" C (node size✝ l✝ x✝ r✝)",
" C (l✝.node' x✝ r✝)",
" (node s l x r).size = (node s l x r).realSize",
" (match node (l.realSize + r.realSize + 1) l x r with\n | nil => 0\n | node s... | [
" 0 < delta",
" a ≤ delta * (delta * a)",
" 1 ≤ delta * delta",
" node s l x r = l.node' x r",
" C t",
" C nil",
" C (node size✝ l✝ x✝ r✝)",
" C (l✝.node' x✝ r✝)",
" (node s l x r).size = (node s l x r).realSize",
" (match node (l.realSize + r.realSize + 1) l x r with\n | nil => 0\n | node s... |
import Mathlib.Analysis.Calculus.FDeriv.Linear
import Mathlib.Analysis.Calculus.FDeriv.Comp
#align_import analysis.calculus.fderiv.prod from "leanprover-community/mathlib"@"e354e865255654389cc46e6032160238df2e0f40"
open Filter Asymptotics ContinuousLinearMap Set Metric
open scoped Classical
open Topology NNReal Filter Asymptotics ENNReal
noncomputable section
section
variable {𝕜 : Type*} [NontriviallyNormedField 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace 𝕜 E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace 𝕜 F]
variable {G : Type*} [NormedAddCommGroup G] [NormedSpace 𝕜 G]
variable {G' : Type*} [NormedAddCommGroup G'] [NormedSpace 𝕜 G']
variable {f f₀ f₁ g : E → F}
variable {f' f₀' f₁' g' : E →L[𝕜] F}
variable (e : E →L[𝕜] F)
variable {x : E}
variable {s t : Set E}
variable {L L₁ L₂ : Filter E}
section CartesianProduct
section Pi
variable {ι : Type*} [Fintype ι] {F' : ι → Type*} [∀ i, NormedAddCommGroup (F' i)]
[∀ i, NormedSpace 𝕜 (F' i)] {φ : ∀ i, E → F' i} {φ' : ∀ i, E →L[𝕜] F' i} {Φ : E → ∀ i, F' i}
{Φ' : E →L[𝕜] ∀ i, F' i}
@[simp]
theorem hasStrictFDerivAt_pi' :
HasStrictFDerivAt Φ Φ' x ↔ ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x := by
simp only [HasStrictFDerivAt, ContinuousLinearMap.coe_pi]
exact isLittleO_pi
#align has_strict_fderiv_at_pi' hasStrictFDerivAt_pi'
@[fun_prop]
theorem hasStrictFDerivAt_pi'' (hφ : ∀ i, HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x) :
HasStrictFDerivAt Φ Φ' x := hasStrictFDerivAt_pi'.2 hφ
@[fun_prop]
theorem hasStrictFDerivAt_apply (i : ι) (f : ∀ i, F' i) :
HasStrictFDerivAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) f := by
let id' := ContinuousLinearMap.id 𝕜 (∀ i, F' i)
have h := ((hasStrictFDerivAt_pi'
(Φ := fun (f : ∀ i, F' i) (i' : ι) => f i') (Φ':=id') (x:=f))).1
have h' : comp (proj i) id' = proj i := by rfl
rw [← h']; apply h; apply hasStrictFDerivAt_id
@[simp 1100] -- Porting note: increased priority to make lint happy
theorem hasStrictFDerivAt_pi :
HasStrictFDerivAt (fun x i => φ i x) (ContinuousLinearMap.pi φ') x ↔
∀ i, HasStrictFDerivAt (φ i) (φ' i) x :=
hasStrictFDerivAt_pi'
#align has_strict_fderiv_at_pi hasStrictFDerivAt_pi
@[simp]
theorem hasFDerivAtFilter_pi' :
HasFDerivAtFilter Φ Φ' x L ↔
∀ i, HasFDerivAtFilter (fun x => Φ x i) ((proj i).comp Φ') x L := by
simp only [hasFDerivAtFilter_iff_isLittleO, ContinuousLinearMap.coe_pi]
exact isLittleO_pi
#align has_fderiv_at_filter_pi' hasFDerivAtFilter_pi'
theorem hasFDerivAtFilter_pi :
HasFDerivAtFilter (fun x i => φ i x) (ContinuousLinearMap.pi φ') x L ↔
∀ i, HasFDerivAtFilter (φ i) (φ' i) x L :=
hasFDerivAtFilter_pi'
#align has_fderiv_at_filter_pi hasFDerivAtFilter_pi
@[simp]
theorem hasFDerivAt_pi' :
HasFDerivAt Φ Φ' x ↔ ∀ i, HasFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x :=
hasFDerivAtFilter_pi'
#align has_fderiv_at_pi' hasFDerivAt_pi'
@[fun_prop]
theorem hasFDerivAt_pi'' (hφ : ∀ i, HasFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x) :
HasFDerivAt Φ Φ' x := hasFDerivAt_pi'.2 hφ
@[fun_prop]
theorem hasFDerivAt_apply (i : ι) (f : ∀ i, F' i) :
HasFDerivAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) f := by
apply HasStrictFDerivAt.hasFDerivAt
apply hasStrictFDerivAt_apply
theorem hasFDerivAt_pi :
HasFDerivAt (fun x i => φ i x) (ContinuousLinearMap.pi φ') x ↔
∀ i, HasFDerivAt (φ i) (φ' i) x :=
hasFDerivAtFilter_pi
#align has_fderiv_at_pi hasFDerivAt_pi
@[simp]
theorem hasFDerivWithinAt_pi' :
HasFDerivWithinAt Φ Φ' s x ↔ ∀ i, HasFDerivWithinAt (fun x => Φ x i) ((proj i).comp Φ') s x :=
hasFDerivAtFilter_pi'
#align has_fderiv_within_at_pi' hasFDerivWithinAt_pi'
@[fun_prop]
theorem hasFDerivWithinAt_pi''
(hφ : ∀ i, HasFDerivWithinAt (fun x => Φ x i) ((proj i).comp Φ') s x) :
HasFDerivWithinAt Φ Φ' s x := hasFDerivWithinAt_pi'.2 hφ
@[fun_prop]
| Mathlib/Analysis/Calculus/FDeriv/Prod.lean | 474 | 480 | theorem hasFDerivWithinAt_apply (i : ι) (f : ∀ i, F' i) (s' : Set (∀ i, F' i)) :
HasFDerivWithinAt (𝕜:=𝕜) (fun f : ∀ i, F' i => f i) (proj i) s' f := by |
let id' := ContinuousLinearMap.id 𝕜 (∀ i, F' i)
have h := ((hasFDerivWithinAt_pi'
(Φ := fun (f : ∀ i, F' i) (i' : ι) => f i') (Φ':=id') (x:=f) (s:=s'))).1
have h' : comp (proj i) id' = proj i := by rfl
rw [← h']; apply h; apply hasFDerivWithinAt_id
| [
" HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x",
" ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2",
" HasStrictFDerivAt ... | [
" HasStrictFDerivAt Φ Φ' x ↔ ∀ (i : ι), HasStrictFDerivAt (fun x => Φ x i) ((proj i).comp Φ') x",
" ((fun p => Φ p.1 - Φ p.2 - Φ' (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2) ↔\n ∀ (i : ι), (fun p => Φ p.1 i - Φ p.2 i - ((proj i).comp Φ') (p.1 - p.2)) =o[𝓝 (x, x)] fun p => p.1 - p.2",
" HasStrictFDerivAt ... |
import Batteries.Tactic.Lint.Basic
import Mathlib.Algebra.Order.Monoid.Unbundled.Basic
import Mathlib.Algebra.Order.Ring.Defs
import Mathlib.Algebra.Order.ZeroLEOne
import Mathlib.Data.Nat.Cast.Order
import Mathlib.Init.Data.Int.Order
set_option autoImplicit true
namespace Linarith
theorem lt_irrefl {α : Type u} [Preorder α] {a : α} : ¬a < a := _root_.lt_irrefl a
theorem eq_of_eq_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b = 0) : a + b = 0 := by
simp [*]
theorem le_of_eq_of_le {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b ≤ 0) : a + b ≤ 0 := by
simp [*]
theorem lt_of_eq_of_lt {α} [OrderedSemiring α] {a b : α} (ha : a = 0) (hb : b < 0) : a + b < 0 := by
simp [*]
theorem le_of_le_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a ≤ 0) (hb : b = 0) : a + b ≤ 0 := by
simp [*]
| Mathlib/Tactic/Linarith/Lemmas.lean | 39 | 40 | theorem lt_of_lt_of_eq {α} [OrderedSemiring α] {a b : α} (ha : a < 0) (hb : b = 0) : a + b < 0 := by |
simp [*]
| [
" a + b = 0",
" a + b ≤ 0",
" a + b < 0"
] | [
" a + b = 0",
" a + b ≤ 0",
" a + b < 0"
] |
import Mathlib.Analysis.InnerProductSpace.Spectrum
import Mathlib.Data.Matrix.Rank
import Mathlib.LinearAlgebra.Matrix.Diagonal
import Mathlib.LinearAlgebra.Matrix.Hermitian
#align_import linear_algebra.matrix.spectrum from "leanprover-community/mathlib"@"46b633fd842bef9469441c0209906f6dddd2b4f5"
namespace Matrix
variable {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]
variable {A : Matrix n n 𝕜}
namespace IsHermitian
section DecidableEq
variable [DecidableEq n]
variable (hA : A.IsHermitian)
noncomputable def eigenvalues₀ : Fin (Fintype.card n) → ℝ :=
(isHermitian_iff_isSymmetric.1 hA).eigenvalues finrank_euclideanSpace
#align matrix.is_hermitian.eigenvalues₀ Matrix.IsHermitian.eigenvalues₀
noncomputable def eigenvalues : n → ℝ := fun i =>
hA.eigenvalues₀ <| (Fintype.equivOfCardEq (Fintype.card_fin _)).symm i
#align matrix.is_hermitian.eigenvalues Matrix.IsHermitian.eigenvalues
noncomputable def eigenvectorBasis : OrthonormalBasis n 𝕜 (EuclideanSpace 𝕜 n) :=
((isHermitian_iff_isSymmetric.1 hA).eigenvectorBasis finrank_euclideanSpace).reindex
(Fintype.equivOfCardEq (Fintype.card_fin _))
#align matrix.is_hermitian.eigenvector_basis Matrix.IsHermitian.eigenvectorBasis
lemma mulVec_eigenvectorBasis (j : n) :
A *ᵥ ⇑(hA.eigenvectorBasis j) = (hA.eigenvalues j) • ⇑(hA.eigenvectorBasis j) := by
simpa only [eigenvectorBasis, OrthonormalBasis.reindex_apply, toEuclideanLin_apply,
RCLike.real_smul_eq_coe_smul (K := 𝕜)] using
congr(⇑$((isHermitian_iff_isSymmetric.1 hA).apply_eigenvectorBasis
finrank_euclideanSpace ((Fintype.equivOfCardEq (Fintype.card_fin _)).symm j)))
noncomputable def eigenvectorUnitary {𝕜 : Type*} [RCLike 𝕜] {n : Type*}
[Fintype n]{A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
Matrix.unitaryGroup n 𝕜 :=
⟨(EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis,
(EuclideanSpace.basisFun n 𝕜).toMatrix_orthonormalBasis_mem_unitary (eigenvectorBasis hA)⟩
#align matrix.is_hermitian.eigenvector_matrix Matrix.IsHermitian.eigenvectorUnitary
lemma eigenvectorUnitary_coe {𝕜 : Type*} [RCLike 𝕜] {n : Type*} [Fintype n]
{A : Matrix n n 𝕜} [DecidableEq n] (hA : Matrix.IsHermitian A) :
eigenvectorUnitary hA =
(EuclideanSpace.basisFun n 𝕜).toBasis.toMatrix (hA.eigenvectorBasis).toBasis :=
rfl
@[simp]
theorem eigenvectorUnitary_apply (i j : n) :
eigenvectorUnitary hA i j = ⇑(hA.eigenvectorBasis j) i :=
rfl
#align matrix.is_hermitian.eigenvector_matrix_apply Matrix.IsHermitian.eigenvectorUnitary_apply
theorem eigenvectorUnitary_mulVec (j : n) :
eigenvectorUnitary hA *ᵥ Pi.single j 1 = ⇑(hA.eigenvectorBasis j) := by
simp only [mulVec_single, eigenvectorUnitary_apply, mul_one]
| Mathlib/LinearAlgebra/Matrix/Spectrum.lean | 82 | 84 | theorem star_eigenvectorUnitary_mulVec (j : n) :
(star (eigenvectorUnitary hA : Matrix n n 𝕜)) *ᵥ ⇑(hA.eigenvectorBasis j) = Pi.single j 1 := by |
rw [← eigenvectorUnitary_mulVec, mulVec_mulVec, unitary.coe_star_mul_self, one_mulVec]
| [
" A *ᵥ (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j) =\n hA.eigenvalues j • (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)",
" ↑hA.eigenvectorUnitary *ᵥ Pi.single j 1 = (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)",
" star ↑hA.eigenvectorUn... | [
" A *ᵥ (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j) =\n hA.eigenvalues j • (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)",
" ↑hA.eigenvectorUnitary *ᵥ Pi.single j 1 = (WithLp.equiv 2 ((i : n) → (fun x => 𝕜) i)) (hA.eigenvectorBasis j)"
] |
import Mathlib.LinearAlgebra.Matrix.Trace
#align_import data.matrix.hadamard from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
variable {α β γ m n : Type*}
variable {R : Type*}
namespace Matrix
open Matrix
def hadamard [Mul α] (A : Matrix m n α) (B : Matrix m n α) : Matrix m n α :=
of fun i j => A i j * B i j
#align matrix.hadamard Matrix.hadamard
-- TODO: set as an equation lemma for `hadamard`, see mathlib4#3024
@[simp]
theorem hadamard_apply [Mul α] (A : Matrix m n α) (B : Matrix m n α) (i j) :
hadamard A B i j = A i j * B i j :=
rfl
#align matrix.hadamard_apply Matrix.hadamard_apply
scoped infixl:100 " ⊙ " => Matrix.hadamard
section BasicProperties
variable (A : Matrix m n α) (B : Matrix m n α) (C : Matrix m n α)
-- commutativity
theorem hadamard_comm [CommSemigroup α] : A ⊙ B = B ⊙ A :=
ext fun _ _ => mul_comm _ _
#align matrix.hadamard_comm Matrix.hadamard_comm
-- associativity
theorem hadamard_assoc [Semigroup α] : A ⊙ B ⊙ C = A ⊙ (B ⊙ C) :=
ext fun _ _ => mul_assoc _ _ _
#align matrix.hadamard_assoc Matrix.hadamard_assoc
-- distributivity
theorem hadamard_add [Distrib α] : A ⊙ (B + C) = A ⊙ B + A ⊙ C :=
ext fun _ _ => left_distrib _ _ _
#align matrix.hadamard_add Matrix.hadamard_add
theorem add_hadamard [Distrib α] : (B + C) ⊙ A = B ⊙ A + C ⊙ A :=
ext fun _ _ => right_distrib _ _ _
#align matrix.add_hadamard Matrix.add_hadamard
-- scalar multiplication
section One
variable [DecidableEq n] [MulZeroOneClass α]
variable (M : Matrix n n α)
theorem hadamard_one : M ⊙ (1 : Matrix n n α) = diagonal fun i => M i i := by
ext i j
by_cases h: i = j <;> simp [h]
#align matrix.hadamard_one Matrix.hadamard_one
| Mathlib/Data/Matrix/Hadamard.lean | 121 | 123 | theorem one_hadamard : (1 : Matrix n n α) ⊙ M = diagonal fun i => M i i := by |
ext i j
by_cases h : i = j <;> simp [h]
| [
" M ⊙ 1 = diagonal fun i => M i i",
" (M ⊙ 1) i j = diagonal (fun i => M i i) i j",
" 1 ⊙ M = diagonal fun i => M i i",
" (1 ⊙ M) i j = diagonal (fun i => M i i) i j"
] | [
" M ⊙ 1 = diagonal fun i => M i i",
" (M ⊙ 1) i j = diagonal (fun i => M i i) i j"
] |
import Mathlib.Algebra.Lie.Abelian
import Mathlib.Algebra.Lie.IdealOperations
import Mathlib.Order.Hom.Basic
#align_import algebra.lie.solvable from "leanprover-community/mathlib"@"a50170a88a47570ed186b809ca754110590f9476"
universe u v w w₁ w₂
variable (R : Type u) (L : Type v) (M : Type w) {L' : Type w₁}
variable [CommRing R] [LieRing L] [LieAlgebra R L] [LieRing L'] [LieAlgebra R L']
variable (I J : LieIdeal R L) {f : L' →ₗ⁅R⁆ L}
namespace LieAlgebra
def derivedSeriesOfIdeal (k : ℕ) : LieIdeal R L → LieIdeal R L :=
(fun I => ⁅I, I⁆)^[k]
#align lie_algebra.derived_series_of_ideal LieAlgebra.derivedSeriesOfIdeal
@[simp]
theorem derivedSeriesOfIdeal_zero : derivedSeriesOfIdeal R L 0 I = I :=
rfl
#align lie_algebra.derived_series_of_ideal_zero LieAlgebra.derivedSeriesOfIdeal_zero
@[simp]
theorem derivedSeriesOfIdeal_succ (k : ℕ) :
derivedSeriesOfIdeal R L (k + 1) I =
⁅derivedSeriesOfIdeal R L k I, derivedSeriesOfIdeal R L k I⁆ :=
Function.iterate_succ_apply' (fun I => ⁅I, I⁆) k I
#align lie_algebra.derived_series_of_ideal_succ LieAlgebra.derivedSeriesOfIdeal_succ
abbrev derivedSeries (k : ℕ) : LieIdeal R L :=
derivedSeriesOfIdeal R L k ⊤
#align lie_algebra.derived_series LieAlgebra.derivedSeries
theorem derivedSeries_def (k : ℕ) : derivedSeries R L k = derivedSeriesOfIdeal R L k ⊤ :=
rfl
#align lie_algebra.derived_series_def LieAlgebra.derivedSeries_def
variable {R L}
local notation "D" => derivedSeriesOfIdeal R L
theorem derivedSeriesOfIdeal_add (k l : ℕ) : D (k + l) I = D k (D l I) := by
induction' k with k ih
· rw [Nat.zero_add, derivedSeriesOfIdeal_zero]
· rw [Nat.succ_add k l, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ, ih]
#align lie_algebra.derived_series_of_ideal_add LieAlgebra.derivedSeriesOfIdeal_add
@[mono]
theorem derivedSeriesOfIdeal_le {I J : LieIdeal R L} {k l : ℕ} (h₁ : I ≤ J) (h₂ : l ≤ k) :
D k I ≤ D l J := by
revert l; induction' k with k ih <;> intro l h₂
· rw [le_zero_iff] at h₂; rw [h₂, derivedSeriesOfIdeal_zero]; exact h₁
· have h : l = k.succ ∨ l ≤ k := by rwa [le_iff_eq_or_lt, Nat.lt_succ_iff] at h₂
cases' h with h h
· rw [h, derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_succ]
exact LieSubmodule.mono_lie _ _ _ _ (ih (le_refl k)) (ih (le_refl k))
· rw [derivedSeriesOfIdeal_succ]; exact le_trans (LieSubmodule.lie_le_left _ _) (ih h)
#align lie_algebra.derived_series_of_ideal_le LieAlgebra.derivedSeriesOfIdeal_le
theorem derivedSeriesOfIdeal_succ_le (k : ℕ) : D (k + 1) I ≤ D k I :=
derivedSeriesOfIdeal_le (le_refl I) k.le_succ
#align lie_algebra.derived_series_of_ideal_succ_le LieAlgebra.derivedSeriesOfIdeal_succ_le
theorem derivedSeriesOfIdeal_le_self (k : ℕ) : D k I ≤ I :=
derivedSeriesOfIdeal_le (le_refl I) (zero_le k)
#align lie_algebra.derived_series_of_ideal_le_self LieAlgebra.derivedSeriesOfIdeal_le_self
theorem derivedSeriesOfIdeal_mono {I J : LieIdeal R L} (h : I ≤ J) (k : ℕ) : D k I ≤ D k J :=
derivedSeriesOfIdeal_le h (le_refl k)
#align lie_algebra.derived_series_of_ideal_mono LieAlgebra.derivedSeriesOfIdeal_mono
theorem derivedSeriesOfIdeal_antitone {k l : ℕ} (h : l ≤ k) : D k I ≤ D l I :=
derivedSeriesOfIdeal_le (le_refl I) h
#align lie_algebra.derived_series_of_ideal_antitone LieAlgebra.derivedSeriesOfIdeal_antitone
theorem derivedSeriesOfIdeal_add_le_add (J : LieIdeal R L) (k l : ℕ) :
D (k + l) (I + J) ≤ D k I + D l J := by
let D₁ : LieIdeal R L →o LieIdeal R L :=
{ toFun := fun I => ⁅I, I⁆
monotone' := fun I J h => LieSubmodule.mono_lie I J I J h h }
have h₁ : ∀ I J : LieIdeal R L, D₁ (I ⊔ J) ≤ D₁ I ⊔ J := by
simp [D₁, LieSubmodule.lie_le_right, LieSubmodule.lie_le_left, le_sup_of_le_right]
rw [← D₁.iterate_sup_le_sup_iff] at h₁
exact h₁ k l I J
#align lie_algebra.derived_series_of_ideal_add_le_add LieAlgebra.derivedSeriesOfIdeal_add_le_add
theorem derivedSeries_of_bot_eq_bot (k : ℕ) : derivedSeriesOfIdeal R L k ⊥ = ⊥ := by
rw [eq_bot_iff]; exact derivedSeriesOfIdeal_le_self ⊥ k
#align lie_algebra.derived_series_of_bot_eq_bot LieAlgebra.derivedSeries_of_bot_eq_bot
theorem abelian_iff_derived_one_eq_bot : IsLieAbelian I ↔ derivedSeriesOfIdeal R L 1 I = ⊥ := by
rw [derivedSeriesOfIdeal_succ, derivedSeriesOfIdeal_zero,
LieSubmodule.lie_abelian_iff_lie_self_eq_bot]
#align lie_algebra.abelian_iff_derived_one_eq_bot LieAlgebra.abelian_iff_derived_one_eq_bot
| Mathlib/Algebra/Lie/Solvable.lean | 136 | 138 | theorem abelian_iff_derived_succ_eq_bot (I : LieIdeal R L) (k : ℕ) :
IsLieAbelian (derivedSeriesOfIdeal R L k I) ↔ derivedSeriesOfIdeal R L (k + 1) I = ⊥ := by |
rw [add_comm, derivedSeriesOfIdeal_add I 1 k, abelian_iff_derived_one_eq_bot]
| [
" D (k + l) I = D k (D l I)",
" D (0 + l) I = D 0 (D l I)",
" D (k + 1 + l) I = D (k + 1) (D l I)",
" D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k → D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ 0 → D 0 I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k + 1 → D (k + 1) I ≤ D l J",
" D 0 I ≤ D l J",
" I ≤ D 0 J",
" D (k + 1) I ≤ D l J",
"... | [
" D (k + l) I = D k (D l I)",
" D (0 + l) I = D 0 (D l I)",
" D (k + 1 + l) I = D (k + 1) (D l I)",
" D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k → D k I ≤ D l J",
" ∀ {l : ℕ}, l ≤ 0 → D 0 I ≤ D l J",
" ∀ {l : ℕ}, l ≤ k + 1 → D (k + 1) I ≤ D l J",
" D 0 I ≤ D l J",
" I ≤ D 0 J",
" D (k + 1) I ≤ D l J",
"... |
import Mathlib.CategoryTheory.Limits.Shapes.CommSq
import Mathlib.CategoryTheory.Limits.Shapes.Diagonal
import Mathlib.CategoryTheory.MorphismProperty.Composition
universe v u
namespace CategoryTheory
open Limits
namespace MorphismProperty
variable {C : Type u} [Category.{v} C]
def StableUnderBaseChange (P : MorphismProperty C) : Prop :=
∀ ⦃X Y Y' S : C⦄ ⦃f : X ⟶ S⦄ ⦃g : Y ⟶ S⦄ ⦃f' : Y' ⟶ Y⦄ ⦃g' : Y' ⟶ X⦄ (_ : IsPullback f' g' g f)
(_ : P g), P g'
#align category_theory.morphism_property.stable_under_base_change CategoryTheory.MorphismProperty.StableUnderBaseChange
def StableUnderCobaseChange (P : MorphismProperty C) : Prop :=
∀ ⦃A A' B B' : C⦄ ⦃f : A ⟶ A'⦄ ⦃g : A ⟶ B⦄ ⦃f' : B ⟶ B'⦄ ⦃g' : A' ⟶ B'⦄ (_ : IsPushout g f f' g')
(_ : P f), P f'
#align category_theory.morphism_property.stable_under_cobase_change CategoryTheory.MorphismProperty.StableUnderCobaseChange
theorem StableUnderBaseChange.mk {P : MorphismProperty C} [HasPullbacks C] (hP₁ : RespectsIso P)
(hP₂ : ∀ (X Y S : C) (f : X ⟶ S) (g : Y ⟶ S) (_ : P g), P (pullback.fst : pullback f g ⟶ X)) :
StableUnderBaseChange P := fun X Y Y' S f g f' g' sq hg => by
let e := sq.flip.isoPullback
rw [← hP₁.cancel_left_isIso e.inv, sq.flip.isoPullback_inv_fst]
exact hP₂ _ _ _ f g hg
#align category_theory.morphism_property.stable_under_base_change.mk CategoryTheory.MorphismProperty.StableUnderBaseChange.mk
theorem StableUnderBaseChange.respectsIso {P : MorphismProperty C} (hP : StableUnderBaseChange P) :
RespectsIso P := by
apply RespectsIso.of_respects_arrow_iso
intro f g e
exact hP (IsPullback.of_horiz_isIso (CommSq.mk e.inv.w))
#align category_theory.morphism_property.stable_under_base_change.respects_iso CategoryTheory.MorphismProperty.StableUnderBaseChange.respectsIso
theorem StableUnderBaseChange.fst {P : MorphismProperty C} (hP : StableUnderBaseChange P)
{X Y S : C} (f : X ⟶ S) (g : Y ⟶ S) [HasPullback f g] (H : P g) :
P (pullback.fst : pullback f g ⟶ X) :=
hP (IsPullback.of_hasPullback f g).flip H
#align category_theory.morphism_property.stable_under_base_change.fst CategoryTheory.MorphismProperty.StableUnderBaseChange.fst
theorem StableUnderBaseChange.snd {P : MorphismProperty C} (hP : StableUnderBaseChange P)
{X Y S : C} (f : X ⟶ S) (g : Y ⟶ S) [HasPullback f g] (H : P f) :
P (pullback.snd : pullback f g ⟶ Y) :=
hP (IsPullback.of_hasPullback f g) H
#align category_theory.morphism_property.stable_under_base_change.snd CategoryTheory.MorphismProperty.StableUnderBaseChange.snd
theorem StableUnderBaseChange.baseChange_obj [HasPullbacks C] {P : MorphismProperty C}
(hP : StableUnderBaseChange P) {S S' : C} (f : S' ⟶ S) (X : Over S) (H : P X.hom) :
P ((Over.baseChange f).obj X).hom :=
hP.snd X.hom f H
#align category_theory.morphism_property.stable_under_base_change.base_change_obj CategoryTheory.MorphismProperty.StableUnderBaseChange.baseChange_obj
theorem StableUnderBaseChange.baseChange_map [HasPullbacks C] {P : MorphismProperty C}
(hP : StableUnderBaseChange P) {S S' : C} (f : S' ⟶ S) {X Y : Over S} (g : X ⟶ Y)
(H : P g.left) : P ((Over.baseChange f).map g).left := by
let e :=
pullbackRightPullbackFstIso Y.hom f g.left ≪≫
pullback.congrHom (g.w.trans (Category.comp_id _)) rfl
have : e.inv ≫ pullback.snd = ((Over.baseChange f).map g).left := by
ext <;> dsimp [e] <;> simp
rw [← this, hP.respectsIso.cancel_left_isIso]
exact hP.snd _ _ H
#align category_theory.morphism_property.stable_under_base_change.base_change_map CategoryTheory.MorphismProperty.StableUnderBaseChange.baseChange_map
| Mathlib/CategoryTheory/MorphismProperty/Limits.lean | 95 | 112 | theorem StableUnderBaseChange.pullback_map [HasPullbacks C] {P : MorphismProperty C}
(hP : StableUnderBaseChange P) [P.IsStableUnderComposition] {S X X' Y Y' : C} {f : X ⟶ S}
{g : Y ⟶ S} {f' : X' ⟶ S} {g' : Y' ⟶ S} {i₁ : X ⟶ X'} {i₂ : Y ⟶ Y'} (h₁ : P i₁) (h₂ : P i₂)
(e₁ : f = i₁ ≫ f') (e₂ : g = i₂ ≫ g') :
P (pullback.map f g f' g' i₁ i₂ (𝟙 _) ((Category.comp_id _).trans e₁)
((Category.comp_id _).trans e₂)) := by |
have :
pullback.map f g f' g' i₁ i₂ (𝟙 _) ((Category.comp_id _).trans e₁)
((Category.comp_id _).trans e₂) =
((pullbackSymmetry _ _).hom ≫
((Over.baseChange _).map (Over.homMk _ e₂.symm : Over.mk g ⟶ Over.mk g')).left) ≫
(pullbackSymmetry _ _).hom ≫
((Over.baseChange g').map (Over.homMk _ e₁.symm : Over.mk f ⟶ Over.mk f')).left := by
ext <;> dsimp <;> simp
rw [this]
apply P.comp_mem <;> rw [hP.respectsIso.cancel_left_isIso]
exacts [hP.baseChange_map _ (Over.homMk _ e₂.symm : Over.mk g ⟶ Over.mk g') h₂,
hP.baseChange_map _ (Over.homMk _ e₁.symm : Over.mk f ⟶ Over.mk f') h₁]
| [
" P g'",
" P pullback.fst",
" P.RespectsIso",
" ∀ (f g : Arrow C), (f ≅ g) → P f.hom → P g.hom",
" P f.hom → P g.hom",
" P ((Over.baseChange f).map g).left",
" e.inv ≫ pullback.snd = ((Over.baseChange f).map g).left",
" (e.inv ≫ pullback.snd) ≫ pullback.fst = ((Over.baseChange f).map g).left ≫ pullbac... | [
" P g'",
" P pullback.fst",
" P.RespectsIso",
" ∀ (f g : Arrow C), (f ≅ g) → P f.hom → P g.hom",
" P f.hom → P g.hom",
" P ((Over.baseChange f).map g).left",
" e.inv ≫ pullback.snd = ((Over.baseChange f).map g).left",
" (e.inv ≫ pullback.snd) ≫ pullback.fst = ((Over.baseChange f).map g).left ≫ pullbac... |
import Mathlib.Analysis.InnerProductSpace.Rayleigh
import Mathlib.Analysis.InnerProductSpace.PiL2
import Mathlib.Algebra.DirectSum.Decomposition
import Mathlib.LinearAlgebra.Eigenspace.Minpoly
#align_import analysis.inner_product_space.spectrum from "leanprover-community/mathlib"@"6b0169218d01f2837d79ea2784882009a0da1aa1"
variable {𝕜 : Type*} [RCLike 𝕜]
variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace 𝕜 E]
local notation "⟪" x ", " y "⟫" => @inner 𝕜 E _ x y
open scoped ComplexConjugate
open Module.End
namespace LinearMap
namespace IsSymmetric
variable {T : E →ₗ[𝕜] E} (hT : T.IsSymmetric)
theorem invariant_orthogonalComplement_eigenspace (μ : 𝕜) (v : E) (hv : v ∈ (eigenspace T μ)ᗮ) :
T v ∈ (eigenspace T μ)ᗮ := by
intro w hw
have : T w = (μ : 𝕜) • w := by rwa [mem_eigenspace_iff] at hw
simp [← hT w, this, inner_smul_left, hv w hw]
#align linear_map.is_symmetric.invariant_orthogonal_eigenspace LinearMap.IsSymmetric.invariant_orthogonalComplement_eigenspace
| Mathlib/Analysis/InnerProductSpace/Spectrum.lean | 76 | 79 | theorem conj_eigenvalue_eq_self {μ : 𝕜} (hμ : HasEigenvalue T μ) : conj μ = μ := by |
obtain ⟨v, hv₁, hv₂⟩ := hμ.exists_hasEigenvector
rw [mem_eigenspace_iff] at hv₁
simpa [hv₂, inner_smul_left, inner_smul_right, hv₁] using hT v v
| [
" T v ∈ (eigenspace T μ)ᗮ",
" ⟪w, T v⟫_𝕜 = 0",
" T w = μ • w",
" (starRingEnd 𝕜) μ = μ"
] | [
" T v ∈ (eigenspace T μ)ᗮ",
" ⟪w, T v⟫_𝕜 = 0",
" T w = μ • w"
] |
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
namespace IsBoundedLinearMap
def toLinearMap (f : E → F) (h : IsBoundedLinearMap 𝕜 f) : E →ₗ[𝕜] F :=
IsLinearMap.mk' _ h.toIsLinearMap
#align is_bounded_linear_map.to_linear_map IsBoundedLinearMap.toLinearMap
def toContinuousLinearMap {f : E → F} (hf : IsBoundedLinearMap 𝕜 f) : E →L[𝕜] F :=
{ toLinearMap f hf with
cont :=
let ⟨C, _, hC⟩ := hf.bound
AddMonoidHomClass.continuous_of_bound (toLinearMap f hf) C hC }
#align is_bounded_linear_map.to_continuous_linear_map IsBoundedLinearMap.toContinuousLinearMap
theorem zero : IsBoundedLinearMap 𝕜 fun _ : E => (0 : F) :=
(0 : E →ₗ[𝕜] F).isLinear.with_bound 0 <| by simp [le_refl]
#align is_bounded_linear_map.zero IsBoundedLinearMap.zero
theorem id : IsBoundedLinearMap 𝕜 fun x : E => x :=
LinearMap.id.isLinear.with_bound 1 <| by simp [le_refl]
#align is_bounded_linear_map.id IsBoundedLinearMap.id
theorem fst : IsBoundedLinearMap 𝕜 fun x : E × F => x.1 := by
refine (LinearMap.fst 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_left _ _
#align is_bounded_linear_map.fst IsBoundedLinearMap.fst
theorem snd : IsBoundedLinearMap 𝕜 fun x : E × F => x.2 := by
refine (LinearMap.snd 𝕜 E F).isLinear.with_bound 1 fun x => ?_
rw [one_mul]
exact le_max_right _ _
#align is_bounded_linear_map.snd IsBoundedLinearMap.snd
variable {f g : E → F}
theorem smul (c : 𝕜) (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 (c • f) :=
let ⟨hlf, M, _, hM⟩ := hf
(c • hlf.mk' f).isLinear.with_bound (‖c‖ * M) fun x =>
calc
‖c • f x‖ = ‖c‖ * ‖f x‖ := norm_smul c (f x)
_ ≤ ‖c‖ * (M * ‖x‖) := mul_le_mul_of_nonneg_left (hM _) (norm_nonneg _)
_ = ‖c‖ * M * ‖x‖ := (mul_assoc _ _ _).symm
#align is_bounded_linear_map.smul IsBoundedLinearMap.smul
| Mathlib/Analysis/NormedSpace/BoundedLinearMaps.lean | 139 | 141 | theorem neg (hf : IsBoundedLinearMap 𝕜 f) : IsBoundedLinearMap 𝕜 fun e => -f e := by |
rw [show (fun e => -f e) = fun e => (-1 : 𝕜) • f e by funext; simp]
exact smul (-1) hf
| [
" ∀ (x : E), ‖0 x‖ ≤ 0 * ‖x‖",
" ∀ (x : E), ‖LinearMap.id x‖ ≤ 1 * ‖x‖",
" IsBoundedLinearMap 𝕜 fun x => x.1",
" ‖(LinearMap.fst 𝕜 E F) x‖ ≤ 1 * ‖x‖",
" ‖(LinearMap.fst 𝕜 E F) x‖ ≤ ‖x‖",
" IsBoundedLinearMap 𝕜 fun x => x.2",
" ‖(LinearMap.snd 𝕜 E F) x‖ ≤ 1 * ‖x‖",
" ‖(LinearMap.snd 𝕜 E F) x‖ ≤ ‖... | [
" ∀ (x : E), ‖0 x‖ ≤ 0 * ‖x‖",
" ∀ (x : E), ‖LinearMap.id x‖ ≤ 1 * ‖x‖",
" IsBoundedLinearMap 𝕜 fun x => x.1",
" ‖(LinearMap.fst 𝕜 E F) x‖ ≤ 1 * ‖x‖",
" ‖(LinearMap.fst 𝕜 E F) x‖ ≤ ‖x‖",
" IsBoundedLinearMap 𝕜 fun x => x.2",
" ‖(LinearMap.snd 𝕜 E F) x‖ ≤ 1 * ‖x‖",
" ‖(LinearMap.snd 𝕜 E F) x‖ ≤ ‖... |
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.PEquiv
#align_import data.matrix.pequiv from "leanprover-community/mathlib"@"3e068ece210655b7b9a9477c3aff38a492400aa1"
namespace PEquiv
open Matrix
universe u v
variable {k l m n : Type*}
variable {α : Type v}
open Matrix
def toMatrix [DecidableEq n] [Zero α] [One α] (f : m ≃. n) : Matrix m n α :=
of fun i j => if j ∈ f i then (1 : α) else 0
#align pequiv.to_matrix PEquiv.toMatrix
-- TODO: set as an equation lemma for `toMatrix`, see mathlib4#3024
@[simp]
theorem toMatrix_apply [DecidableEq n] [Zero α] [One α] (f : m ≃. n) (i j) :
toMatrix f i j = if j ∈ f i then (1 : α) else 0 :=
rfl
#align pequiv.to_matrix_apply PEquiv.toMatrix_apply
theorem mul_matrix_apply [Fintype m] [DecidableEq m] [Semiring α] (f : l ≃. m) (M : Matrix m n α)
(i j) : (f.toMatrix * M :) i j = Option.casesOn (f i) 0 fun fi => M fi j := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f i with fi
· simp [h]
· rw [Finset.sum_eq_single fi] <;> simp (config := { contextual := true }) [h, eq_comm]
#align pequiv.mul_matrix_apply PEquiv.mul_matrix_apply
theorem toMatrix_symm [DecidableEq m] [DecidableEq n] [Zero α] [One α] (f : m ≃. n) :
(f.symm.toMatrix : Matrix n m α) = f.toMatrixᵀ := by
ext
simp only [transpose, mem_iff_mem f, toMatrix_apply]
congr
#align pequiv.to_matrix_symm PEquiv.toMatrix_symm
@[simp]
theorem toMatrix_refl [DecidableEq n] [Zero α] [One α] :
((PEquiv.refl n).toMatrix : Matrix n n α) = 1 := by
ext
simp [toMatrix_apply, one_apply]
#align pequiv.to_matrix_refl PEquiv.toMatrix_refl
theorem matrix_mul_apply [Fintype m] [Semiring α] [DecidableEq n] (M : Matrix l m α) (f : m ≃. n)
(i j) : (M * f.toMatrix :) i j = Option.casesOn (f.symm j) 0 fun fj => M i fj := by
dsimp [toMatrix, Matrix.mul_apply]
cases' h : f.symm j with fj
· simp [h, ← f.eq_some_iff]
· rw [Finset.sum_eq_single fj]
· simp [h, ← f.eq_some_iff]
· rintro b - n
simp [h, ← f.eq_some_iff, n.symm]
· simp
#align pequiv.matrix_mul_apply PEquiv.matrix_mul_apply
theorem toPEquiv_mul_matrix [Fintype m] [DecidableEq m] [Semiring α] (f : m ≃ m)
(M : Matrix m n α) : f.toPEquiv.toMatrix * M = M.submatrix f id := by
ext i j
rw [mul_matrix_apply, Equiv.toPEquiv_apply, submatrix_apply, id]
#align pequiv.to_pequiv_mul_matrix PEquiv.toPEquiv_mul_matrix
theorem mul_toPEquiv_toMatrix {m n α : Type*} [Fintype n] [DecidableEq n] [Semiring α] (f : n ≃ n)
(M : Matrix m n α) : M * f.toPEquiv.toMatrix = M.submatrix id f.symm :=
Matrix.ext fun i j => by
rw [PEquiv.matrix_mul_apply, ← Equiv.toPEquiv_symm, Equiv.toPEquiv_apply,
Matrix.submatrix_apply, id]
#align pequiv.mul_to_pequiv_to_matrix PEquiv.mul_toPEquiv_toMatrix
| Mathlib/Data/Matrix/PEquiv.lean | 109 | 114 | theorem toMatrix_trans [Fintype m] [DecidableEq m] [DecidableEq n] [Semiring α] (f : l ≃. m)
(g : m ≃. n) : ((f.trans g).toMatrix : Matrix l n α) = f.toMatrix * g.toMatrix := by |
ext i j
rw [mul_matrix_apply]
dsimp [toMatrix, PEquiv.trans]
cases f i <;> simp
| [
" (f.toMatrix * M) i j = Option.casesOn (f i) 0 fun fi => M fi j",
" ∑ j_1 : m, (if j_1 ∈ f i then 1 else 0) * M j_1 j = Option.rec 0 (fun val => M val j) (f i)",
" ∑ j_1 : m, (if j_1 ∈ none then 1 else 0) * M j_1 j = Option.rec 0 (fun val => M val j) none",
" ∑ j_1 : m, (if j_1 ∈ some fi then 1 else 0) * M j... | [
" (f.toMatrix * M) i j = Option.casesOn (f i) 0 fun fi => M fi j",
" ∑ j_1 : m, (if j_1 ∈ f i then 1 else 0) * M j_1 j = Option.rec 0 (fun val => M val j) (f i)",
" ∑ j_1 : m, (if j_1 ∈ none then 1 else 0) * M j_1 j = Option.rec 0 (fun val => M val j) none",
" ∑ j_1 : m, (if j_1 ∈ some fi then 1 else 0) * M j... |
import Mathlib.Init.Data.Nat.Notation
import Mathlib.Init.Order.Defs
set_option autoImplicit true
structure UFModel (n) where
parent : Fin n → Fin n
rank : Nat → Nat
rank_lt : ∀ i, (parent i).1 ≠ i → rank i < rank (parent i)
structure UFNode (α : Type*) where
parent : Nat
value : α
rank : Nat
inductive UFModel.Agrees (arr : Array α) (f : α → β) : ∀ {n}, (Fin n → β) → Prop
| mk : Agrees arr f fun i ↦ f (arr.get i)
namespace UFModel.Agrees
theorem mk' {arr : Array α} {f : α → β} {n} {g : Fin n → β} (e : n = arr.size)
(H : ∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = g ⟨i, h₂⟩) : Agrees arr f g := by
cases e
have : (fun i ↦ f (arr.get i)) = g := by funext ⟨i, h⟩; apply H
cases this; constructor
theorem size_eq {arr : Array α} {m : Fin n → β} (H : Agrees arr f m) : n = arr.size := by
cases H; rfl
| Mathlib/Data/UnionFind.lean | 82 | 84 | theorem get_eq {arr : Array α} {n} {m : Fin n → β} (H : Agrees arr f m) :
∀ i h₁ h₂, f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩ := by |
cases H; exact fun i h _ ↦ rfl
| [
" Agrees arr f g",
" (fun i => f (arr.get i)) = g",
" f (arr.get ⟨i, h⟩) = g ⟨i, h⟩",
" Agrees arr f fun i => f (arr.get i)",
" n = arr.size",
" arr.size = arr.size",
" ∀ (i : ℕ) (h₁ : i < arr.size) (h₂ : i < n), f (arr.get ⟨i, h₁⟩) = m ⟨i, h₂⟩",
" ∀ (i : ℕ) (h₁ h₂ : i < arr.size), f (arr.get ⟨i, h₁⟩)... | [
" Agrees arr f g",
" (fun i => f (arr.get i)) = g",
" f (arr.get ⟨i, h⟩) = g ⟨i, h⟩",
" Agrees arr f fun i => f (arr.get i)",
" n = arr.size",
" arr.size = arr.size"
] |
import Mathlib.LinearAlgebra.Prod
#align_import linear_algebra.linear_pmap from "leanprover-community/mathlib"@"8b981918a93bc45a8600de608cde7944a80d92b9"
universe u v w
structure LinearPMap (R : Type u) [Ring R] (E : Type v) [AddCommGroup E] [Module R E] (F : Type w)
[AddCommGroup F] [Module R F] where
domain : Submodule R E
toFun : domain →ₗ[R] F
#align linear_pmap LinearPMap
@[inherit_doc] notation:25 E " →ₗ.[" R:25 "] " F:0 => LinearPMap R E F
variable {R : Type*} [Ring R] {E : Type*} [AddCommGroup E] [Module R E] {F : Type*}
[AddCommGroup F] [Module R F] {G : Type*} [AddCommGroup G] [Module R G]
namespace LinearPMap
open Submodule
-- Porting note: A new definition underlying a coercion `↑`.
@[coe]
def toFun' (f : E →ₗ.[R] F) : f.domain → F := f.toFun
instance : CoeFun (E →ₗ.[R] F) fun f : E →ₗ.[R] F => f.domain → F :=
⟨toFun'⟩
@[simp]
theorem toFun_eq_coe (f : E →ₗ.[R] F) (x : f.domain) : f.toFun x = f x :=
rfl
#align linear_pmap.to_fun_eq_coe LinearPMap.toFun_eq_coe
@[ext]
theorem ext {f g : E →ₗ.[R] F} (h : f.domain = g.domain)
(h' : ∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y) : f = g := by
rcases f with ⟨f_dom, f⟩
rcases g with ⟨g_dom, g⟩
obtain rfl : f_dom = g_dom := h
obtain rfl : f = g := LinearMap.ext fun x => h' rfl
rfl
#align linear_pmap.ext LinearPMap.ext
@[simp]
theorem map_zero (f : E →ₗ.[R] F) : f 0 = 0 :=
f.toFun.map_zero
#align linear_pmap.map_zero LinearPMap.map_zero
theorem ext_iff {f g : E →ₗ.[R] F} :
f = g ↔
∃ _domain_eq : f.domain = g.domain,
∀ ⦃x : f.domain⦄ ⦃y : g.domain⦄ (_h : (x : E) = y), f x = g y :=
⟨fun EQ =>
EQ ▸
⟨rfl, fun x y h => by
congr
exact mod_cast h⟩,
fun ⟨deq, feq⟩ => ext deq feq⟩
#align linear_pmap.ext_iff LinearPMap.ext_iff
theorem ext' {s : Submodule R E} {f g : s →ₗ[R] F} (h : f = g) : mk s f = mk s g :=
h ▸ rfl
#align linear_pmap.ext' LinearPMap.ext'
theorem map_add (f : E →ₗ.[R] F) (x y : f.domain) : f (x + y) = f x + f y :=
f.toFun.map_add x y
#align linear_pmap.map_add LinearPMap.map_add
theorem map_neg (f : E →ₗ.[R] F) (x : f.domain) : f (-x) = -f x :=
f.toFun.map_neg x
#align linear_pmap.map_neg LinearPMap.map_neg
theorem map_sub (f : E →ₗ.[R] F) (x y : f.domain) : f (x - y) = f x - f y :=
f.toFun.map_sub x y
#align linear_pmap.map_sub LinearPMap.map_sub
theorem map_smul (f : E →ₗ.[R] F) (c : R) (x : f.domain) : f (c • x) = c • f x :=
f.toFun.map_smul c x
#align linear_pmap.map_smul LinearPMap.map_smul
@[simp]
theorem mk_apply (p : Submodule R E) (f : p →ₗ[R] F) (x : p) : mk p f x = f x :=
rfl
#align linear_pmap.mk_apply LinearPMap.mk_apply
noncomputable def mkSpanSingleton' (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
E →ₗ.[R] F where
domain := R ∙ x
toFun :=
have H : ∀ c₁ c₂ : R, c₁ • x = c₂ • x → c₁ • y = c₂ • y := by
intro c₁ c₂ h
rw [← sub_eq_zero, ← sub_smul] at h ⊢
exact H _ h
{ toFun := fun z => Classical.choose (mem_span_singleton.1 z.prop) • y
-- Porting note(#12129): additional beta reduction needed
-- Porting note: Were `Classical.choose_spec (mem_span_singleton.1 _)`.
map_add' := fun y z => by
beta_reduce
rw [← add_smul]
apply H
simp only [add_smul, sub_smul,
fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
apply coe_add
map_smul' := fun c z => by
beta_reduce
rw [smul_smul]
apply H
simp only [mul_smul,
fun w : R ∙ x => Classical.choose_spec (mem_span_singleton.1 w.prop)]
apply coe_smul }
#align linear_pmap.mk_span_singleton' LinearPMap.mkSpanSingleton'
@[simp]
theorem domain_mkSpanSingleton (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) :
(mkSpanSingleton' x y H).domain = R ∙ x :=
rfl
#align linear_pmap.domain_mk_span_singleton LinearPMap.domain_mkSpanSingleton
@[simp]
| Mathlib/LinearAlgebra/LinearPMap.lean | 151 | 157 | theorem mkSpanSingleton'_apply (x : E) (y : F) (H : ∀ c : R, c • x = 0 → c • y = 0) (c : R) (h) :
mkSpanSingleton' x y H ⟨c • x, h⟩ = c • y := by |
dsimp [mkSpanSingleton']
rw [← sub_eq_zero, ← sub_smul]
apply H
simp only [sub_smul, one_smul, sub_eq_zero]
apply Classical.choose_spec (mem_span_singleton.1 h)
| [
" f = g",
" { domain := f_dom, toFun := f } = g",
" { domain := f_dom, toFun := f } = { domain := g_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := f }",
" ↑f x = ↑f y",
" x = y",
" ∀ (c₁ c₂ : R),... | [
" f = g",
" { domain := f_dom, toFun := f } = g",
" { domain := f_dom, toFun := f } = { domain := g_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := g }",
" { domain := f_dom, toFun := f } = { domain := f_dom, toFun := f }",
" ↑f x = ↑f y",
" x = y",
" ∀ (c₁ c₂ : R),... |
import Mathlib.Topology.Order.ProjIcc
import Mathlib.Topology.CompactOpen
import Mathlib.Topology.UnitInterval
#align_import topology.path_connected from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
noncomputable section
open scoped Classical
open Topology Filter unitInterval Set Function
variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {x y z : X} {ι : Type*}
-- porting note (#5171): removed @[nolint has_nonempty_instance]
structure Path (x y : X) extends C(I, X) where
source' : toFun 0 = x
target' : toFun 1 = y
#align path Path
instance Path.funLike : FunLike (Path x y) I X where
coe := fun γ ↦ ⇑γ.toContinuousMap
coe_injective' := fun γ₁ γ₂ h => by
simp only [DFunLike.coe_fn_eq] at h
cases γ₁; cases γ₂; congr
-- Porting note (#10754): added this instance so that we can use `FunLike.coe` for `CoeFun`
-- this also fixed very strange `simp` timeout issues
instance Path.continuousMapClass : ContinuousMapClass (Path x y) I X where
map_continuous := fun γ => show Continuous γ.toContinuousMap by continuity
-- Porting note: not necessary in light of the instance above
@[ext]
protected theorem Path.ext : ∀ {γ₁ γ₂ : Path x y}, (γ₁ : I → X) = γ₂ → γ₁ = γ₂ := by
rintro ⟨⟨x, h11⟩, h12, h13⟩ ⟨⟨x, h21⟩, h22, h23⟩ rfl
rfl
#align path.ext Path.ext
namespace Path
@[simp]
theorem coe_mk_mk (f : I → X) (h₁) (h₂ : f 0 = x) (h₃ : f 1 = y) :
⇑(mk ⟨f, h₁⟩ h₂ h₃ : Path x y) = f :=
rfl
#align path.coe_mk Path.coe_mk_mk
-- Porting note: the name `Path.coe_mk` better refers to a new lemma below
variable (γ : Path x y)
@[continuity]
protected theorem continuous : Continuous γ :=
γ.continuous_toFun
#align path.continuous Path.continuous
@[simp]
protected theorem source : γ 0 = x :=
γ.source'
#align path.source Path.source
@[simp]
protected theorem target : γ 1 = y :=
γ.target'
#align path.target Path.target
def simps.apply : I → X :=
γ
#align path.simps.apply Path.simps.apply
initialize_simps_projections Path (toFun → simps.apply, -toContinuousMap)
@[simp]
theorem coe_toContinuousMap : ⇑γ.toContinuousMap = γ :=
rfl
#align path.coe_to_continuous_map Path.coe_toContinuousMap
-- Porting note: this is needed because of the `Path.continuousMapClass` instance
@[simp]
theorem coe_mk : ⇑(γ : C(I, X)) = γ :=
rfl
instance hasUncurryPath {X α : Type*} [TopologicalSpace X] {x y : α → X} :
HasUncurry (∀ a : α, Path (x a) (y a)) (α × I) X :=
⟨fun φ p => φ p.1 p.2⟩
#align path.has_uncurry_path Path.hasUncurryPath
@[refl, simps]
def refl (x : X) : Path x x where
toFun _t := x
continuous_toFun := continuous_const
source' := rfl
target' := rfl
#align path.refl Path.refl
@[simp]
| Mathlib/Topology/Connected/PathConnected.lean | 165 | 165 | theorem refl_range {a : X} : range (Path.refl a) = {a} := by | simp [Path.refl, CoeFun.coe]
| [
" γ₁ = γ₂",
" { toContinuousMap := toContinuousMap✝, source' := source'✝, target' := target'✝ } = γ₂",
" { toContinuousMap := toContinuousMap✝¹, source' := source'✝¹, target' := target'✝¹ } =\n { toContinuousMap := toContinuousMap✝, source' := source'✝, target' := target'✝ }",
" Continuous ⇑γ.toContinuousM... | [
" γ₁ = γ₂",
" { toContinuousMap := toContinuousMap✝, source' := source'✝, target' := target'✝ } = γ₂",
" { toContinuousMap := toContinuousMap✝¹, source' := source'✝¹, target' := target'✝¹ } =\n { toContinuousMap := toContinuousMap✝, source' := source'✝, target' := target'✝ }",
" Continuous ⇑γ.toContinuousM... |
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
| Mathlib/Algebra/Polynomial/Reverse.lean | 40 | 47 | 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
| [
" revAtFun N (revAtFun N i) = i",
" (if (if i ≤ N then N - i else i) ≤ N then N - if i ≤ N then N - i else i else if i ≤ N then N - i else i) = i",
" N - (N - i) = i",
" N - i = i",
" False",
" N - i ≤ N",
" i = i"
] | [] |
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Combinatorics.SimpleGraph.Dart
import Mathlib.Combinatorics.SimpleGraph.Finite
import Mathlib.Data.ZMod.Parity
#align_import combinatorics.simple_graph.degree_sum from "leanprover-community/mathlib"@"90659cbe25e59ec302e2fb92b00e9732160cc620"
open Finset
namespace SimpleGraph
universe u
variable {V : Type u} (G : SimpleGraph V)
section DegreeSum
variable [Fintype V] [DecidableRel G.Adj]
-- Porting note: Changed to `Fintype (Sym2 V)` to match Combinatorics.SimpleGraph.Basic
variable [Fintype (Sym2 V)]
theorem dart_fst_fiber [DecidableEq V] (v : V) :
(univ.filter fun d : G.Dart => d.fst = v) = univ.image (G.dartOfNeighborSet v) := by
ext d
simp only [mem_image, true_and_iff, mem_filter, SetCoe.exists, mem_univ, exists_prop_of_true]
constructor
· rintro rfl
exact ⟨_, d.adj, by ext <;> rfl⟩
· rintro ⟨e, he, rfl⟩
rfl
#align simple_graph.dart_fst_fiber SimpleGraph.dart_fst_fiber
theorem dart_fst_fiber_card_eq_degree [DecidableEq V] (v : V) :
(univ.filter fun d : G.Dart => d.fst = v).card = G.degree v := by
simpa only [dart_fst_fiber, Finset.card_univ, card_neighborSet_eq_degree] using
card_image_of_injective univ (G.dartOfNeighborSet_injective v)
#align simple_graph.dart_fst_fiber_card_eq_degree SimpleGraph.dart_fst_fiber_card_eq_degree
theorem dart_card_eq_sum_degrees : Fintype.card G.Dart = ∑ v, G.degree v := by
haveI := Classical.decEq V
simp only [← card_univ, ← dart_fst_fiber_card_eq_degree]
exact card_eq_sum_card_fiberwise (by simp)
#align simple_graph.dart_card_eq_sum_degrees SimpleGraph.dart_card_eq_sum_degrees
variable {G}
theorem Dart.edge_fiber [DecidableEq V] (d : G.Dart) :
(univ.filter fun d' : G.Dart => d'.edge = d.edge) = {d, d.symm} :=
Finset.ext fun d' => by simpa using dart_edge_eq_iff d' d
#align simple_graph.dart.edge_fiber SimpleGraph.Dart.edge_fiber
variable (G)
| Mathlib/Combinatorics/SimpleGraph/DegreeSum.lean | 88 | 95 | theorem dart_edge_fiber_card [DecidableEq V] (e : Sym2 V) (h : e ∈ G.edgeSet) :
(univ.filter fun d : G.Dart => d.edge = e).card = 2 := by |
refine Sym2.ind (fun v w h => ?_) e h
let d : G.Dart := ⟨(v, w), h⟩
convert congr_arg card d.edge_fiber
rw [card_insert_of_not_mem, card_singleton]
rw [mem_singleton]
exact d.symm_ne.symm
| [
" filter (fun d => d.toProd.1 = v) univ = image (G.dartOfNeighborSet v) univ",
" d ∈ filter (fun d => d.toProd.1 = v) univ ↔ d ∈ image (G.dartOfNeighborSet v) univ",
" d.toProd.1 = v ↔ ∃ x, ∃ (h : x ∈ G.neighborSet v), G.dartOfNeighborSet v ⟨x, h⟩ = d",
" d.toProd.1 = v → ∃ x, ∃ (h : x ∈ G.neighborSet v), G.d... | [
" filter (fun d => d.toProd.1 = v) univ = image (G.dartOfNeighborSet v) univ",
" d ∈ filter (fun d => d.toProd.1 = v) univ ↔ d ∈ image (G.dartOfNeighborSet v) univ",
" d.toProd.1 = v ↔ ∃ x, ∃ (h : x ∈ G.neighborSet v), G.dartOfNeighborSet v ⟨x, h⟩ = d",
" d.toProd.1 = v → ∃ x, ∃ (h : x ∈ G.neighborSet v), G.d... |
import Mathlib.Analysis.BoxIntegral.Partition.Basic
#align_import analysis.box_integral.partition.tagged from "leanprover-community/mathlib"@"6ca1a09bc9aa75824bf97388c9e3b441fc4ccf3f"
noncomputable section
open scoped Classical
open ENNReal NNReal
open Set Function
namespace BoxIntegral
variable {ι : Type*}
structure TaggedPrepartition (I : Box ι) extends Prepartition I where
tag : Box ι → ι → ℝ
tag_mem_Icc : ∀ J, tag J ∈ Box.Icc I
#align box_integral.tagged_prepartition BoxIntegral.TaggedPrepartition
namespace TaggedPrepartition
variable {I J J₁ J₂ : Box ι} (π : TaggedPrepartition I) {x : ι → ℝ}
instance : Membership (Box ι) (TaggedPrepartition I) :=
⟨fun J π => J ∈ π.boxes⟩
@[simp]
theorem mem_toPrepartition {π : TaggedPrepartition I} : J ∈ π.toPrepartition ↔ J ∈ π := Iff.rfl
#align box_integral.tagged_prepartition.mem_to_prepartition BoxIntegral.TaggedPrepartition.mem_toPrepartition
@[simp]
theorem mem_mk (π : Prepartition I) (f h) : J ∈ mk π f h ↔ J ∈ π := Iff.rfl
#align box_integral.tagged_prepartition.mem_mk BoxIntegral.TaggedPrepartition.mem_mk
def iUnion : Set (ι → ℝ) :=
π.toPrepartition.iUnion
#align box_integral.tagged_prepartition.Union BoxIntegral.TaggedPrepartition.iUnion
theorem iUnion_def : π.iUnion = ⋃ J ∈ π, ↑J := rfl
#align box_integral.tagged_prepartition.Union_def BoxIntegral.TaggedPrepartition.iUnion_def
@[simp]
theorem iUnion_mk (π : Prepartition I) (f h) : (mk π f h).iUnion = π.iUnion := rfl
#align box_integral.tagged_prepartition.Union_mk BoxIntegral.TaggedPrepartition.iUnion_mk
@[simp]
theorem iUnion_toPrepartition : π.toPrepartition.iUnion = π.iUnion := rfl
#align box_integral.tagged_prepartition.Union_to_prepartition BoxIntegral.TaggedPrepartition.iUnion_toPrepartition
-- Porting note: Previous proof was `:= Set.mem_iUnion₂`
@[simp]
| Mathlib/Analysis/BoxIntegral/Partition/Tagged.lean | 83 | 85 | theorem mem_iUnion : x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J := by |
convert Set.mem_iUnion₂
rw [Box.mem_coe, mem_toPrepartition, exists_prop]
| [
" x ∈ π.iUnion ↔ ∃ J ∈ π, x ∈ J",
" x✝ ∈ π ∧ x ∈ x✝ ↔ ∃ (_ : x✝ ∈ π.toPrepartition), x ∈ ↑x✝"
] | [] |
import Mathlib.GroupTheory.OrderOfElement
import Mathlib.RingTheory.Ideal.Maps
import Mathlib.RingTheory.Ideal.Quotient
#align_import algebra.char_p.quotient from "leanprover-community/mathlib"@"85e3c05a94b27c84dc6f234cf88326d5e0096ec3"
universe u v
| Mathlib/Algebra/CharP/Quotient.lean | 60 | 66 | theorem Ideal.Quotient.index_eq_zero {R : Type*} [CommRing R] (I : Ideal R) :
(↑I.toAddSubgroup.index : R ⧸ I) = 0 := by |
rw [AddSubgroup.index, Nat.card_eq]
split_ifs with hq; swap
· simp
letI : Fintype (R ⧸ I) := @Fintype.ofFinite _ hq
exact Nat.cast_card_eq_zero (R ⧸ I)
| [
" ↑(Submodule.toAddSubgroup I).index = 0",
" ↑(if h : Finite (R ⧸ Submodule.toAddSubgroup I) then Fintype.card (R ⧸ Submodule.toAddSubgroup I) else 0) = 0",
" ↑0 = 0",
" ↑(Fintype.card (R ⧸ Submodule.toAddSubgroup I)) = 0"
] | [] |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Jensen
import Mathlib.Analysis.Convex.Topology
import Mathlib.Analysis.Normed.Group.Pointwise
import Mathlib.Analysis.NormedSpace.AddTorsor
#align_import analysis.convex.normed from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {ι : Type*} {E P : Type*}
open Metric Set
open scoped Convex
variable [SeminormedAddCommGroup E] [NormedSpace ℝ E] [PseudoMetricSpace P] [NormedAddTorsor E P]
variable {s t : Set E}
| Mathlib/Analysis/Convex/Normed.lean | 39 | 44 | theorem convexOn_norm (hs : Convex ℝ s) : ConvexOn ℝ s norm :=
⟨hs, fun x _ y _ a b ha hb _ =>
calc
‖a • x + b • y‖ ≤ ‖a • x‖ + ‖b • y‖ := norm_add_le _ _
_ = a * ‖x‖ + b * ‖y‖ := by |
rw [norm_smul, norm_smul, Real.norm_of_nonneg ha, Real.norm_of_nonneg hb]⟩
| [
" ‖a • x‖ + ‖b • y‖ = a * ‖x‖ + b * ‖y‖"
] | [] |
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Cast
import Mathlib.Data.Nat.Choose.Vandermonde
import Mathlib.Tactic.FieldSimp
#align_import data.polynomial.hasse_deriv from "leanprover-community/mathlib"@"a148d797a1094ab554ad4183a4ad6f130358ef64"
noncomputable section
namespace Polynomial
open Nat Polynomial
open Function
variable {R : Type*} [Semiring R] (k : ℕ) (f : R[X])
def hasseDeriv (k : ℕ) : R[X] →ₗ[R] R[X] :=
lsum fun i => monomial (i - k) ∘ₗ DistribMulAction.toLinearMap R R (i.choose k)
#align polynomial.hasse_deriv Polynomial.hasseDeriv
theorem hasseDeriv_apply :
hasseDeriv k f = f.sum fun i r => monomial (i - k) (↑(i.choose k) * r) := by
dsimp [hasseDeriv]
congr; ext; congr
apply nsmul_eq_mul
#align polynomial.hasse_deriv_apply Polynomial.hasseDeriv_apply
theorem hasseDeriv_coeff (n : ℕ) :
(hasseDeriv k f).coeff n = (n + k).choose k * f.coeff (n + k) := by
rw [hasseDeriv_apply, coeff_sum, sum_def, Finset.sum_eq_single (n + k), coeff_monomial]
· simp only [if_true, add_tsub_cancel_right, eq_self_iff_true]
· intro i _hi hink
rw [coeff_monomial]
by_cases hik : i < k
· simp only [Nat.choose_eq_zero_of_lt hik, ite_self, Nat.cast_zero, zero_mul]
· push_neg at hik
rw [if_neg]
contrapose! hink
exact (tsub_eq_iff_eq_add_of_le hik).mp hink
· intro h
simp only [not_mem_support_iff.mp h, monomial_zero_right, mul_zero, coeff_zero]
#align polynomial.hasse_deriv_coeff Polynomial.hasseDeriv_coeff
theorem hasseDeriv_zero' : hasseDeriv 0 f = f := by
simp only [hasseDeriv_apply, tsub_zero, Nat.choose_zero_right, Nat.cast_one, one_mul,
sum_monomial_eq]
#align polynomial.hasse_deriv_zero' Polynomial.hasseDeriv_zero'
@[simp]
theorem hasseDeriv_zero : @hasseDeriv R _ 0 = LinearMap.id :=
LinearMap.ext <| hasseDeriv_zero'
#align polynomial.hasse_deriv_zero Polynomial.hasseDeriv_zero
theorem hasseDeriv_eq_zero_of_lt_natDegree (p : R[X]) (n : ℕ) (h : p.natDegree < n) :
hasseDeriv n p = 0 := by
rw [hasseDeriv_apply, sum_def]
refine Finset.sum_eq_zero fun x hx => ?_
simp [Nat.choose_eq_zero_of_lt ((le_natDegree_of_mem_supp _ hx).trans_lt h)]
#align polynomial.hasse_deriv_eq_zero_of_lt_nat_degree Polynomial.hasseDeriv_eq_zero_of_lt_natDegree
theorem hasseDeriv_one' : hasseDeriv 1 f = derivative f := by
simp only [hasseDeriv_apply, derivative_apply, ← C_mul_X_pow_eq_monomial, Nat.choose_one_right,
(Nat.cast_commute _ _).eq]
#align polynomial.hasse_deriv_one' Polynomial.hasseDeriv_one'
@[simp]
theorem hasseDeriv_one : @hasseDeriv R _ 1 = derivative :=
LinearMap.ext <| hasseDeriv_one'
#align polynomial.hasse_deriv_one Polynomial.hasseDeriv_one
@[simp]
theorem hasseDeriv_monomial (n : ℕ) (r : R) :
hasseDeriv k (monomial n r) = monomial (n - k) (↑(n.choose k) * r) := by
ext i
simp only [hasseDeriv_coeff, coeff_monomial]
by_cases hnik : n = i + k
· rw [if_pos hnik, if_pos, ← hnik]
apply tsub_eq_of_eq_add_rev
rwa [add_comm]
· rw [if_neg hnik, mul_zero]
by_cases hkn : k ≤ n
· rw [← tsub_eq_iff_eq_add_of_le hkn] at hnik
rw [if_neg hnik]
· push_neg at hkn
rw [Nat.choose_eq_zero_of_lt hkn, Nat.cast_zero, zero_mul, ite_self]
#align polynomial.hasse_deriv_monomial Polynomial.hasseDeriv_monomial
theorem hasseDeriv_C (r : R) (hk : 0 < k) : hasseDeriv k (C r) = 0 := by
rw [← monomial_zero_left, hasseDeriv_monomial, Nat.choose_eq_zero_of_lt hk, Nat.cast_zero,
zero_mul, monomial_zero_right]
set_option linter.uppercaseLean3 false in
#align polynomial.hasse_deriv_C Polynomial.hasseDeriv_C
theorem hasseDeriv_apply_one (hk : 0 < k) : hasseDeriv k (1 : R[X]) = 0 := by
rw [← C_1, hasseDeriv_C k _ hk]
#align polynomial.hasse_deriv_apply_one Polynomial.hasseDeriv_apply_one
theorem hasseDeriv_X (hk : 1 < k) : hasseDeriv k (X : R[X]) = 0 := by
rw [← monomial_one_one_eq_X, hasseDeriv_monomial, Nat.choose_eq_zero_of_lt hk, Nat.cast_zero,
zero_mul, monomial_zero_right]
set_option linter.uppercaseLean3 false in
#align polynomial.hasse_deriv_X Polynomial.hasseDeriv_X
| Mathlib/Algebra/Polynomial/HasseDeriv.lean | 143 | 161 | theorem factorial_smul_hasseDeriv : ⇑(k ! • @hasseDeriv R _ k) = (@derivative R _)^[k] := by |
induction' k with k ih
· rw [hasseDeriv_zero, factorial_zero, iterate_zero, one_smul, LinearMap.id_coe]
ext f n : 2
rw [iterate_succ_apply', ← ih]
simp only [LinearMap.smul_apply, coeff_smul, LinearMap.map_smul_of_tower, coeff_derivative,
hasseDeriv_coeff, ← @choose_symm_add _ k]
simp only [nsmul_eq_mul, factorial_succ, mul_assoc, succ_eq_add_one, ← add_assoc,
add_right_comm n 1 k, ← cast_succ]
rw [← (cast_commute (n + 1) (f.coeff (n + k + 1))).eq]
simp only [← mul_assoc]
norm_cast
congr 2
rw [mul_comm (k+1) _, mul_assoc, mul_assoc]
congr 1
have : n + k + 1 = n + (k + 1) := by apply add_assoc
rw [← choose_symm_of_eq_add this, choose_succ_right_eq, mul_comm]
congr
rw [add_assoc, add_tsub_cancel_left]
| [
" (hasseDeriv k) f = f.sum fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
" (f.sum fun x x_1 => (monomial (x - k)) (x.choose k • x_1)) = f.sum fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
" (fun x x_1 => (monomial (x - k)) (x.choose k • x_1)) = fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
"... | [
" (hasseDeriv k) f = f.sum fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
" (f.sum fun x x_1 => (monomial (x - k)) (x.choose k • x_1)) = f.sum fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
" (fun x x_1 => (monomial (x - k)) (x.choose k • x_1)) = fun i r => (monomial (i - k)) (↑(i.choose k) * r)",
"... |
import Mathlib.Control.Traversable.Instances
import Mathlib.Order.Filter.Basic
#align_import order.filter.basic from "leanprover-community/mathlib"@"d4f691b9e5f94cfc64639973f3544c95f8d5d494"
open Set List
namespace Filter
universe u
variable {α β γ : Type u} {f : β → Filter α} {s : γ → Set α}
theorem sequence_mono : ∀ as bs : List (Filter α), Forall₂ (· ≤ ·) as bs → sequence as ≤ sequence bs
| [], [], Forall₂.nil => le_rfl
| _::as, _::bs, Forall₂.cons h hs => seq_mono (map_mono h) (sequence_mono as bs hs)
#align filter.sequence_mono Filter.sequence_mono
theorem mem_traverse :
∀ (fs : List β) (us : List γ),
Forall₂ (fun b c => s c ∈ f b) fs us → traverse s us ∈ traverse f fs
| [], [], Forall₂.nil => mem_pure.2 <| mem_singleton _
| _::fs, _::us, Forall₂.cons h hs => seq_mem_seq (image_mem_map h) (mem_traverse fs us hs)
#align filter.mem_traverse Filter.mem_traverse
-- TODO: add a `Filter.HasBasis` statement
| Mathlib/Order/Filter/ListTraverse.lean | 38 | 53 | theorem mem_traverse_iff (fs : List β) (t : Set (List α)) :
t ∈ traverse f fs ↔
∃ us : List (Set α), Forall₂ (fun b (s : Set α) => s ∈ f b) fs us ∧ sequence us ⊆ t := by |
constructor
· induction fs generalizing t with
| nil =>
simp only [sequence, mem_pure, imp_self, forall₂_nil_left_iff, exists_eq_left, Set.pure_def,
singleton_subset_iff, traverse_nil]
| cons b fs ih =>
intro ht
rcases mem_seq_iff.1 ht with ⟨u, hu, v, hv, ht⟩
rcases mem_map_iff_exists_image.1 hu with ⟨w, hw, hwu⟩
rcases ih v hv with ⟨us, hus, hu⟩
exact ⟨w::us, Forall₂.cons hw hus, (Set.seq_mono hwu hu).trans ht⟩
· rintro ⟨us, hus, hs⟩
exact mem_of_superset (mem_traverse _ _ hus) hs
| [
" t ∈ traverse f fs ↔ ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t",
" t ∈ traverse f fs → ∃ us, Forall₂ (fun b s => s ∈ f b) fs us ∧ sequence us ⊆ t",
" t ∈ traverse f [] → ∃ us, Forall₂ (fun b s => s ∈ f b) [] us ∧ sequence us ⊆ t",
" t ∈ traverse f (b :: fs) → ∃ us, Forall₂ (fun b s => s ∈ f ... | [] |
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]
theorem unop_mem_unop {s : Set αᵒᵖ} {a : αᵒᵖ} : unop a ∈ s.unop ↔ a ∈ s := by rfl
#align set.unop_mem_unop Set.unop_mem_unop
@[simp]
theorem op_unop (s : Set α) : s.op.unop = s := rfl
#align set.op_unop Set.op_unop
@[simp]
theorem unop_op (s : Set αᵒᵖ) : s.unop.op = s := rfl
#align set.unop_op Set.unop_op
@[simps]
def opEquiv_self (s : Set α) : s.op ≃ s :=
⟨fun x ↦ ⟨unop x, x.2⟩, fun x ↦ ⟨op x, x.2⟩, fun _ ↦ rfl, fun _ ↦ rfl⟩
#align set.op_equiv_self Set.opEquiv_self
#align set.op_equiv_self_apply_coe Set.opEquiv_self_apply_coe
#align set.op_equiv_self_symm_apply_coe Set.opEquiv_self_symm_apply_coe
@[simps]
def opEquiv : Set α ≃ Set αᵒᵖ :=
⟨Set.op, Set.unop, op_unop, unop_op⟩
#align set.op_equiv Set.opEquiv
#align set.op_equiv_symm_apply Set.opEquiv_symm_apply
#align set.op_equiv_apply Set.opEquiv_apply
@[simp]
| Mathlib/Data/Set/Opposite.lean | 76 | 80 | theorem singleton_op (x : α) : ({x} : Set α).op = {op x} := by |
ext
constructor
· apply unop_injective
· apply op_injective
| [
" { unop := a } ∈ s.op ↔ a ∈ s",
" a.unop ∈ s.unop ↔ a ∈ s",
" {x}.op = {{ unop := x }}",
" x✝ ∈ {x}.op ↔ x✝ ∈ {{ unop := x }}",
" x✝ ∈ {x}.op → x✝ ∈ {{ unop := x }}",
" x✝ ∈ {{ unop := x }} → x✝ ∈ {x}.op"
] | [
" { unop := a } ∈ s.op ↔ a ∈ s",
" a.unop ∈ s.unop ↔ a ∈ s"
] |
import Mathlib.Algebra.CharP.Invertible
import Mathlib.Algebra.Order.Module.OrderedSMul
import Mathlib.Data.Complex.Cardinality
import Mathlib.Data.Fin.VecNotation
import Mathlib.LinearAlgebra.FiniteDimensional
#align_import data.complex.module from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
namespace Complex
open ComplexConjugate
open scoped SMul
variable {R : Type*} {S : Type*}
attribute [local ext] Complex.ext
-- Test that the `SMul ℚ ℂ` instance is correct.
example : (Complex.SMul.instSMulRealComplex : SMul ℚ ℂ) = (Algebra.toSMul : SMul ℚ ℂ) := rfl
-- priority manually adjusted in #11980
instance (priority := 90) [SMul R ℝ] [SMul S ℝ] [SMulCommClass R S ℝ] : SMulCommClass R S ℂ where
smul_comm r s x := by ext <;> simp [smul_re, smul_im, smul_comm]
-- priority manually adjusted in #11980
instance (priority := 90) [SMul R S] [SMul R ℝ] [SMul S ℝ] [IsScalarTower R S ℝ] :
IsScalarTower R S ℂ where
smul_assoc r s x := by ext <;> simp [smul_re, smul_im, smul_assoc]
-- priority manually adjusted in #11980
instance (priority := 90) [SMul R ℝ] [SMul Rᵐᵒᵖ ℝ] [IsCentralScalar R ℝ] :
IsCentralScalar R ℂ where
op_smul_eq_smul r x := by ext <;> simp [smul_re, smul_im, op_smul_eq_smul]
-- priority manually adjusted in #11980
instance (priority := 90) mulAction [Monoid R] [MulAction R ℝ] : MulAction R ℂ where
one_smul x := by ext <;> simp [smul_re, smul_im, one_smul]
mul_smul r s x := by ext <;> simp [smul_re, smul_im, mul_smul]
-- priority manually adjusted in #11980
instance (priority := 90) distribSMul [DistribSMul R ℝ] : DistribSMul R ℂ where
smul_add r x y := by ext <;> simp [smul_re, smul_im, smul_add]
smul_zero r := by ext <;> simp [smul_re, smul_im, smul_zero]
-- priority manually adjusted in #11980
instance (priority := 90) [Semiring R] [DistribMulAction R ℝ] : DistribMulAction R ℂ :=
{ Complex.distribSMul, Complex.mulAction with }
-- priority manually adjusted in #11980
instance (priority := 100) instModule [Semiring R] [Module R ℝ] : Module R ℂ where
add_smul r s x := by ext <;> simp [smul_re, smul_im, add_smul]
zero_smul r := by ext <;> simp [smul_re, smul_im, zero_smul]
-- priority manually adjusted in #11980
instance (priority := 95) instAlgebraOfReal [CommSemiring R] [Algebra R ℝ] : Algebra R ℂ :=
{ Complex.ofReal.comp (algebraMap R ℝ) with
smul := (· • ·)
smul_def' := fun r x => by ext <;> simp [smul_re, smul_im, Algebra.smul_def]
commutes' := fun r ⟨xr, xi⟩ => by ext <;> simp [smul_re, smul_im, Algebra.commutes] }
instance : StarModule ℝ ℂ :=
⟨fun r x => by simp only [star_def, star_trivial, real_smul, map_mul, conj_ofReal]⟩
@[simp]
theorem coe_algebraMap : (algebraMap ℝ ℂ : ℝ → ℂ) = ((↑) : ℝ → ℂ) :=
rfl
#align complex.coe_algebra_map Complex.coe_algebraMap
section
variable {A : Type*} [Semiring A] [Algebra ℝ A]
@[simp]
theorem _root_.AlgHom.map_coe_real_complex (f : ℂ →ₐ[ℝ] A) (x : ℝ) : f x = algebraMap ℝ A x :=
f.commutes x
#align alg_hom.map_coe_real_complex AlgHom.map_coe_real_complex
@[ext]
| Mathlib/Data/Complex/Module.lean | 125 | 127 | theorem algHom_ext ⦃f g : ℂ →ₐ[ℝ] A⦄ (h : f I = g I) : f = g := by |
ext ⟨x, y⟩
simp only [mk_eq_add_mul_I, AlgHom.map_add, AlgHom.map_coe_real_complex, AlgHom.map_mul, h]
| [
" r • s • x = s • r • x",
" (r • s • x).re = (s • r • x).re",
" (r • s • x).im = (s • r • x).im",
" (r • s) • x = r • s • x",
" ((r • s) • x).re = (r • s • x).re",
" ((r • s) • x).im = (r • s • x).im",
" MulOpposite.op r • x = r • x",
" (MulOpposite.op r • x).re = (r • x).re",
" (MulOpposite.op r • ... | [
" r • s • x = s • r • x",
" (r • s • x).re = (s • r • x).re",
" (r • s • x).im = (s • r • x).im",
" (r • s) • x = r • s • x",
" ((r • s) • x).re = (r • s • x).re",
" ((r • s) • x).im = (r • s • x).im",
" MulOpposite.op r • x = r • x",
" (MulOpposite.op r • x).re = (r • x).re",
" (MulOpposite.op r • ... |
import Batteries.Classes.SatisfiesM
namespace Array
theorem SatisfiesM_foldlM [Monad m] [LawfulMonad m]
{as : Array α} (motive : Nat → β → Prop) {init : β} (h0 : motive 0 init) {f : β → α → m β}
(hf : ∀ i : Fin as.size, ∀ b, motive i.1 b → SatisfiesM (motive (i.1 + 1)) (f b as[i])) :
SatisfiesM (motive as.size) (as.foldlM f init) := by
let rec go {i j b} (h₁ : j ≤ as.size) (h₂ : as.size ≤ i + j) (H : motive j b) :
SatisfiesM (motive as.size) (foldlM.loop f as as.size (Nat.le_refl _) i j b) := by
unfold foldlM.loop; split
· next hj =>
split
· cases Nat.not_le_of_gt (by simp [hj]) h₂
· exact (hf ⟨j, hj⟩ b H).bind fun _ => go hj (by rwa [Nat.succ_add] at h₂)
· next hj => exact Nat.le_antisymm h₁ (Nat.ge_of_not_lt hj) ▸ .pure H
simp [foldlM]; exact go (Nat.zero_le _) (Nat.le_refl _) h0
theorem SatisfiesM_mapM [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β)
(motive : Nat → Prop) (h0 : motive 0)
(p : Fin as.size → β → Prop)
(hs : ∀ i, motive i.1 → SatisfiesM (p i · ∧ motive (i + 1)) (f as[i])) :
SatisfiesM
(fun arr => motive as.size ∧ ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i])
(Array.mapM f as) := by
rw [mapM_eq_foldlM]
refine SatisfiesM_foldlM (m := m) (β := Array β)
(motive := fun i arr => motive i ∧ arr.size = i ∧ ∀ i h2, p i (arr[i.1]'h2)) ?z ?s
|>.imp fun ⟨h₁, eq, h₂⟩ => ⟨h₁, eq, fun _ _ => h₂ ..⟩
· case z => exact ⟨h0, rfl, nofun⟩
· case s =>
intro ⟨i, hi⟩ arr ⟨ih₁, eq, ih₂⟩
refine (hs _ ih₁).map fun ⟨h₁, h₂⟩ => ⟨h₂, by simp [eq], fun j hj => ?_⟩
simp [get_push] at hj ⊢; split; {apply ih₂}
cases j; cases (Nat.le_or_eq_of_le_succ hj).resolve_left ‹_›; cases eq; exact h₁
theorem SatisfiesM_mapM' [Monad m] [LawfulMonad m] (as : Array α) (f : α → m β)
(p : Fin as.size → β → Prop)
(hs : ∀ i, SatisfiesM (p i) (f as[i])) :
SatisfiesM
(fun arr => ∃ eq : arr.size = as.size, ∀ i h, p ⟨i, h⟩ arr[i])
(Array.mapM f as) :=
(SatisfiesM_mapM _ _ (fun _ => True) trivial _ (fun _ h => (hs _).imp (⟨·, h⟩))).imp (·.2)
theorem size_mapM [Monad m] [LawfulMonad m] (f : α → m β) (as : Array α) :
SatisfiesM (fun arr => arr.size = as.size) (Array.mapM f as) :=
(SatisfiesM_mapM' _ _ (fun _ _ => True) (fun _ => .trivial)).imp (·.1)
| .lake/packages/batteries/Batteries/Data/Array/Monadic.lean | 62 | 83 | theorem SatisfiesM_anyM [Monad m] [LawfulMonad m] (p : α → m Bool) (as : Array α) (start stop)
(hstart : start ≤ min stop as.size) (tru : Prop) (fal : Nat → Prop) (h0 : fal start)
(hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 →
SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) :
SatisfiesM
(fun res => bif res then tru else fal (min stop as.size))
(anyM p as start stop) := by |
let rec go {stop j} (hj' : j ≤ stop) (hstop : stop ≤ as.size) (h0 : fal j)
(hp : ∀ i : Fin as.size, i.1 < stop → fal i.1 →
SatisfiesM (bif · then tru else fal (i + 1)) (p as[i])) :
SatisfiesM
(fun res => bif res then tru else fal stop)
(anyM.loop p as stop hstop j) := by
unfold anyM.loop; split
· next hj =>
exact (hp ⟨j, Nat.lt_of_lt_of_le hj hstop⟩ hj h0).bind fun
| true, h => .pure h
| false, h => go hj hstop h hp
· next hj => exact .pure <| Nat.le_antisymm hj' (Nat.ge_of_not_lt hj) ▸ h0
termination_by stop - j
simp only [Array.anyM_eq_anyM_loop]
exact go hstart _ h0 fun i hi => hp i <| Nat.lt_of_lt_of_le hi <| Nat.min_le_left ..
| [
" SatisfiesM (motive as.size) (foldlM f init as 0)",
" SatisfiesM (motive as.size) (foldlM.loop f as as.size ⋯ i j b)",
" SatisfiesM (motive as.size)\n (if hlt : j < as.size then\n match i with\n | 0 => pure b\n | i'.succ =>\n let_fun this := ⋯;\n do\n let __do_lift ← f b ... | [
" SatisfiesM (motive as.size) (foldlM f init as 0)",
" SatisfiesM (motive as.size) (foldlM.loop f as as.size ⋯ i j b)",
" SatisfiesM (motive as.size)\n (if hlt : j < as.size then\n match i with\n | 0 => pure b\n | i'.succ =>\n let_fun this := ⋯;\n do\n let __do_lift ← f b ... |
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
import Mathlib.CategoryTheory.Conj
import Mathlib.CategoryTheory.Functor.ReflectsIso
#align_import category_theory.adjunction.reflective from "leanprover-community/mathlib"@"239d882c4fb58361ee8b3b39fb2091320edef10a"
universe v₁ v₂ v₃ u₁ u₂ u₃
noncomputable section
namespace CategoryTheory
open Category Adjunction
variable {C : Type u₁} {D : Type u₂} {E : Type u₃}
variable [Category.{v₁} C] [Category.{v₂} D] [Category.{v₃} E]
class Reflective (R : D ⥤ C) extends R.Full, R.Faithful where
L : C ⥤ D
adj : L ⊣ R
#align category_theory.reflective CategoryTheory.Reflective
variable (i : D ⥤ C)
def reflector [Reflective i] : C ⥤ D := Reflective.L (R := i)
def reflectorAdjunction [Reflective i] : reflector i ⊣ i := Reflective.adj
instance [Reflective i] : i.IsRightAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩
instance [Reflective i] : (reflector i).IsLeftAdjoint := ⟨_, ⟨reflectorAdjunction i⟩⟩
def Functor.fullyFaithfulOfReflective [Reflective i] : i.FullyFaithful :=
(reflectorAdjunction i).fullyFaithfulROfIsIsoCounit
-- TODO: This holds more generally for idempotent adjunctions, not just reflective adjunctions.
theorem unit_obj_eq_map_unit [Reflective i] (X : C) :
(reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) =
i.map ((reflector i).map ((reflectorAdjunction i).unit.app X)) := by
rw [← cancel_mono (i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X))),
← i.map_comp]
simp
#align category_theory.unit_obj_eq_map_unit CategoryTheory.unit_obj_eq_map_unit
example [Reflective i] {B : D} : IsIso ((reflectorAdjunction i).unit.app (i.obj B)) :=
inferInstance
variable {i}
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
IsIso ((reflectorAdjunction i).unit.app A) := by
rwa [isIso_unit_app_iff_mem_essImage]
#align category_theory.functor.ess_image.unit_is_iso CategoryTheory.Functor.essImage.unit_isIso
theorem mem_essImage_of_unit_isIso {L : C ⥤ D} (adj : L ⊣ i) (A : C)
[IsIso (adj.unit.app A)] : A ∈ i.essImage :=
⟨L.obj A, ⟨(asIso (adj.unit.app A)).symm⟩⟩
#align category_theory.mem_ess_image_of_unit_is_iso CategoryTheory.mem_essImage_of_unit_isIso
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
[IsSplitMono ((reflectorAdjunction i).unit.app A)] : A ∈ i.essImage := by
let η : 𝟭 C ⟶ reflector i ⋙ i := (reflectorAdjunction i).unit
haveI : IsIso (η.app (i.obj ((reflector i).obj A))) :=
Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
have : Epi (η.app A) := by
refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
apply epi_comp (η.app (i.obj ((reflector i).obj A)))
haveI := isIso_of_epi_of_isSplitMono (η.app A)
exact mem_essImage_of_unit_isIso (reflectorAdjunction i) A
#align category_theory.mem_ess_image_of_unit_is_split_mono CategoryTheory.mem_essImage_of_unit_isSplitMono
instance Reflective.comp (F : C ⥤ D) (G : D ⥤ E) [Reflective F] [Reflective G] :
Reflective (F ⋙ G) where
L := reflector G ⋙ reflector F
adj := (reflectorAdjunction G).comp (reflectorAdjunction F)
#align category_theory.reflective.comp CategoryTheory.Reflective.comp
def unitCompPartialBijectiveAux [Reflective i] (A : C) (B : D) :
(A ⟶ i.obj B) ≃ (i.obj ((reflector i).obj A) ⟶ i.obj B) :=
((reflectorAdjunction i).homEquiv _ _).symm.trans
(Functor.FullyFaithful.ofFullyFaithful i).homEquiv
#align category_theory.unit_comp_partial_bijective_aux CategoryTheory.unitCompPartialBijectiveAux
theorem unitCompPartialBijectiveAux_symm_apply [Reflective i] {A : C} {B : D}
(f : i.obj ((reflector i).obj A) ⟶ i.obj B) :
(unitCompPartialBijectiveAux _ _).symm f = (reflectorAdjunction i).unit.app A ≫ f := by
simp [unitCompPartialBijectiveAux]
#align category_theory.unit_comp_partial_bijective_aux_symm_apply CategoryTheory.unitCompPartialBijectiveAux_symm_apply
def unitCompPartialBijective [Reflective i] (A : C) {B : C} (hB : B ∈ i.essImage) :
(A ⟶ B) ≃ (i.obj ((reflector i).obj A) ⟶ B) :=
calc
(A ⟶ B) ≃ (A ⟶ i.obj (Functor.essImage.witness hB)) := Iso.homCongr (Iso.refl _) hB.getIso.symm
_ ≃ (i.obj _ ⟶ i.obj (Functor.essImage.witness hB)) := unitCompPartialBijectiveAux _ _
_ ≃ (i.obj ((reflector i).obj A) ⟶ B) :=
Iso.homCongr (Iso.refl _) (Functor.essImage.getIso hB)
#align category_theory.unit_comp_partial_bijective CategoryTheory.unitCompPartialBijective
@[simp]
| Mathlib/CategoryTheory/Adjunction/Reflective.lean | 154 | 156 | theorem unitCompPartialBijective_symm_apply [Reflective i] (A : C) {B : C} (hB : B ∈ i.essImage)
(f) : (unitCompPartialBijective A hB).symm f = (reflectorAdjunction i).unit.app A ≫ f := by |
simp [unitCompPartialBijective, unitCompPartialBijectiveAux_symm_apply]
| [
" (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) =\n i.map ((reflector i).map ((reflectorAdjunction i).unit.app X))",
" (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) ≫\n i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X)) =\n i.map\n ((reflector i).map... | [
" (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) =\n i.map ((reflector i).map ((reflectorAdjunction i).unit.app X))",
" (reflectorAdjunction i).unit.app (i.obj ((reflector i).obj X)) ≫\n i.map ((reflectorAdjunction i).counit.app ((reflector i).obj X)) =\n i.map\n ((reflector i).map... |
import Mathlib.Order.Filter.Cofinite
import Mathlib.Order.Hom.CompleteLattice
#align_import order.liminf_limsup from "leanprover-community/mathlib"@"ffde2d8a6e689149e44fd95fa862c23a57f8c780"
set_option autoImplicit true
open Filter Set Function
variable {α β γ ι ι' : Type*}
namespace Filter
section Relation
def IsBounded (r : α → α → Prop) (f : Filter α) :=
∃ b, ∀ᶠ x in f, r x b
#align filter.is_bounded Filter.IsBounded
def IsBoundedUnder (r : α → α → Prop) (f : Filter β) (u : β → α) :=
(map u f).IsBounded r
#align filter.is_bounded_under Filter.IsBoundedUnder
variable {r : α → α → Prop} {f g : Filter α}
theorem isBounded_iff : f.IsBounded r ↔ ∃ s ∈ f.sets, ∃ b, s ⊆ { x | r x b } :=
Iff.intro (fun ⟨b, hb⟩ => ⟨{ a | r a b }, hb, b, Subset.refl _⟩) fun ⟨_, hs, b, hb⟩ =>
⟨b, mem_of_superset hs hb⟩
#align filter.is_bounded_iff Filter.isBounded_iff
theorem isBoundedUnder_of {f : Filter β} {u : β → α} : (∃ b, ∀ x, r (u x) b) → f.IsBoundedUnder r u
| ⟨b, hb⟩ => ⟨b, show ∀ᶠ x in f, r (u x) b from eventually_of_forall hb⟩
#align filter.is_bounded_under_of Filter.isBoundedUnder_of
theorem isBounded_bot : IsBounded r ⊥ ↔ Nonempty α := by simp [IsBounded, exists_true_iff_nonempty]
#align filter.is_bounded_bot Filter.isBounded_bot
| Mathlib/Order/LiminfLimsup.lean | 80 | 80 | theorem isBounded_top : IsBounded r ⊤ ↔ ∃ t, ∀ x, r x t := by | simp [IsBounded, eq_univ_iff_forall]
| [
" IsBounded r ⊥ ↔ Nonempty α",
" IsBounded r ⊤ ↔ ∃ t, ∀ (x : α), r x t"
] | [
" IsBounded r ⊥ ↔ Nonempty α"
] |
import Mathlib.LinearAlgebra.Dimension.Free
import Mathlib.LinearAlgebra.Dimension.Finite
import Mathlib.LinearAlgebra.FreeModule.StrongRankCondition
open FiniteDimensional
namespace Subalgebra
variable {R S : Type*} [CommRing R] [CommRing S] [Algebra R S]
(A B : Subalgebra R S) [Module.Free R A] [Module.Free R B]
[Module.Free A (Algebra.adjoin A (B : Set S))]
[Module.Free B (Algebra.adjoin B (A : Set S))]
theorem rank_sup_eq_rank_left_mul_rank_of_free :
Module.rank R ↥(A ⊔ B) = Module.rank R A * Module.rank A (Algebra.adjoin A (B : Set S)) := by
rcases subsingleton_or_nontrivial R with _ | _
· haveI := Module.subsingleton R S; simp
nontriviality S using rank_subsingleton'
letI : Algebra A (Algebra.adjoin A (B : Set S)) := Subalgebra.algebra _
letI : SMul A (Algebra.adjoin A (B : Set S)) := Algebra.toSMul
haveI : IsScalarTower R A (Algebra.adjoin A (B : Set S)) :=
IsScalarTower.of_algebraMap_eq (congrFun rfl)
rw [rank_mul_rank R A (Algebra.adjoin A (B : Set S))]
change _ = Module.rank R ((Algebra.adjoin A (B : Set S)).restrictScalars R)
rw [Algebra.restrictScalars_adjoin]; rfl
theorem rank_sup_eq_rank_right_mul_rank_of_free :
Module.rank R ↥(A ⊔ B) = Module.rank R B * Module.rank B (Algebra.adjoin B (A : Set S)) := by
rw [sup_comm, rank_sup_eq_rank_left_mul_rank_of_free]
| Mathlib/Algebra/Algebra/Subalgebra/Rank.lean | 47 | 49 | theorem finrank_sup_eq_finrank_left_mul_finrank_of_free :
finrank R ↥(A ⊔ B) = finrank R A * finrank A (Algebra.adjoin A (B : Set S)) := by |
simpa only [map_mul] using congr(Cardinal.toNat $(rank_sup_eq_rank_left_mul_rank_of_free A B))
| [
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥A * Module.rank ↥A ↥(Algebra.adjoin ↥A ↑B)",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(Algebra.adjoin ↥A ↑B)",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(restrictScalars R (Algebra.adjoin ↥A ↑B))",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(Algebra.adjoin R (↑A ∪ ↑B)... | [
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥A * Module.rank ↥A ↥(Algebra.adjoin ↥A ↑B)",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(Algebra.adjoin ↥A ↑B)",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(restrictScalars R (Algebra.adjoin ↥A ↑B))",
" Module.rank R ↥(A ⊔ B) = Module.rank R ↥(Algebra.adjoin R (↑A ∪ ↑B)... |
import Mathlib.Algebra.BigOperators.Intervals
import Mathlib.Analysis.Normed.Group.Basic
import Mathlib.Topology.Instances.NNReal
#align_import analysis.normed.group.infinite_sum from "leanprover-community/mathlib"@"9a59dcb7a2d06bf55da57b9030169219980660cd"
open Topology NNReal
open Finset Filter Metric
variable {ι α E F : Type*} [SeminormedAddCommGroup E] [SeminormedAddCommGroup F]
theorem cauchySeq_finset_iff_vanishing_norm {f : ι → E} :
(CauchySeq fun s : Finset ι => ∑ i ∈ s, f i) ↔
∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by
rw [cauchySeq_finset_iff_sum_vanishing, nhds_basis_ball.forall_iff]
· simp only [ball_zero_eq, Set.mem_setOf_eq]
· rintro s t hst ⟨s', hs'⟩
exact ⟨s', fun t' ht' => hst <| hs' _ ht'⟩
#align cauchy_seq_finset_iff_vanishing_norm cauchySeq_finset_iff_vanishing_norm
| Mathlib/Analysis/Normed/Group/InfiniteSum.lean | 49 | 51 | theorem summable_iff_vanishing_norm [CompleteSpace E] {f : ι → E} :
Summable f ↔ ∀ ε > (0 : ℝ), ∃ s : Finset ι, ∀ t, Disjoint t s → ‖∑ i ∈ t, f i‖ < ε := by |
rw [summable_iff_cauchySeq_finset, cauchySeq_finset_iff_vanishing_norm]
| [
" (CauchySeq fun s => ∑ i ∈ s, f i) ↔ ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" (∀ (i : ℝ), 0 < i → ∃ s, ∀ (t : Finset ι), Disjoint t s → ∑ b ∈ t, f b ∈ ball 0 i) ↔\n ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" ∀ ⦃s t : Set E⦄,\n s ⊆ t →\n (∃ s_1,... | [
" (CauchySeq fun s => ∑ i ∈ s, f i) ↔ ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" (∀ (i : ℝ), 0 < i → ∃ s, ∀ (t : Finset ι), Disjoint t s → ∑ b ∈ t, f b ∈ ball 0 i) ↔\n ∀ ε > 0, ∃ s, ∀ (t : Finset ι), Disjoint t s → ‖∑ i ∈ t, f i‖ < ε",
" ∀ ⦃s t : Set E⦄,\n s ⊆ t →\n (∃ s_1,... |
import Mathlib.Probability.Martingale.Convergence
import Mathlib.Probability.Martingale.OptionalStopping
import Mathlib.Probability.Martingale.Centering
#align_import probability.martingale.borel_cantelli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
open Filter
open scoped NNReal ENNReal MeasureTheory ProbabilityTheory BigOperators Topology
namespace MeasureTheory
variable {Ω : Type*} {m0 : MeasurableSpace Ω} {μ : Measure Ω} {ℱ : Filtration ℕ m0} {f : ℕ → Ω → ℝ}
{ω : Ω}
-- TODO: `leastGE` should be defined taking values in `WithTop ℕ` once the `stoppedProcess`
-- refactor is complete
noncomputable def leastGE (f : ℕ → Ω → ℝ) (r : ℝ) (n : ℕ) :=
hitting f (Set.Ici r) 0 n
#align measure_theory.least_ge MeasureTheory.leastGE
theorem Adapted.isStoppingTime_leastGE (r : ℝ) (n : ℕ) (hf : Adapted ℱ f) :
IsStoppingTime ℱ (leastGE f r n) :=
hitting_isStoppingTime hf measurableSet_Ici
#align measure_theory.adapted.is_stopping_time_least_ge MeasureTheory.Adapted.isStoppingTime_leastGE
theorem leastGE_le {i : ℕ} {r : ℝ} (ω : Ω) : leastGE f r i ω ≤ i :=
hitting_le ω
#align measure_theory.least_ge_le MeasureTheory.leastGE_le
-- The following four lemmas shows `leastGE` behaves like a stopped process. Ideally we should
-- define `leastGE` as a stopping time and take its stopped process. However, we can't do that
-- with our current definition since a stopping time takes only finite indicies. An upcomming
-- refactor should hopefully make it possible to have stopping times taking infinity as a value
theorem leastGE_mono {n m : ℕ} (hnm : n ≤ m) (r : ℝ) (ω : Ω) : leastGE f r n ω ≤ leastGE f r m ω :=
hitting_mono hnm
#align measure_theory.least_ge_mono MeasureTheory.leastGE_mono
| Mathlib/Probability/Martingale/BorelCantelli.lean | 75 | 90 | theorem leastGE_eq_min (π : Ω → ℕ) (r : ℝ) (ω : Ω) {n : ℕ} (hπn : ∀ ω, π ω ≤ n) :
leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω) := by |
classical
refine le_antisymm (le_min (leastGE_le _) (leastGE_mono (hπn ω) r ω)) ?_
by_cases hle : π ω ≤ leastGE f r n ω
· rw [min_eq_left hle, leastGE]
by_cases h : ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r
· refine hle.trans (Eq.le ?_)
rw [leastGE, ← hitting_eq_hitting_of_exists (hπn ω) h]
· simp only [hitting, if_neg h, le_rfl]
· rw [min_eq_right (not_le.1 hle).le, leastGE, leastGE, ←
hitting_eq_hitting_of_exists (hπn ω) _]
rw [not_le, leastGE, hitting_lt_iff _ (hπn ω)] at hle
exact
let ⟨j, hj₁, hj₂⟩ := hle
⟨j, ⟨hj₁.1, hj₁.2.le⟩, hj₂⟩
| [
" leastGE f r (π ω) ω = min (π ω) (leastGE f r n ω)",
" min (π ω) (leastGE f r n ω) ≤ leastGE f r (π ω) ω",
" π ω ≤ hitting f (Set.Ici r) 0 (π ω) ω",
" leastGE f r n ω = hitting f (Set.Ici r) 0 (π ω) ω",
" ∃ j ∈ Set.Icc 0 (π ω), f j ω ∈ Set.Ici r"
] | [] |
import Mathlib.MeasureTheory.Function.LpSeminorm.Basic
import Mathlib.MeasureTheory.Integral.MeanInequalities
#align_import measure_theory.function.lp_seminorm from "leanprover-community/mathlib"@"c4015acc0a223449d44061e27ddac1835a3852b9"
open Filter
open scoped ENNReal Topology
namespace MeasureTheory
section SameSpace
variable {α E : Type*} {m : MeasurableSpace α} [NormedAddCommGroup E] {μ : Measure α} {f : α → E}
| Mathlib/MeasureTheory/Function/LpSeminorm/CompareExp.lean | 26 | 45 | theorem snorm'_le_snorm'_mul_rpow_measure_univ {p q : ℝ} (hp0_lt : 0 < p) (hpq : p ≤ q)
(hf : AEStronglyMeasurable f μ) :
snorm' f p μ ≤ snorm' f q μ * μ Set.univ ^ (1 / p - 1 / q) := by |
have hq0_lt : 0 < q := lt_of_lt_of_le hp0_lt hpq
by_cases hpq_eq : p = q
· rw [hpq_eq, sub_self, ENNReal.rpow_zero, mul_one]
have hpq : p < q := lt_of_le_of_ne hpq hpq_eq
let g := fun _ : α => (1 : ℝ≥0∞)
have h_rw : (∫⁻ a, (‖f a‖₊ : ℝ≥0∞) ^ p ∂μ) = ∫⁻ a, ((‖f a‖₊ : ℝ≥0∞) * g a) ^ p ∂μ :=
lintegral_congr fun a => by simp [g]
repeat' rw [snorm']
rw [h_rw]
let r := p * q / (q - p)
have hpqr : 1 / p = 1 / q + 1 / r := by field_simp [r, hp0_lt.ne', hq0_lt.ne']
calc
(∫⁻ a : α, (↑‖f a‖₊ * g a) ^ p ∂μ) ^ (1 / p) ≤
(∫⁻ a : α, ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q) * (∫⁻ a : α, g a ^ r ∂μ) ^ (1 / r) :=
ENNReal.lintegral_Lp_mul_le_Lq_mul_Lr hp0_lt hpq hpqr μ hf.ennnorm aemeasurable_const
_ = (∫⁻ a : α, ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q) * μ Set.univ ^ (1 / p - 1 / q) := by
rw [hpqr]; simp [r, g]
| [
" snorm' f p μ ≤ snorm' f q μ * μ Set.univ ^ (1 / p - 1 / q)",
" ↑‖f a‖₊ ^ p = (↑‖f a‖₊ * g a) ^ p",
" (∫⁻ (a : α), ↑‖f a‖₊ ^ p ∂μ) ^ (1 / p) ≤ snorm' f q μ * μ Set.univ ^ (1 / p - 1 / q)",
" (∫⁻ (a : α), ↑‖f a‖₊ ^ p ∂μ) ^ (1 / p) ≤ (∫⁻ (a : α), ↑‖f a‖₊ ^ q ∂μ) ^ (1 / q) * μ Set.univ ^ (1 / p - 1 / q)",
" (... | [] |
import Mathlib.Algebra.Polynomial.Expand
import Mathlib.Algebra.Polynomial.Laurent
import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic
import Mathlib.LinearAlgebra.Matrix.Reindex
import Mathlib.RingTheory.Polynomial.Nilpotent
#align_import linear_algebra.matrix.charpoly.coeff from "leanprover-community/mathlib"@"9745b093210e9dac443af24da9dba0f9e2b6c912"
noncomputable section
-- porting note: whenever there was `∏ i : n, X - C (M i i)`, I replaced it with
-- `∏ i : n, (X - C (M i i))`, since otherwise Lean would parse as `(∏ i : n, X) - C (M i i)`
universe u v w z
open Finset Matrix Polynomial
variable {R : Type u} [CommRing R]
variable {n G : Type v} [DecidableEq n] [Fintype n]
variable {α β : Type v} [DecidableEq α]
variable {M : Matrix n n R}
namespace Matrix
theorem charmatrix_apply_natDegree [Nontrivial R] (i j : n) :
(charmatrix M i j).natDegree = ite (i = j) 1 0 := by
by_cases h : i = j <;> simp [h, ← degree_eq_iff_natDegree_eq_of_pos (Nat.succ_pos 0)]
#align charmatrix_apply_nat_degree Matrix.charmatrix_apply_natDegree
theorem charmatrix_apply_natDegree_le (i j : n) :
(charmatrix M i j).natDegree ≤ ite (i = j) 1 0 := by
split_ifs with h <;> simp [h, natDegree_X_le]
#align charmatrix_apply_nat_degree_le Matrix.charmatrix_apply_natDegree_le
variable (M)
theorem charpoly_sub_diagonal_degree_lt :
(M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1) := by
rw [charpoly, det_apply', ← insert_erase (mem_univ (Equiv.refl n)),
sum_insert (not_mem_erase (Equiv.refl n) univ), add_comm]
simp only [charmatrix_apply_eq, one_mul, Equiv.Perm.sign_refl, id, Int.cast_one,
Units.val_one, add_sub_cancel_right, Equiv.coe_refl]
rw [← mem_degreeLT]
apply Submodule.sum_mem (degreeLT R (Fintype.card n - 1))
intro c hc; rw [← C_eq_intCast, C_mul']
apply Submodule.smul_mem (degreeLT R (Fintype.card n - 1)) ↑↑(Equiv.Perm.sign c)
rw [mem_degreeLT]
apply lt_of_le_of_lt degree_le_natDegree _
rw [Nat.cast_lt]
apply lt_of_le_of_lt _ (Equiv.Perm.fixed_point_card_lt_of_ne_one (ne_of_mem_erase hc))
apply le_trans (Polynomial.natDegree_prod_le univ fun i : n => charmatrix M (c i) i) _
rw [card_eq_sum_ones]; rw [sum_filter]; apply sum_le_sum
intros
apply charmatrix_apply_natDegree_le
#align matrix.charpoly_sub_diagonal_degree_lt Matrix.charpoly_sub_diagonal_degree_lt
theorem charpoly_coeff_eq_prod_coeff_of_le {k : ℕ} (h : Fintype.card n - 1 ≤ k) :
M.charpoly.coeff k = (∏ i : n, (X - C (M i i))).coeff k := by
apply eq_of_sub_eq_zero; rw [← coeff_sub]
apply Polynomial.coeff_eq_zero_of_degree_lt
apply lt_of_lt_of_le (charpoly_sub_diagonal_degree_lt M) ?_
rw [Nat.cast_le]; apply h
#align matrix.charpoly_coeff_eq_prod_coeff_of_le Matrix.charpoly_coeff_eq_prod_coeff_of_le
theorem det_of_card_zero (h : Fintype.card n = 0) (M : Matrix n n R) : M.det = 1 := by
rw [Fintype.card_eq_zero_iff] at h
suffices M = 1 by simp [this]
ext i
exact h.elim i
#align matrix.det_of_card_zero Matrix.det_of_card_zero
theorem charpoly_degree_eq_dim [Nontrivial R] (M : Matrix n n R) :
M.charpoly.degree = Fintype.card n := by
by_cases h : Fintype.card n = 0
· rw [h]
unfold charpoly
rw [det_of_card_zero]
· simp
· assumption
rw [← sub_add_cancel M.charpoly (∏ i : n, (X - C (M i i)))]
-- Porting note: added `↑` in front of `Fintype.card n`
have h1 : (∏ i : n, (X - C (M i i))).degree = ↑(Fintype.card n) := by
rw [degree_eq_iff_natDegree_eq_of_pos (Nat.pos_of_ne_zero h), natDegree_prod']
· simp_rw [natDegree_X_sub_C]
rw [← Finset.card_univ, sum_const, smul_eq_mul, mul_one]
simp_rw [(monic_X_sub_C _).leadingCoeff]
simp
rw [degree_add_eq_right_of_degree_lt]
· exact h1
rw [h1]
apply lt_trans (charpoly_sub_diagonal_degree_lt M)
rw [Nat.cast_lt]
rw [← Nat.pred_eq_sub_one]
apply Nat.pred_lt
apply h
#align matrix.charpoly_degree_eq_dim Matrix.charpoly_degree_eq_dim
@[simp] theorem charpoly_natDegree_eq_dim [Nontrivial R] (M : Matrix n n R) :
M.charpoly.natDegree = Fintype.card n :=
natDegree_eq_of_degree_eq_some (charpoly_degree_eq_dim M)
#align matrix.charpoly_nat_degree_eq_dim Matrix.charpoly_natDegree_eq_dim
| Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean | 127 | 145 | theorem charpoly_monic (M : Matrix n n R) : M.charpoly.Monic := by |
nontriviality R -- Porting note: was simply `nontriviality`
by_cases h : Fintype.card n = 0
· rw [charpoly, det_of_card_zero h]
apply monic_one
have mon : (∏ i : n, (X - C (M i i))).Monic := by
apply monic_prod_of_monic univ fun i : n => X - C (M i i)
simp [monic_X_sub_C]
rw [← sub_add_cancel (∏ i : n, (X - C (M i i))) M.charpoly] at mon
rw [Monic] at *
rwa [leadingCoeff_add_of_degree_lt] at mon
rw [charpoly_degree_eq_dim]
rw [← neg_sub]
rw [degree_neg]
apply lt_trans (charpoly_sub_diagonal_degree_lt M)
rw [Nat.cast_lt]
rw [← Nat.pred_eq_sub_one]
apply Nat.pred_lt
apply h
| [
" (M.charmatrix i j).natDegree = if i = j then 1 else 0",
" (M.charmatrix i j).natDegree ≤ if i = j then 1 else 0",
" (M.charmatrix i j).natDegree ≤ 1",
" (M.charmatrix i j).natDegree ≤ 0",
" (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1)",
" (∑ x ∈ univ.erase (Equiv.refl n), ↑↑(Eq... | [
" (M.charmatrix i j).natDegree = if i = j then 1 else 0",
" (M.charmatrix i j).natDegree ≤ if i = j then 1 else 0",
" (M.charmatrix i j).natDegree ≤ 1",
" (M.charmatrix i j).natDegree ≤ 0",
" (M.charpoly - ∏ i : n, (X - C (M i i))).degree < ↑(Fintype.card n - 1)",
" (∑ x ∈ univ.erase (Equiv.refl n), ↑↑(Eq... |
import Batteries.Data.Sum.Basic
import Batteries.Logic
open Function
namespace Sum
@[simp] protected theorem «forall» {p : α ⊕ β → Prop} :
(∀ x, p x) ↔ (∀ a, p (inl a)) ∧ ∀ b, p (inr b) :=
⟨fun h => ⟨fun _ => h _, fun _ => h _⟩, fun ⟨h₁, h₂⟩ => Sum.rec h₁ h₂⟩
@[simp] protected theorem «exists» {p : α ⊕ β → Prop} :
(∃ x, p x) ↔ (∃ a, p (inl a)) ∨ ∃ b, p (inr b) :=
⟨ fun
| ⟨inl a, h⟩ => Or.inl ⟨a, h⟩
| ⟨inr b, h⟩ => Or.inr ⟨b, h⟩,
fun
| Or.inl ⟨a, h⟩ => ⟨inl a, h⟩
| Or.inr ⟨b, h⟩ => ⟨inr b, h⟩⟩
theorem forall_sum {γ : α ⊕ β → Sort _} (p : (∀ ab, γ ab) → Prop) :
(∀ fab, p fab) ↔ (∀ fa fb, p (Sum.rec fa fb)) := by
refine ⟨fun h fa fb => h _, fun h fab => ?_⟩
have h1 : fab = Sum.rec (fun a => fab (Sum.inl a)) (fun b => fab (Sum.inr b)) := by
ext ab; cases ab <;> rfl
rw [h1]; exact h _ _
section get
@[simp] theorem inl_getLeft : ∀ (x : α ⊕ β) (h : x.isLeft), inl (x.getLeft h) = x
| inl _, _ => rfl
@[simp] theorem inr_getRight : ∀ (x : α ⊕ β) (h : x.isRight), inr (x.getRight h) = x
| inr _, _ => rfl
@[simp] theorem getLeft?_eq_none_iff {x : α ⊕ β} : x.getLeft? = none ↔ x.isRight := by
cases x <;> simp only [getLeft?, isRight, eq_self_iff_true]
@[simp] theorem getRight?_eq_none_iff {x : α ⊕ β} : x.getRight? = none ↔ x.isLeft := by
cases x <;> simp only [getRight?, isLeft, eq_self_iff_true]
theorem eq_left_getLeft_of_isLeft : ∀ {x : α ⊕ β} (h : x.isLeft), x = inl (x.getLeft h)
| inl _, _ => rfl
@[simp] theorem getLeft_eq_iff (h : x.isLeft) : x.getLeft h = a ↔ x = inl a := by
cases x <;> simp at h ⊢
theorem eq_right_getRight_of_isRight : ∀ {x : α ⊕ β} (h : x.isRight), x = inr (x.getRight h)
| inr _, _ => rfl
@[simp] theorem getRight_eq_iff (h : x.isRight) : x.getRight h = b ↔ x = inr b := by
cases x <;> simp at h ⊢
@[simp] theorem getLeft?_eq_some_iff : x.getLeft? = some a ↔ x = inl a := by
cases x <;> simp only [getLeft?, Option.some.injEq, inl.injEq]
@[simp] theorem getRight?_eq_some_iff : x.getRight? = some b ↔ x = inr b := by
cases x <;> simp only [getRight?, Option.some.injEq, inr.injEq]
@[simp] theorem bnot_isLeft (x : α ⊕ β) : !x.isLeft = x.isRight := by cases x <;> rfl
@[simp] theorem isLeft_eq_false {x : α ⊕ β} : x.isLeft = false ↔ x.isRight := by cases x <;> simp
theorem not_isLeft {x : α ⊕ β} : ¬x.isLeft ↔ x.isRight := by simp
@[simp] theorem bnot_isRight (x : α ⊕ β) : !x.isRight = x.isLeft := by cases x <;> rfl
@[simp] theorem isRight_eq_false {x : α ⊕ β} : x.isRight = false ↔ x.isLeft := by cases x <;> simp
theorem not_isRight {x : α ⊕ β} : ¬x.isRight ↔ x.isLeft := by simp
theorem isLeft_iff : x.isLeft ↔ ∃ y, x = Sum.inl y := by cases x <;> simp
| .lake/packages/batteries/Batteries/Data/Sum/Lemmas.lean | 85 | 85 | theorem isRight_iff : x.isRight ↔ ∃ y, x = Sum.inr y := by | cases x <;> simp
| [
" (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t",
" p fab",
" fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t",
" fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab",
" fab (inl val✝) = rec ... | [
" (∀ (fab : (ab : α ⊕ β) → γ ab), p fab) ↔\n ∀ (fa : (val : α) → γ (inl val)) (fb : (val : β) → γ (inr val)), p fun t => rec fa fb t",
" p fab",
" fab = fun t => rec (fun a => fab (inl a)) (fun b => fab (inr b)) t",
" fab ab = rec (fun a => fab (inl a)) (fun b => fab (inr b)) ab",
" fab (inl val✝) = rec ... |
import Mathlib.Data.ENNReal.Real
import Mathlib.Order.Interval.Finset.Nat
import Mathlib.Topology.UniformSpace.Pi
import Mathlib.Topology.UniformSpace.UniformConvergence
import Mathlib.Topology.UniformSpace.UniformEmbedding
#align_import topology.metric_space.emetric_space from "leanprover-community/mathlib"@"c8f305514e0d47dfaa710f5a52f0d21b588e6328"
open Set Filter Classical
open scoped Uniformity Topology Filter NNReal ENNReal Pointwise
universe u v w
variable {α : Type u} {β : Type v} {X : Type*}
theorem uniformity_dist_of_mem_uniformity [LinearOrder β] {U : Filter (α × α)} (z : β)
(D : α → α → β) (H : ∀ s, s ∈ U ↔ ∃ ε > z, ∀ {a b : α}, D a b < ε → (a, b) ∈ s) :
U = ⨅ ε > z, 𝓟 { p : α × α | D p.1 p.2 < ε } :=
HasBasis.eq_biInf ⟨fun s => by simp only [H, subset_def, Prod.forall, mem_setOf]⟩
#align uniformity_dist_of_mem_uniformity uniformity_dist_of_mem_uniformity
@[ext]
class EDist (α : Type*) where
edist : α → α → ℝ≥0∞
#align has_edist EDist
export EDist (edist)
def uniformSpaceOfEDist (edist : α → α → ℝ≥0∞) (edist_self : ∀ x : α, edist x x = 0)
(edist_comm : ∀ x y : α, edist x y = edist y x)
(edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z) : UniformSpace α :=
.ofFun edist edist_self edist_comm edist_triangle fun ε ε0 =>
⟨ε / 2, ENNReal.half_pos ε0.ne', fun _ h₁ _ h₂ =>
(ENNReal.add_lt_add h₁ h₂).trans_eq (ENNReal.add_halves _)⟩
#align uniform_space_of_edist uniformSpaceOfEDist
-- the uniform structure is embedded in the emetric space structure
-- to avoid instance diamond issues. See Note [forgetful inheritance].
class PseudoEMetricSpace (α : Type u) extends EDist α : Type u where
edist_self : ∀ x : α, edist x x = 0
edist_comm : ∀ x y : α, edist x y = edist y x
edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z
toUniformSpace : UniformSpace α := uniformSpaceOfEDist edist edist_self edist_comm edist_triangle
uniformity_edist : 𝓤 α = ⨅ ε > 0, 𝓟 { p : α × α | edist p.1 p.2 < ε } := by rfl
#align pseudo_emetric_space PseudoEMetricSpace
attribute [instance] PseudoEMetricSpace.toUniformSpace
@[ext]
protected theorem PseudoEMetricSpace.ext {α : Type*} {m m' : PseudoEMetricSpace α}
(h : m.toEDist = m'.toEDist) : m = m' := by
cases' m with ed _ _ _ U hU
cases' m' with ed' _ _ _ U' hU'
congr 1
exact UniformSpace.ext (((show ed = ed' from h) ▸ hU).trans hU'.symm)
variable [PseudoEMetricSpace α]
export PseudoEMetricSpace (edist_self edist_comm edist_triangle)
attribute [simp] edist_self
theorem edist_triangle_left (x y z : α) : edist x y ≤ edist z x + edist z y := by
rw [edist_comm z]; apply edist_triangle
#align edist_triangle_left edist_triangle_left
theorem edist_triangle_right (x y z : α) : edist x y ≤ edist x z + edist y z := by
rw [edist_comm y]; apply edist_triangle
#align edist_triangle_right edist_triangle_right
theorem edist_congr_right {x y z : α} (h : edist x y = 0) : edist x z = edist y z := by
apply le_antisymm
· rw [← zero_add (edist y z), ← h]
apply edist_triangle
· rw [edist_comm] at h
rw [← zero_add (edist x z), ← h]
apply edist_triangle
#align edist_congr_right edist_congr_right
| Mathlib/Topology/EMetricSpace/Basic.lean | 127 | 129 | theorem edist_congr_left {x y z : α} (h : edist x y = 0) : edist z x = edist z y := by |
rw [edist_comm z x, edist_comm z y]
apply edist_congr_right h
| [
" s ∈ U ↔ ∃ i > z, {p | D p.1 p.2 < i} ⊆ s",
" m = m'",
" mk edist_self✝ edist_comm✝ edist_triangle✝ U hU = m'",
" mk edist_self✝¹ edist_comm✝¹ edist_triangle✝¹ U hU = mk edist_self✝ edist_comm✝ edist_triangle✝ U' hU'",
" U = U'",
" edist x y ≤ edist z x + edist z y",
" edist x y ≤ edist x z + edist z y... | [
" s ∈ U ↔ ∃ i > z, {p | D p.1 p.2 < i} ⊆ s",
" m = m'",
" mk edist_self✝ edist_comm✝ edist_triangle✝ U hU = m'",
" mk edist_self✝¹ edist_comm✝¹ edist_triangle✝¹ U hU = mk edist_self✝ edist_comm✝ edist_triangle✝ U' hU'",
" U = U'",
" edist x y ≤ edist z x + edist z y",
" edist x y ≤ edist x z + edist z y... |
import Mathlib.LinearAlgebra.AffineSpace.Independent
import Mathlib.LinearAlgebra.Basis
#align_import linear_algebra.affine_space.basis from "leanprover-community/mathlib"@"2de9c37fa71dde2f1c6feff19876dd6a7b1519f0"
open Affine
open Set
universe u₁ u₂ u₃ u₄
structure AffineBasis (ι : Type u₁) (k : Type u₂) {V : Type u₃} (P : Type u₄) [AddCommGroup V]
[AffineSpace V P] [Ring k] [Module k V] where
protected toFun : ι → P
protected ind' : AffineIndependent k toFun
protected tot' : affineSpan k (range toFun) = ⊤
#align affine_basis AffineBasis
variable {ι ι' k V P : Type*} [AddCommGroup V] [AffineSpace V P]
namespace AffineBasis
section Ring
variable [Ring k] [Module k V] (b : AffineBasis ι k P) {s : Finset ι} {i j : ι} (e : ι ≃ ι')
instance : Inhabited (AffineBasis PUnit k PUnit) :=
⟨⟨id, affineIndependent_of_subsingleton k id, by simp⟩⟩
instance instFunLike : FunLike (AffineBasis ι k P) ι P where
coe := AffineBasis.toFun
coe_injective' f g h := by cases f; cases g; congr
#align affine_basis.fun_like AffineBasis.instFunLike
@[ext]
theorem ext {b₁ b₂ : AffineBasis ι k P} (h : (b₁ : ι → P) = b₂) : b₁ = b₂ :=
DFunLike.coe_injective h
#align affine_basis.ext AffineBasis.ext
theorem ind : AffineIndependent k b :=
b.ind'
#align affine_basis.ind AffineBasis.ind
theorem tot : affineSpan k (range b) = ⊤ :=
b.tot'
#align affine_basis.tot AffineBasis.tot
protected theorem nonempty : Nonempty ι :=
not_isEmpty_iff.mp fun hι => by
simpa only [@range_eq_empty _ _ hι, AffineSubspace.span_empty, bot_ne_top] using b.tot
#align affine_basis.nonempty AffineBasis.nonempty
def reindex (e : ι ≃ ι') : AffineBasis ι' k P :=
⟨b ∘ e.symm, b.ind.comp_embedding e.symm.toEmbedding, by
rw [e.symm.surjective.range_comp]
exact b.3⟩
#align affine_basis.reindex AffineBasis.reindex
@[simp, norm_cast]
theorem coe_reindex : ⇑(b.reindex e) = b ∘ e.symm :=
rfl
#align affine_basis.coe_reindex AffineBasis.coe_reindex
@[simp]
theorem reindex_apply (i' : ι') : b.reindex e i' = b (e.symm i') :=
rfl
#align affine_basis.reindex_apply AffineBasis.reindex_apply
@[simp]
theorem reindex_refl : b.reindex (Equiv.refl _) = b :=
ext rfl
#align affine_basis.reindex_refl AffineBasis.reindex_refl
noncomputable def basisOf (i : ι) : Basis { j : ι // j ≠ i } k V :=
Basis.mk ((affineIndependent_iff_linearIndependent_vsub k b i).mp b.ind)
(by
suffices
Submodule.span k (range fun j : { x // x ≠ i } => b ↑j -ᵥ b i) = vectorSpan k (range b) by
rw [this, ← direction_affineSpan, b.tot, AffineSubspace.direction_top]
conv_rhs => rw [← image_univ]
rw [vectorSpan_image_eq_span_vsub_set_right_ne k b (mem_univ i)]
congr
ext v
simp)
#align affine_basis.basis_of AffineBasis.basisOf
@[simp]
| Mathlib/LinearAlgebra/AffineSpace/Basis.lean | 134 | 135 | theorem basisOf_apply (i : ι) (j : { j : ι // j ≠ i }) : b.basisOf i j = b ↑j -ᵥ b i := by |
simp [basisOf]
| [
" affineSpan k (range id) = ⊤",
" f = g",
" { toFun := toFun✝, ind' := ind'✝, tot' := tot'✝ } = g",
" { toFun := toFun✝¹, ind' := ind'✝¹, tot' := tot'✝¹ } = { toFun := toFun✝, ind' := ind'✝, tot' := tot'✝ }",
" False",
" affineSpan k (range (⇑b ∘ ⇑e.symm)) = ⊤",
" affineSpan k (range ⇑b) = ⊤",
" ⊤ ≤ S... | [
" affineSpan k (range id) = ⊤",
" f = g",
" { toFun := toFun✝, ind' := ind'✝, tot' := tot'✝ } = g",
" { toFun := toFun✝¹, ind' := ind'✝¹, tot' := tot'✝¹ } = { toFun := toFun✝, ind' := ind'✝, tot' := tot'✝ }",
" False",
" affineSpan k (range (⇑b ∘ ⇑e.symm)) = ⊤",
" affineSpan k (range ⇑b) = ⊤",
" ⊤ ≤ S... |
import Mathlib.Order.CompleteLattice
import Mathlib.Data.Finset.Lattice
import Mathlib.CategoryTheory.Limits.Shapes.Pullbacks
import Mathlib.CategoryTheory.Category.Preorder
import Mathlib.CategoryTheory.Limits.Shapes.Products
import Mathlib.CategoryTheory.Limits.Shapes.FiniteLimits
#align_import category_theory.limits.lattice from "leanprover-community/mathlib"@"c3019c79074b0619edb4b27553a91b2e82242395"
universe w u
open CategoryTheory
open CategoryTheory.Limits
namespace CategoryTheory.Limits.CompleteLattice
section Semilattice
variable {α : Type u}
variable {J : Type w} [SmallCategory J] [FinCategory J]
def finiteLimitCone [SemilatticeInf α] [OrderTop α] (F : J ⥤ α) : LimitCone F where
cone :=
{ pt := Finset.univ.inf F.obj
π := { app := fun j => homOfLE (Finset.inf_le (Fintype.complete _)) } }
isLimit := { lift := fun s => homOfLE (Finset.le_inf fun j _ => (s.π.app j).down.down) }
#align category_theory.limits.complete_lattice.finite_limit_cone CategoryTheory.Limits.CompleteLattice.finiteLimitCone
def finiteColimitCocone [SemilatticeSup α] [OrderBot α] (F : J ⥤ α) : ColimitCocone F where
cocone :=
{ pt := Finset.univ.sup F.obj
ι := { app := fun i => homOfLE (Finset.le_sup (Fintype.complete _)) } }
isColimit := { desc := fun s => homOfLE (Finset.sup_le fun j _ => (s.ι.app j).down.down) }
#align category_theory.limits.complete_lattice.finite_colimit_cocone CategoryTheory.Limits.CompleteLattice.finiteColimitCocone
-- see Note [lower instance priority]
instance (priority := 100) hasFiniteLimits_of_semilatticeInf_orderTop [SemilatticeInf α]
[OrderTop α] : HasFiniteLimits α := ⟨by
intro J 𝒥₁ 𝒥₂
exact { has_limit := fun F => HasLimit.mk (finiteLimitCone F) }⟩
#align category_theory.limits.complete_lattice.has_finite_limits_of_semilattice_inf_order_top CategoryTheory.Limits.CompleteLattice.hasFiniteLimits_of_semilatticeInf_orderTop
-- see Note [lower instance priority]
instance (priority := 100) hasFiniteColimits_of_semilatticeSup_orderBot [SemilatticeSup α]
[OrderBot α] : HasFiniteColimits α := ⟨by
intro J 𝒥₁ 𝒥₂
exact { has_colimit := fun F => HasColimit.mk (finiteColimitCocone F) }⟩
#align category_theory.limits.complete_lattice.has_finite_colimits_of_semilattice_sup_order_bot CategoryTheory.Limits.CompleteLattice.hasFiniteColimits_of_semilatticeSup_orderBot
theorem finite_limit_eq_finset_univ_inf [SemilatticeInf α] [OrderTop α] (F : J ⥤ α) :
limit F = Finset.univ.inf F.obj :=
(IsLimit.conePointUniqueUpToIso (limit.isLimit F) (finiteLimitCone F).isLimit).to_eq
#align category_theory.limits.complete_lattice.finite_limit_eq_finset_univ_inf CategoryTheory.Limits.CompleteLattice.finite_limit_eq_finset_univ_inf
theorem finite_colimit_eq_finset_univ_sup [SemilatticeSup α] [OrderBot α] (F : J ⥤ α) :
colimit F = Finset.univ.sup F.obj :=
(IsColimit.coconePointUniqueUpToIso (colimit.isColimit F) (finiteColimitCocone F).isColimit).to_eq
#align category_theory.limits.complete_lattice.finite_colimit_eq_finset_univ_sup CategoryTheory.Limits.CompleteLattice.finite_colimit_eq_finset_univ_sup
theorem finite_product_eq_finset_inf [SemilatticeInf α] [OrderTop α] {ι : Type u} [Fintype ι]
(f : ι → α) : ∏ᶜ f = Fintype.elems.inf f := by
trans
· exact
(IsLimit.conePointUniqueUpToIso (limit.isLimit _)
(finiteLimitCone (Discrete.functor f)).isLimit).to_eq
change Finset.univ.inf (f ∘ discreteEquiv.toEmbedding) = Fintype.elems.inf f
simp only [← Finset.inf_map, Finset.univ_map_equiv_to_embedding]
rfl
#align category_theory.limits.complete_lattice.finite_product_eq_finset_inf CategoryTheory.Limits.CompleteLattice.finite_product_eq_finset_inf
theorem finite_coproduct_eq_finset_sup [SemilatticeSup α] [OrderBot α] {ι : Type u} [Fintype ι]
(f : ι → α) : ∐ f = Fintype.elems.sup f := by
trans
· exact
(IsColimit.coconePointUniqueUpToIso (colimit.isColimit _)
(finiteColimitCocone (Discrete.functor f)).isColimit).to_eq
change Finset.univ.sup (f ∘ discreteEquiv.toEmbedding) = Fintype.elems.sup f
simp only [← Finset.sup_map, Finset.univ_map_equiv_to_embedding]
rfl
#align category_theory.limits.complete_lattice.finite_coproduct_eq_finset_sup CategoryTheory.Limits.CompleteLattice.finite_coproduct_eq_finset_sup
set_option backward.synthInstance.canonInstances false in -- See https://github.com/leanprover-community/mathlib4/issues/12532
-- see Note [lower instance priority]
instance (priority := 100) [SemilatticeInf α] [OrderTop α] : HasBinaryProducts α := by
have : ∀ x y : α, HasLimit (pair x y) := by
letI := hasFiniteLimits_of_hasFiniteLimits_of_size.{u} α
infer_instance
apply hasBinaryProducts_of_hasLimit_pair
@[simp]
| Mathlib/CategoryTheory/Limits/Lattice.lean | 122 | 128 | theorem prod_eq_inf [SemilatticeInf α] [OrderTop α] (x y : α) : Limits.prod x y = x ⊓ y :=
calc
Limits.prod x y = limit (pair x y) := rfl
_ = Finset.univ.inf (pair x y).obj := by | rw [finite_limit_eq_finset_univ_inf (pair.{u} x y)]
_ = x ⊓ (y ⊓ ⊤) := rfl
-- Note: finset.inf is realized as a fold, hence the definitional equality
_ = x ⊓ y := by rw [inf_top_eq]
| [
" ∀ (J : Type) [𝒥 : SmallCategory J] [inst : FinCategory J], HasLimitsOfShape J α",
" HasLimitsOfShape J α",
" ∀ (J : Type) [𝒥 : SmallCategory J] [inst : FinCategory J], HasColimitsOfShape J α",
" HasColimitsOfShape J α",
" ∏ᶜ f = Fintype.elems.inf f",
" ∏ᶜ f = ?m.21382",
" (finiteLimitCone (Discrete.... | [
" ∀ (J : Type) [𝒥 : SmallCategory J] [inst : FinCategory J], HasLimitsOfShape J α",
" HasLimitsOfShape J α",
" ∀ (J : Type) [𝒥 : SmallCategory J] [inst : FinCategory J], HasColimitsOfShape J α",
" HasColimitsOfShape J α",
" ∏ᶜ f = Fintype.elems.inf f",
" ∏ᶜ f = ?m.21382",
" (finiteLimitCone (Discrete.... |
import Mathlib.Analysis.Convex.Cone.Extension
import Mathlib.Analysis.Convex.Gauge
import Mathlib.Topology.Algebra.Module.FiniteDimension
import Mathlib.Topology.Algebra.Module.LocallyConvex
#align_import analysis.normed_space.hahn_banach.separation from "leanprover-community/mathlib"@"915591b2bb3ea303648db07284a161a7f2a9e3d4"
open Set
open Pointwise
variable {𝕜 E : Type*}
| Mathlib/Analysis/NormedSpace/HahnBanach/Separation.lean | 47 | 76 | theorem separate_convex_open_set [TopologicalSpace E] [AddCommGroup E] [TopologicalAddGroup E]
[Module ℝ E] [ContinuousSMul ℝ E] {s : Set E} (hs₀ : (0 : E) ∈ s) (hs₁ : Convex ℝ s)
(hs₂ : IsOpen s) {x₀ : E} (hx₀ : x₀ ∉ s) : ∃ f : E →L[ℝ] ℝ, f x₀ = 1 ∧ ∀ x ∈ s, f x < 1 := by |
let f : E →ₗ.[ℝ] ℝ := LinearPMap.mkSpanSingleton x₀ 1 (ne_of_mem_of_not_mem hs₀ hx₀).symm
have := exists_extension_of_le_sublinear f (gauge s) (fun c hc => gauge_smul_of_nonneg hc.le)
(gauge_add_le hs₁ <| absorbent_nhds_zero <| hs₂.mem_nhds hs₀) ?_
· obtain ⟨φ, hφ₁, hφ₂⟩ := this
have hφ₃ : φ x₀ = 1 := by
rw [← f.domain.coe_mk x₀ (Submodule.mem_span_singleton_self _), hφ₁,
LinearPMap.mkSpanSingleton'_apply_self]
have hφ₄ : ∀ x ∈ s, φ x < 1 := fun x hx =>
(hφ₂ x).trans_lt (gauge_lt_one_of_mem_of_isOpen hs₂ hx)
refine ⟨⟨φ, ?_⟩, hφ₃, hφ₄⟩
refine
φ.continuous_of_nonzero_on_open _ (hs₂.vadd (-x₀)) (Nonempty.vadd_set ⟨0, hs₀⟩)
(vadd_set_subset_iff.mpr fun x hx => ?_)
change φ (-x₀ + x) ≠ 0
rw [map_add, map_neg]
specialize hφ₄ x hx
linarith
rintro ⟨x, hx⟩
obtain ⟨y, rfl⟩ := Submodule.mem_span_singleton.1 hx
rw [LinearPMap.mkSpanSingleton'_apply]
simp only [mul_one, Algebra.id.smul_eq_mul, Submodule.coe_mk]
obtain h | h := le_or_lt y 0
· exact h.trans (gauge_nonneg _)
· rw [gauge_smul_of_nonneg h.le, smul_eq_mul, le_mul_iff_one_le_right h]
exact
one_le_gauge_of_not_mem (hs₁.starConvex hs₀)
(absorbent_nhds_zero <| hs₂.mem_nhds hs₀).absorbs hx₀
| [
" ∃ f, f x₀ = 1 ∧ ∀ x ∈ s, f x < 1",
" φ x₀ = 1",
" Continuous φ.toFun",
" -x₀ +ᵥ x ∈ fun x => φ x = 0 → False",
" φ (-x₀ + x) ≠ 0",
" -φ x₀ + φ x ≠ 0",
" ∀ (x : ↥f.domain), ↑f x ≤ gauge s ↑x",
" ↑f ⟨x, hx⟩ ≤ gauge s ↑⟨x, hx⟩",
" ↑f ⟨y • x₀, hx⟩ ≤ gauge s ↑⟨y • x₀, hx⟩",
" y • 1 ≤ gauge s ↑⟨y • x₀... | [] |
import Mathlib.LinearAlgebra.Basis
import Mathlib.LinearAlgebra.FreeModule.Basic
import Mathlib.LinearAlgebra.LinearPMap
import Mathlib.LinearAlgebra.Projection
#align_import linear_algebra.basis from "leanprover-community/mathlib"@"13bce9a6b6c44f6b4c91ac1c1d2a816e2533d395"
open Function Set Submodule
set_option autoImplicit false
variable {ι : Type*} {ι' : Type*} {K : Type*} {V : Type*} {V' : Type*}
section DivisionRing
variable [DivisionRing K] [AddCommGroup V] [AddCommGroup V'] [Module K V] [Module K V']
variable {v : ι → V} {s t : Set V} {x y z : V}
open Submodule
namespace Basis
section ExistsBasis
noncomputable def extend (hs : LinearIndependent K ((↑) : s → V)) :
Basis (hs.extend (subset_univ s)) K V :=
Basis.mk
(@LinearIndependent.restrict_of_comp_subtype _ _ _ id _ _ _ _ (hs.linearIndependent_extend _))
(SetLike.coe_subset_coe.mp <| by simpa using hs.subset_span_extend (subset_univ s))
#align basis.extend Basis.extend
theorem extend_apply_self (hs : LinearIndependent K ((↑) : s → V)) (x : hs.extend _) :
Basis.extend hs x = x :=
Basis.mk_apply _ _ _
#align basis.extend_apply_self Basis.extend_apply_self
@[simp]
theorem coe_extend (hs : LinearIndependent K ((↑) : s → V)) : ⇑(Basis.extend hs) = ((↑) : _ → _) :=
funext (extend_apply_self hs)
#align basis.coe_extend Basis.coe_extend
| Mathlib/LinearAlgebra/Basis/VectorSpace.lean | 67 | 69 | theorem range_extend (hs : LinearIndependent K ((↑) : s → V)) :
range (Basis.extend hs) = hs.extend (subset_univ _) := by |
rw [coe_extend, Subtype.range_coe_subtype, setOf_mem_eq]
| [
" ↑⊤ ⊆ ↑(span K (range ((hs.extend ⋯).restrict id)))",
" range ⇑(extend hs) = hs.extend ⋯"
] | [
" ↑⊤ ⊆ ↑(span K (range ((hs.extend ⋯).restrict id)))"
] |
import Mathlib.Analysis.Complex.Circle
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup
#align_import analysis.complex.isometry from "leanprover-community/mathlib"@"ae690b0c236e488a0043f6faa8ce3546e7f2f9c5"
noncomputable section
open Complex
open ComplexConjugate
local notation "|" x "|" => Complex.abs x
def rotation : circle →* ℂ ≃ₗᵢ[ℝ] ℂ where
toFun a :=
{ DistribMulAction.toLinearEquiv ℝ ℂ a with
norm_map' := fun x => show |a * x| = |x| by rw [map_mul, abs_coe_circle, one_mul] }
map_one' := LinearIsometryEquiv.ext <| one_smul circle
map_mul' a b := LinearIsometryEquiv.ext <| mul_smul a b
#align rotation rotation
@[simp]
theorem rotation_apply (a : circle) (z : ℂ) : rotation a z = a * z :=
rfl
#align rotation_apply rotation_apply
@[simp]
theorem rotation_symm (a : circle) : (rotation a).symm = rotation a⁻¹ :=
LinearIsometryEquiv.ext fun _ => rfl
#align rotation_symm rotation_symm
@[simp]
theorem rotation_trans (a b : circle) : (rotation a).trans (rotation b) = rotation (b * a) := by
ext1
simp
#align rotation_trans rotation_trans
theorem rotation_ne_conjLIE (a : circle) : rotation a ≠ conjLIE := by
intro h
have h1 : rotation a 1 = conj 1 := LinearIsometryEquiv.congr_fun h 1
have hI : rotation a I = conj I := LinearIsometryEquiv.congr_fun h I
rw [rotation_apply, RingHom.map_one, mul_one] at h1
rw [rotation_apply, conj_I, ← neg_one_mul, mul_left_inj' I_ne_zero, h1, eq_neg_self_iff] at hI
exact one_ne_zero hI
#align rotation_ne_conj_lie rotation_ne_conjLIE
@[simps]
def rotationOf (e : ℂ ≃ₗᵢ[ℝ] ℂ) : circle :=
⟨e 1 / Complex.abs (e 1), by simp⟩
#align rotation_of rotationOf
@[simp]
theorem rotationOf_rotation (a : circle) : rotationOf (rotation a) = a :=
Subtype.ext <| by simp
#align rotation_of_rotation rotationOf_rotation
theorem rotation_injective : Function.Injective rotation :=
Function.LeftInverse.injective rotationOf_rotation
#align rotation_injective rotation_injective
theorem LinearIsometry.re_apply_eq_re_of_add_conj_eq (f : ℂ →ₗᵢ[ℝ] ℂ)
(h₃ : ∀ z, z + conj z = f z + conj (f z)) (z : ℂ) : (f z).re = z.re := by
simpa [ext_iff, add_re, add_im, conj_re, conj_im, ← two_mul,
show (2 : ℝ) ≠ 0 by simp [two_ne_zero]] using (h₃ z).symm
#align linear_isometry.re_apply_eq_re_of_add_conj_eq LinearIsometry.re_apply_eq_re_of_add_conj_eq
theorem LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re {f : ℂ →ₗᵢ[ℝ] ℂ}
(h₂ : ∀ z, (f z).re = z.re) (z : ℂ) : (f z).im = z.im ∨ (f z).im = -z.im := by
have h₁ := f.norm_map z
simp only [Complex.abs_def, norm_eq_abs] at h₁
rwa [Real.sqrt_inj (normSq_nonneg _) (normSq_nonneg _), normSq_apply (f z), normSq_apply z,
h₂, add_left_cancel_iff, mul_self_eq_mul_self_iff] at h₁
#align linear_isometry.im_apply_eq_im_or_neg_of_re_apply_eq_re LinearIsometry.im_apply_eq_im_or_neg_of_re_apply_eq_re
| Mathlib/Analysis/Complex/Isometry.lean | 104 | 116 | theorem LinearIsometry.im_apply_eq_im {f : ℂ →ₗᵢ[ℝ] ℂ} (h : f 1 = 1) (z : ℂ) :
z + conj z = f z + conj (f z) := by |
have : ‖f z - 1‖ = ‖z - 1‖ := by rw [← f.norm_map (z - 1), f.map_sub, h]
apply_fun fun x => x ^ 2 at this
simp only [norm_eq_abs, ← normSq_eq_abs] at this
rw [← ofReal_inj, ← mul_conj, ← mul_conj] at this
rw [RingHom.map_sub, RingHom.map_sub] at this
simp only [sub_mul, mul_sub, one_mul, mul_one] at this
rw [mul_conj, normSq_eq_abs, ← norm_eq_abs, LinearIsometry.norm_map] at this
rw [mul_conj, normSq_eq_abs, ← norm_eq_abs] at this
simp only [sub_sub, sub_right_inj, mul_one, ofReal_pow, RingHom.map_one, norm_eq_abs] at this
simp only [add_sub, sub_left_inj] at this
rw [add_comm, ← this, add_comm]
| [
" Complex.abs (↑a * x) = Complex.abs x",
" (rotation a).trans (rotation b) = rotation (b * a)",
" ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝",
" rotation a ≠ conjLIE",
" False",
" e 1 / ↑(Complex.abs (e 1)) ∈ circle",
" ↑(rotationOf (rotation a)) = ↑a",
" (f z).re = z.re",
" 2 ≠ 0"... | [
" Complex.abs (↑a * x) = Complex.abs x",
" (rotation a).trans (rotation b) = rotation (b * a)",
" ((rotation a).trans (rotation b)) x✝ = (rotation (b * a)) x✝",
" rotation a ≠ conjLIE",
" False",
" e 1 / ↑(Complex.abs (e 1)) ∈ circle",
" ↑(rotationOf (rotation a)) = ↑a",
" (f z).re = z.re",
" 2 ≠ 0"... |
import Mathlib.Order.Ideal
import Mathlib.Order.PFilter
#align_import order.prime_ideal from "leanprover-community/mathlib"@"740acc0e6f9adf4423f92a485d0456fc271482da"
open Order.PFilter
namespace Order
variable {P : Type*}
namespace Ideal
-- Porting note(#5171): this linter isn't ported yet.
-- @[nolint has_nonempty_instance]
structure PrimePair (P : Type*) [Preorder P] where
I : Ideal P
F : PFilter P
isCompl_I_F : IsCompl (I : Set P) F
#align order.ideal.prime_pair Order.Ideal.PrimePair
@[mk_iff]
class IsPrime [Preorder P] (I : Ideal P) extends IsProper I : Prop where
compl_filter : IsPFilter (I : Set P)ᶜ
#align order.ideal.is_prime Order.Ideal.IsPrime
section SemilatticeInf
variable [SemilatticeInf P] {x y : P} {I : Ideal P}
| Mathlib/Order/PrimeIdeal.lean | 124 | 128 | theorem IsPrime.mem_or_mem (hI : IsPrime I) {x y : P} : x ⊓ y ∈ I → x ∈ I ∨ y ∈ I := by |
contrapose!
let F := hI.compl_filter.toPFilter
show x ∈ F ∧ y ∈ F → x ⊓ y ∈ F
exact fun h => inf_mem h.1 h.2
| [
" x ⊓ y ∈ I → x ∈ I ∨ y ∈ I",
" x ∉ I ∧ y ∉ I → x ⊓ y ∉ I",
" x ∈ F ∧ y ∈ F → x ⊓ y ∈ F"
] | [] |
import Mathlib.Algebra.DirectSum.Module
import Mathlib.Algebra.Lie.OfAssociative
import Mathlib.Algebra.Lie.Submodule
import Mathlib.Algebra.Lie.Basic
#align_import algebra.lie.direct_sum from "leanprover-community/mathlib"@"c0cc689babd41c0e9d5f02429211ffbe2403472a"
universe u v w w₁
namespace DirectSum
open DFinsupp
open scoped DirectSum
variable {R : Type u} {ι : Type v} [CommRing R]
section Algebras
variable (L : ι → Type w)
variable [∀ i, LieRing (L i)] [∀ i, LieAlgebra R (L i)]
instance lieRing : LieRing (⨁ i, L i) :=
{ (inferInstance : AddCommGroup _) with
bracket := zipWith (fun i => fun x y => ⁅x, y⁆) fun i => lie_zero 0
add_lie := fun x y z => by
refine DFinsupp.ext fun _ => ?_ -- Porting note: Originally `ext`
simp only [zipWith_apply, add_apply, add_lie]
lie_add := fun x y z => by
refine DFinsupp.ext fun _ => ?_ -- Porting note: Originally `ext`
simp only [zipWith_apply, add_apply, lie_add]
lie_self := fun x => by
refine DFinsupp.ext fun _ => ?_ -- Porting note: Originally `ext`
simp only [zipWith_apply, add_apply, lie_self, zero_apply]
leibniz_lie := fun x y z => by
refine DFinsupp.ext fun _ => ?_ -- Porting note: Originally `ext`
simp only [sub_apply, zipWith_apply, add_apply, zero_apply]
apply leibniz_lie }
#align direct_sum.lie_ring DirectSum.lieRing
@[simp]
theorem bracket_apply (x y : ⨁ i, L i) (i : ι) : ⁅x, y⁆ i = ⁅x i, y i⁆ :=
zipWith_apply _ _ x y i
#align direct_sum.bracket_apply DirectSum.bracket_apply
theorem lie_of_same [DecidableEq ι] {i : ι} (x y : L i) :
⁅of L i x, of L i y⁆ = of L i ⁅x, y⁆ :=
DFinsupp.zipWith_single_single _ _ _ _
#align direct_sum.lie_of_of_eq DirectSum.lie_of_same
theorem lie_of_of_ne [DecidableEq ι] {i j : ι} (hij : i ≠ j) (x : L i) (y : L j) :
⁅of L i x, of L j y⁆ = 0 := by
refine DFinsupp.ext fun k => ?_
rw [bracket_apply]
obtain rfl | hik := Decidable.eq_or_ne i k
· rw [of_eq_of_ne _ _ _ _ hij.symm, lie_zero, zero_apply]
· rw [of_eq_of_ne _ _ _ _ hik, zero_lie, zero_apply]
#align direct_sum.lie_of_of_ne DirectSum.lie_of_of_ne
@[simp]
| Mathlib/Algebra/Lie/DirectSum.lean | 140 | 144 | theorem lie_of [DecidableEq ι] {i j : ι} (x : L i) (y : L j) :
⁅of L i x, of L j y⁆ = if hij : i = j then of L i ⁅x, hij.symm.recOn y⁆ else 0 := by |
obtain rfl | hij := Decidable.eq_or_ne i j
· simp only [lie_of_same L x y, dif_pos]
· simp only [lie_of_of_ne L hij x y, hij, dif_neg, dite_false]
| [
" ⁅x + y, z⁆ = ⁅x, z⁆ + ⁅y, z⁆",
" ⁅x + y, z⁆ x✝ = (⁅x, z⁆ + ⁅y, z⁆) x✝",
" ⁅x, y + z⁆ = ⁅x, y⁆ + ⁅x, z⁆",
" ⁅x, y + z⁆ x✝ = (⁅x, y⁆ + ⁅x, z⁆) x✝",
" ⁅x, x⁆ = 0",
" ⁅x, x⁆ x✝ = 0 x✝",
" ⁅x, ⁅y, z⁆⁆ = ⁅⁅x, y⁆, z⁆ + ⁅y, ⁅x, z⁆⁆",
" ⁅x, ⁅y, z⁆⁆ x✝ = (⁅⁅x, y⁆, z⁆ + ⁅y, ⁅x, z⁆⁆) x✝",
" ⁅x x✝, ⁅y x✝, z x✝... | [
" ⁅x + y, z⁆ = ⁅x, z⁆ + ⁅y, z⁆",
" ⁅x + y, z⁆ x✝ = (⁅x, z⁆ + ⁅y, z⁆) x✝",
" ⁅x, y + z⁆ = ⁅x, y⁆ + ⁅x, z⁆",
" ⁅x, y + z⁆ x✝ = (⁅x, y⁆ + ⁅x, z⁆) x✝",
" ⁅x, x⁆ = 0",
" ⁅x, x⁆ x✝ = 0 x✝",
" ⁅x, ⁅y, z⁆⁆ = ⁅⁅x, y⁆, z⁆ + ⁅y, ⁅x, z⁆⁆",
" ⁅x, ⁅y, z⁆⁆ x✝ = (⁅⁅x, y⁆, z⁆ + ⁅y, ⁅x, z⁆⁆) x✝",
" ⁅x x✝, ⁅y x✝, z x✝... |
import Mathlib.Algebra.NeZero
import Mathlib.Algebra.Polynomial.BigOperators
import Mathlib.Algebra.Polynomial.Lifts
import Mathlib.Algebra.Polynomial.Splits
import Mathlib.RingTheory.RootsOfUnity.Complex
import Mathlib.NumberTheory.ArithmeticFunction
import Mathlib.RingTheory.RootsOfUnity.Basic
import Mathlib.FieldTheory.RatFunc.AsPolynomial
#align_import ring_theory.polynomial.cyclotomic.basic from "leanprover-community/mathlib"@"7fdeecc0d03cd40f7a165e6cf00a4d2286db599f"
open scoped Polynomial
noncomputable section
universe u
namespace Polynomial
section Cyclotomic'
section IsDomain
variable {R : Type*} [CommRing R] [IsDomain R]
def cyclotomic' (n : ℕ) (R : Type*) [CommRing R] [IsDomain R] : R[X] :=
∏ μ ∈ primitiveRoots n R, (X - C μ)
#align polynomial.cyclotomic' Polynomial.cyclotomic'
@[simp]
theorem cyclotomic'_zero (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 0 R = 1 := by
simp only [cyclotomic', Finset.prod_empty, primitiveRoots_zero]
#align polynomial.cyclotomic'_zero Polynomial.cyclotomic'_zero
@[simp]
theorem cyclotomic'_one (R : Type*) [CommRing R] [IsDomain R] : cyclotomic' 1 R = X - 1 := by
simp only [cyclotomic', Finset.prod_singleton, RingHom.map_one,
IsPrimitiveRoot.primitiveRoots_one]
#align polynomial.cyclotomic'_one Polynomial.cyclotomic'_one
@[simp]
| Mathlib/RingTheory/Polynomial/Cyclotomic/Basic.lean | 85 | 91 | theorem cyclotomic'_two (R : Type*) [CommRing R] [IsDomain R] (p : ℕ) [CharP R p] (hp : p ≠ 2) :
cyclotomic' 2 R = X + 1 := by |
rw [cyclotomic']
have prim_root_two : primitiveRoots 2 R = {(-1 : R)} := by
simp only [Finset.eq_singleton_iff_unique_mem, mem_primitiveRoots two_pos]
exact ⟨IsPrimitiveRoot.neg_one p hp, fun x => IsPrimitiveRoot.eq_neg_one_of_two_right⟩
simp only [prim_root_two, Finset.prod_singleton, RingHom.map_neg, RingHom.map_one, sub_neg_eq_add]
| [
" cyclotomic' 0 R = 1",
" cyclotomic' 1 R = X - 1",
" cyclotomic' 2 R = X + 1",
" ∏ μ ∈ primitiveRoots 2 R, (X - C μ) = X + 1",
" primitiveRoots 2 R = {-1}",
" IsPrimitiveRoot (-1) 2 ∧ ∀ (x : R), IsPrimitiveRoot x 2 → x = -1"
] | [
" cyclotomic' 0 R = 1",
" cyclotomic' 1 R = X - 1"
] |
import Mathlib.Topology.MetricSpace.Antilipschitz
#align_import topology.metric_space.isometry from "leanprover-community/mathlib"@"b1859b6d4636fdbb78c5d5cefd24530653cfd3eb"
noncomputable section
universe u v w
variable {ι : Type*} {α : Type u} {β : Type v} {γ : Type w}
open Function Set
open scoped Topology ENNReal
def Isometry [PseudoEMetricSpace α] [PseudoEMetricSpace β] (f : α → β) : Prop :=
∀ x1 x2 : α, edist (f x1) (f x2) = edist x1 x2
#align isometry Isometry
theorem isometry_iff_nndist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} :
Isometry f ↔ ∀ x y, nndist (f x) (f y) = nndist x y := by
simp only [Isometry, edist_nndist, ENNReal.coe_inj]
#align isometry_iff_nndist_eq isometry_iff_nndist_eq
theorem isometry_iff_dist_eq [PseudoMetricSpace α] [PseudoMetricSpace β] {f : α → β} :
Isometry f ↔ ∀ x y, dist (f x) (f y) = dist x y := by
simp only [isometry_iff_nndist_eq, ← coe_nndist, NNReal.coe_inj]
#align isometry_iff_dist_eq isometry_iff_dist_eq
alias ⟨Isometry.dist_eq, _⟩ := isometry_iff_dist_eq
#align isometry.dist_eq Isometry.dist_eq
alias ⟨_, Isometry.of_dist_eq⟩ := isometry_iff_dist_eq
#align isometry.of_dist_eq Isometry.of_dist_eq
alias ⟨Isometry.nndist_eq, _⟩ := isometry_iff_nndist_eq
#align isometry.nndist_eq Isometry.nndist_eq
alias ⟨_, Isometry.of_nndist_eq⟩ := isometry_iff_nndist_eq
#align isometry.of_nndist_eq Isometry.of_nndist_eq
namespace Isometry
section PseudoEmetricIsometry
variable [PseudoEMetricSpace α] [PseudoEMetricSpace β] [PseudoEMetricSpace γ]
variable {f : α → β} {x y z : α} {s : Set α}
theorem edist_eq (hf : Isometry f) (x y : α) : edist (f x) (f y) = edist x y :=
hf x y
#align isometry.edist_eq Isometry.edist_eq
theorem lipschitz (h : Isometry f) : LipschitzWith 1 f :=
LipschitzWith.of_edist_le fun x y => (h x y).le
#align isometry.lipschitz Isometry.lipschitz
theorem antilipschitz (h : Isometry f) : AntilipschitzWith 1 f := fun x y => by
simp only [h x y, ENNReal.coe_one, one_mul, le_refl]
#align isometry.antilipschitz Isometry.antilipschitz
@[nontriviality]
theorem _root_.isometry_subsingleton [Subsingleton α] : Isometry f := fun x y => by
rw [Subsingleton.elim x y]; simp
#align isometry_subsingleton isometry_subsingleton
theorem _root_.isometry_id : Isometry (id : α → α) := fun _ _ => rfl
#align isometry_id isometry_id
theorem prod_map {δ} [PseudoEMetricSpace δ] {f : α → β} {g : γ → δ} (hf : Isometry f)
(hg : Isometry g) : Isometry (Prod.map f g) := fun x y => by
simp only [Prod.edist_eq, hf.edist_eq, hg.edist_eq, Prod.map_apply]
#align isometry.prod_map Isometry.prod_map
theorem _root_.isometry_dcomp {ι} [Fintype ι] {α β : ι → Type*} [∀ i, PseudoEMetricSpace (α i)]
[∀ i, PseudoEMetricSpace (β i)] (f : ∀ i, α i → β i) (hf : ∀ i, Isometry (f i)) :
Isometry (fun g : (i : ι) → α i => fun i => f i (g i)) := fun x y => by
simp only [edist_pi_def, (hf _).edist_eq]
#align isometry_dcomp isometry_dcomp
theorem comp {g : β → γ} {f : α → β} (hg : Isometry g) (hf : Isometry f) : Isometry (g ∘ f) :=
fun _ _ => (hg _ _).trans (hf _ _)
#align isometry.comp Isometry.comp
protected theorem uniformContinuous (hf : Isometry f) : UniformContinuous f :=
hf.lipschitz.uniformContinuous
#align isometry.uniform_continuous Isometry.uniformContinuous
protected theorem uniformInducing (hf : Isometry f) : UniformInducing f :=
hf.antilipschitz.uniformInducing hf.uniformContinuous
#align isometry.uniform_inducing Isometry.uniformInducing
theorem tendsto_nhds_iff {ι : Type*} {f : α → β} {g : ι → α} {a : Filter ι} {b : α}
(hf : Isometry f) : Filter.Tendsto g a (𝓝 b) ↔ Filter.Tendsto (f ∘ g) a (𝓝 (f b)) :=
hf.uniformInducing.inducing.tendsto_nhds_iff
#align isometry.tendsto_nhds_iff Isometry.tendsto_nhds_iff
protected theorem continuous (hf : Isometry f) : Continuous f :=
hf.lipschitz.continuous
#align isometry.continuous Isometry.continuous
theorem right_inv {f : α → β} {g : β → α} (h : Isometry f) (hg : RightInverse g f) : Isometry g :=
fun x y => by rw [← h, hg _, hg _]
#align isometry.right_inv Isometry.right_inv
theorem preimage_emetric_closedBall (h : Isometry f) (x : α) (r : ℝ≥0∞) :
f ⁻¹' EMetric.closedBall (f x) r = EMetric.closedBall x r := by
ext y
simp [h.edist_eq]
#align isometry.preimage_emetric_closed_ball Isometry.preimage_emetric_closedBall
theorem preimage_emetric_ball (h : Isometry f) (x : α) (r : ℝ≥0∞) :
f ⁻¹' EMetric.ball (f x) r = EMetric.ball x r := by
ext y
simp [h.edist_eq]
#align isometry.preimage_emetric_ball Isometry.preimage_emetric_ball
theorem ediam_image (hf : Isometry f) (s : Set α) : EMetric.diam (f '' s) = EMetric.diam s :=
eq_of_forall_ge_iff fun d => by simp only [EMetric.diam_le_iff, forall_mem_image, hf.edist_eq]
#align isometry.ediam_image Isometry.ediam_image
| Mathlib/Topology/MetricSpace/Isometry.lean | 155 | 157 | theorem ediam_range (hf : Isometry f) : EMetric.diam (range f) = EMetric.diam (univ : Set α) := by |
rw [← image_univ]
exact hf.ediam_image univ
| [
" Isometry f ↔ ∀ (x y : α), nndist (f x) (f y) = nndist x y",
" Isometry f ↔ ∀ (x y : α), dist (f x) (f y) = dist x y",
" edist x y ≤ ↑1 * edist (f x) (f y)",
" edist (f x) (f y) = edist x y",
" edist (f y) (f y) = edist y y",
" edist (Prod.map f g x) (Prod.map f g y) = edist x y",
" edist ((fun g i => ... | [
" Isometry f ↔ ∀ (x y : α), nndist (f x) (f y) = nndist x y",
" Isometry f ↔ ∀ (x y : α), dist (f x) (f y) = dist x y",
" edist x y ≤ ↑1 * edist (f x) (f y)",
" edist (f x) (f y) = edist x y",
" edist (f y) (f y) = edist y y",
" edist (Prod.map f g x) (Prod.map f g y) = edist x y",
" edist ((fun g i => ... |
import Mathlib.Topology.MetricSpace.HausdorffDistance
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.measure.regular from "leanprover-community/mathlib"@"bf6a01357ff5684b1ebcd0f1a13be314fc82c0bf"
open Set Filter ENNReal Topology NNReal TopologicalSpace
namespace MeasureTheory
namespace Measure
def InnerRegularWRT {α} {_ : MeasurableSpace α} (μ : Measure α) (p q : Set α → Prop) :=
∀ ⦃U⦄, q U → ∀ r < μ U, ∃ K, K ⊆ U ∧ p K ∧ r < μ K
#align measure_theory.measure.inner_regular MeasureTheory.Measure.InnerRegularWRT
namespace InnerRegularWRT
variable {α : Type*} {m : MeasurableSpace α} {μ : Measure α} {p q : Set α → Prop} {U : Set α}
{ε : ℝ≥0∞}
theorem measure_eq_iSup (H : InnerRegularWRT μ p q) (hU : q U) :
μ U = ⨆ (K) (_ : K ⊆ U) (_ : p K), μ K := by
refine
le_antisymm (le_of_forall_lt fun r hr => ?_) (iSup₂_le fun K hK => iSup_le fun _ => μ.mono hK)
simpa only [lt_iSup_iff, exists_prop] using H hU r hr
#align measure_theory.measure.inner_regular.measure_eq_supr MeasureTheory.Measure.InnerRegularWRT.measure_eq_iSup
theorem exists_subset_lt_add (H : InnerRegularWRT μ p q) (h0 : p ∅) (hU : q U) (hμU : μ U ≠ ∞)
(hε : ε ≠ 0) : ∃ K, K ⊆ U ∧ p K ∧ μ U < μ K + ε := by
rcases eq_or_ne (μ U) 0 with h₀ | h₀
· refine ⟨∅, empty_subset _, h0, ?_⟩
rwa [measure_empty, h₀, zero_add, pos_iff_ne_zero]
· rcases H hU _ (ENNReal.sub_lt_self hμU h₀ hε) with ⟨K, hKU, hKc, hrK⟩
exact ⟨K, hKU, hKc, ENNReal.lt_add_of_sub_lt_right (Or.inl hμU) hrK⟩
#align measure_theory.measure.inner_regular.exists_subset_lt_add MeasureTheory.Measure.InnerRegularWRT.exists_subset_lt_add
protected theorem map {α β} [MeasurableSpace α] [MeasurableSpace β]
{μ : Measure α} {pa qa : Set α → Prop}
(H : InnerRegularWRT μ pa qa) {f : α → β} (hf : AEMeasurable f μ) {pb qb : Set β → Prop}
(hAB : ∀ U, qb U → qa (f ⁻¹' U)) (hAB' : ∀ K, pa K → pb (f '' K))
(hB₂ : ∀ U, qb U → MeasurableSet U) :
InnerRegularWRT (map f μ) pb qb := by
intro U hU r hr
rw [map_apply_of_aemeasurable hf (hB₂ _ hU)] at hr
rcases H (hAB U hU) r hr with ⟨K, hKU, hKc, hK⟩
refine ⟨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_⟩
exact hK.trans_le (le_map_apply_image hf _)
#align measure_theory.measure.inner_regular.map MeasureTheory.Measure.InnerRegularWRT.map
theorem map' {α β} [MeasurableSpace α] [MeasurableSpace β] {μ : Measure α} {pa qa : Set α → Prop}
(H : InnerRegularWRT μ pa qa) (f : α ≃ᵐ β) {pb qb : Set β → Prop}
(hAB : ∀ U, qb U → qa (f ⁻¹' U)) (hAB' : ∀ K, pa K → pb (f '' K)) :
InnerRegularWRT (map f μ) pb qb := by
intro U hU r hr
rw [f.map_apply U] at hr
rcases H (hAB U hU) r hr with ⟨K, hKU, hKc, hK⟩
refine ⟨f '' K, image_subset_iff.2 hKU, hAB' _ hKc, ?_⟩
rwa [f.map_apply, f.preimage_image]
theorem smul (H : InnerRegularWRT μ p q) (c : ℝ≥0∞) : InnerRegularWRT (c • μ) p q := by
intro U hU r hr
rw [smul_apply, H.measure_eq_iSup hU, smul_eq_mul] at hr
simpa only [ENNReal.mul_iSup, lt_iSup_iff, exists_prop] using hr
#align measure_theory.measure.inner_regular.smul MeasureTheory.Measure.InnerRegularWRT.smul
| Mathlib/MeasureTheory/Measure/Regular.lean | 260 | 264 | theorem trans {q' : Set α → Prop} (H : InnerRegularWRT μ p q) (H' : InnerRegularWRT μ q q') :
InnerRegularWRT μ p q' := by |
intro U hU r hr
rcases H' hU r hr with ⟨F, hFU, hqF, hF⟩; rcases H hqF _ hF with ⟨K, hKF, hpK, hrK⟩
exact ⟨K, hKF.trans hFU, hpK, hrK⟩
| [
" μ U = ⨆ K, ⨆ (_ : K ⊆ U), ⨆ (_ : p K), μ K",
" r < ⨆ K, ⨆ (_ : K ⊆ U), ⨆ (_ : p K), μ K",
" ∃ K ⊆ U, p K ∧ μ U < μ K + ε",
" μ U < μ ∅ + ε",
" (map f μ).InnerRegularWRT pb qb",
" ∃ K ⊆ U, pb K ∧ r < (map f μ) K",
" r < (map f μ) (f '' K)",
" (map (⇑f) μ).InnerRegularWRT pb qb",
" ∃ K ⊆ U, pb K ∧ r... | [
" μ U = ⨆ K, ⨆ (_ : K ⊆ U), ⨆ (_ : p K), μ K",
" r < ⨆ K, ⨆ (_ : K ⊆ U), ⨆ (_ : p K), μ K",
" ∃ K ⊆ U, p K ∧ μ U < μ K + ε",
" μ U < μ ∅ + ε",
" (map f μ).InnerRegularWRT pb qb",
" ∃ K ⊆ U, pb K ∧ r < (map f μ) K",
" r < (map f μ) (f '' K)",
" (map (⇑f) μ).InnerRegularWRT pb qb",
" ∃ K ⊆ U, pb K ∧ r... |
import Mathlib.Analysis.SpecialFunctions.Pow.Real
#align_import analysis.special_functions.pow.nnreal from "leanprover-community/mathlib"@"4fa54b337f7d52805480306db1b1439c741848c8"
noncomputable section
open scoped Classical
open Real NNReal ENNReal ComplexConjugate
open Finset Function Set
namespace NNReal
variable {w x y z : ℝ}
noncomputable def rpow (x : ℝ≥0) (y : ℝ) : ℝ≥0 :=
⟨(x : ℝ) ^ y, Real.rpow_nonneg x.2 y⟩
#align nnreal.rpow NNReal.rpow
noncomputable instance : Pow ℝ≥0 ℝ :=
⟨rpow⟩
@[simp]
theorem rpow_eq_pow (x : ℝ≥0) (y : ℝ) : rpow x y = x ^ y :=
rfl
#align nnreal.rpow_eq_pow NNReal.rpow_eq_pow
@[simp, norm_cast]
theorem coe_rpow (x : ℝ≥0) (y : ℝ) : ((x ^ y : ℝ≥0) : ℝ) = (x : ℝ) ^ y :=
rfl
#align nnreal.coe_rpow NNReal.coe_rpow
@[simp]
theorem rpow_zero (x : ℝ≥0) : x ^ (0 : ℝ) = 1 :=
NNReal.eq <| Real.rpow_zero _
#align nnreal.rpow_zero NNReal.rpow_zero
@[simp]
theorem rpow_eq_zero_iff {x : ℝ≥0} {y : ℝ} : x ^ y = 0 ↔ x = 0 ∧ y ≠ 0 := by
rw [← NNReal.coe_inj, coe_rpow, ← NNReal.coe_eq_zero]
exact Real.rpow_eq_zero_iff_of_nonneg x.2
#align nnreal.rpow_eq_zero_iff NNReal.rpow_eq_zero_iff
@[simp]
theorem zero_rpow {x : ℝ} (h : x ≠ 0) : (0 : ℝ≥0) ^ x = 0 :=
NNReal.eq <| Real.zero_rpow h
#align nnreal.zero_rpow NNReal.zero_rpow
@[simp]
theorem rpow_one (x : ℝ≥0) : x ^ (1 : ℝ) = x :=
NNReal.eq <| Real.rpow_one _
#align nnreal.rpow_one NNReal.rpow_one
@[simp]
theorem one_rpow (x : ℝ) : (1 : ℝ≥0) ^ x = 1 :=
NNReal.eq <| Real.one_rpow _
#align nnreal.one_rpow NNReal.one_rpow
theorem rpow_add {x : ℝ≥0} (hx : x ≠ 0) (y z : ℝ) : x ^ (y + z) = x ^ y * x ^ z :=
NNReal.eq <| Real.rpow_add (pos_iff_ne_zero.2 hx) _ _
#align nnreal.rpow_add NNReal.rpow_add
theorem rpow_add' (x : ℝ≥0) {y z : ℝ} (h : y + z ≠ 0) : x ^ (y + z) = x ^ y * x ^ z :=
NNReal.eq <| Real.rpow_add' x.2 h
#align nnreal.rpow_add' NNReal.rpow_add'
lemma rpow_of_add_eq (x : ℝ≥0) (hw : w ≠ 0) (h : y + z = w) : x ^ w = x ^ y * x ^ z := by
rw [← h, rpow_add']; rwa [h]
theorem rpow_mul (x : ℝ≥0) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z :=
NNReal.eq <| Real.rpow_mul x.2 y z
#align nnreal.rpow_mul NNReal.rpow_mul
theorem rpow_neg (x : ℝ≥0) (y : ℝ) : x ^ (-y) = (x ^ y)⁻¹ :=
NNReal.eq <| Real.rpow_neg x.2 _
#align nnreal.rpow_neg NNReal.rpow_neg
| Mathlib/Analysis/SpecialFunctions/Pow/NNReal.lean | 97 | 97 | theorem rpow_neg_one (x : ℝ≥0) : x ^ (-1 : ℝ) = x⁻¹ := by | simp [rpow_neg]
| [
" x ^ y = 0 ↔ x = 0 ∧ y ≠ 0",
" ↑x ^ y = ↑0 ↔ ↑x = 0 ∧ y ≠ 0",
" x ^ w = x ^ y * x ^ z",
" y + z ≠ 0",
" x ^ (-1) = x⁻¹"
] | [
" x ^ y = 0 ↔ x = 0 ∧ y ≠ 0",
" ↑x ^ y = ↑0 ↔ ↑x = 0 ∧ y ≠ 0",
" x ^ w = x ^ y * x ^ z",
" y + z ≠ 0"
] |
import Mathlib.Analysis.SpecialFunctions.Bernstein
import Mathlib.Topology.Algebra.Algebra
#align_import topology.continuous_function.weierstrass from "leanprover-community/mathlib"@"17ef379e997badd73e5eabb4d38f11919ab3c4b3"
open ContinuousMap Filter
open scoped unitInterval
theorem polynomialFunctions_closure_eq_top' : (polynomialFunctions I).topologicalClosure = ⊤ := by
rw [eq_top_iff]
rintro f -
refine Filter.Frequently.mem_closure ?_
refine Filter.Tendsto.frequently (bernsteinApproximation_uniform f) ?_
apply frequently_of_forall
intro n
simp only [SetLike.mem_coe]
apply Subalgebra.sum_mem
rintro n -
apply Subalgebra.smul_mem
dsimp [bernstein, polynomialFunctions]
simp
#align polynomial_functions_closure_eq_top' polynomialFunctions_closure_eq_top'
| Mathlib/Topology/ContinuousFunction/Weierstrass.lean | 54 | 79 | theorem polynomialFunctions_closure_eq_top (a b : ℝ) :
(polynomialFunctions (Set.Icc a b)).topologicalClosure = ⊤ := by |
cases' lt_or_le a b with h h
-- (Otherwise it's easy; we'll deal with that later.)
· -- We can pullback continuous functions on `[a,b]` to continuous functions on `[0,1]`,
-- by precomposing with an affine map.
let W : C(Set.Icc a b, ℝ) →ₐ[ℝ] C(I, ℝ) :=
compRightAlgHom ℝ ℝ (iccHomeoI a b h).symm.toContinuousMap
-- This operation is itself a homeomorphism
-- (with respect to the norm topologies on continuous functions).
let W' : C(Set.Icc a b, ℝ) ≃ₜ C(I, ℝ) := compRightHomeomorph ℝ (iccHomeoI a b h).symm
have w : (W : C(Set.Icc a b, ℝ) → C(I, ℝ)) = W' := rfl
-- Thus we take the statement of the Weierstrass approximation theorem for `[0,1]`,
have p := polynomialFunctions_closure_eq_top'
-- and pullback both sides, obtaining an equation between subalgebras of `C([a,b], ℝ)`.
apply_fun fun s => s.comap W at p
simp only [Algebra.comap_top] at p
-- Since the pullback operation is continuous, it commutes with taking `topologicalClosure`,
rw [Subalgebra.topologicalClosure_comap_homeomorph _ W W' w] at p
-- and precomposing with an affine map takes polynomial functions to polynomial functions.
rw [polynomialFunctions.comap_compRightAlgHom_iccHomeoI] at p
-- 🎉
exact p
· -- Otherwise, `b ≤ a`, and the interval is a subsingleton,
have : Subsingleton (Set.Icc a b) := (Set.subsingleton_Icc_of_ge h).coe_sort
apply Subsingleton.elim
| [
" (polynomialFunctions I).topologicalClosure = ⊤",
" ⊤ ≤ (polynomialFunctions I).topologicalClosure",
" f ∈ (polynomialFunctions I).topologicalClosure",
" ∃ᶠ (x : C(↑I, ℝ)) in nhds f, x ∈ ↑(polynomialFunctions I)",
" ∃ᶠ (x : ℕ) in atTop, bernsteinApproximation x f ∈ ↑(polynomialFunctions I)",
" ∀ (x : ℕ),... | [
" (polynomialFunctions I).topologicalClosure = ⊤",
" ⊤ ≤ (polynomialFunctions I).topologicalClosure",
" f ∈ (polynomialFunctions I).topologicalClosure",
" ∃ᶠ (x : C(↑I, ℝ)) in nhds f, x ∈ ↑(polynomialFunctions I)",
" ∃ᶠ (x : ℕ) in atTop, bernsteinApproximation x f ∈ ↑(polynomialFunctions I)",
" ∀ (x : ℕ),... |
import Mathlib.FieldTheory.PrimitiveElement
import Mathlib.LinearAlgebra.Determinant
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.Matrix.Charpoly.Minpoly
import Mathlib.LinearAlgebra.Matrix.ToLinearEquiv
import Mathlib.FieldTheory.IsAlgClosed.AlgebraicClosure
import Mathlib.FieldTheory.Galois
#align_import ring_theory.norm from "leanprover-community/mathlib"@"fecd3520d2a236856f254f27714b80dcfe28ea57"
universe u v w
variable {R S T : Type*} [CommRing R] [Ring S]
variable [Algebra R S]
variable {K L F : Type*} [Field K] [Field L] [Field F]
variable [Algebra K L] [Algebra K F]
variable {ι : Type w}
open FiniteDimensional
open LinearMap
open Matrix Polynomial
open scoped Matrix
namespace Algebra
variable (R)
noncomputable def norm : S →* R :=
LinearMap.det.comp (lmul R S).toRingHom.toMonoidHom
#align algebra.norm Algebra.norm
theorem norm_apply (x : S) : norm R x = LinearMap.det (lmul R S x) := rfl
#align algebra.norm_apply Algebra.norm_apply
theorem norm_eq_one_of_not_exists_basis (h : ¬∃ s : Finset S, Nonempty (Basis s R S)) (x : S) :
norm R x = 1 := by rw [norm_apply, LinearMap.det]; split_ifs <;> trivial
#align algebra.norm_eq_one_of_not_exists_basis Algebra.norm_eq_one_of_not_exists_basis
variable {R}
theorem norm_eq_one_of_not_module_finite (h : ¬Module.Finite R S) (x : S) : norm R x = 1 := by
refine norm_eq_one_of_not_exists_basis _ (mt ?_ h) _
rintro ⟨s, ⟨b⟩⟩
exact Module.Finite.of_basis b
#align algebra.norm_eq_one_of_not_module_finite Algebra.norm_eq_one_of_not_module_finite
-- Can't be a `simp` lemma because it depends on a choice of basis
theorem norm_eq_matrix_det [Fintype ι] [DecidableEq ι] (b : Basis ι R S) (s : S) :
norm R s = Matrix.det (Algebra.leftMulMatrix b s) := by
rw [norm_apply, ← LinearMap.det_toMatrix b, ← toMatrix_lmul_eq]; rfl
#align algebra.norm_eq_matrix_det Algebra.norm_eq_matrix_det
theorem norm_algebraMap_of_basis [Fintype ι] (b : Basis ι R S) (x : R) :
norm R (algebraMap R S x) = x ^ Fintype.card ι := by
haveI := Classical.decEq ι
rw [norm_apply, ← det_toMatrix b, lmul_algebraMap]
convert @det_diagonal _ _ _ _ _ fun _ : ι => x
· ext (i j); rw [toMatrix_lsmul]
· rw [Finset.prod_const, Finset.card_univ]
#align algebra.norm_algebra_map_of_basis Algebra.norm_algebraMap_of_basis
@[simp]
protected theorem norm_algebraMap {L : Type*} [Ring L] [Algebra K L] (x : K) :
norm K (algebraMap K L x) = x ^ finrank K L := by
by_cases H : ∃ s : Finset L, Nonempty (Basis s K L)
· rw [norm_algebraMap_of_basis H.choose_spec.some, finrank_eq_card_basis H.choose_spec.some]
· rw [norm_eq_one_of_not_exists_basis K H, finrank_eq_zero_of_not_exists_basis, pow_zero]
rintro ⟨s, ⟨b⟩⟩
exact H ⟨s, ⟨b⟩⟩
#align algebra.norm_algebra_map Algebra.norm_algebraMap
open IntermediateField
variable (K)
| Mathlib/RingTheory/Norm.lean | 197 | 207 | theorem norm_eq_norm_adjoin [FiniteDimensional K L] [IsSeparable K L] (x : L) :
norm K x = norm K (AdjoinSimple.gen K x) ^ finrank K⟮x⟯ L := by |
letI := isSeparable_tower_top_of_isSeparable K K⟮x⟯ L
let pbL := Field.powerBasisOfFiniteOfSeparable K⟮x⟯ L
let pbx := IntermediateField.adjoin.powerBasis (IsSeparable.isIntegral K x)
-- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
erw [← AdjoinSimple.algebraMap_gen K x, norm_eq_matrix_det (pbx.basis.smul pbL.basis) _,
smul_leftMulMatrix_algebraMap, det_blockDiagonal, norm_eq_matrix_det pbx.basis]
simp only [Finset.card_fin, Finset.prod_const]
congr
rw [← PowerBasis.finrank, AdjoinSimple.algebraMap_gen K x]
| [
" (norm R) x = 1",
" (if H : ∃ s, Nonempty (Basis { x // x ∈ s } R S) then detAux (Trunc.mk ⋯.some) else 1) ((lmul R S) x) = 1",
" (detAux (Trunc.mk ⋯.some)) ((lmul R S) x) = 1",
" 1 ((lmul R S) x) = 1",
" (∃ s, Nonempty (Basis { x // x ∈ s } R S)) → Module.Finite R S",
" Module.Finite R S",
" (norm R) ... | [
" (norm R) x = 1",
" (if H : ∃ s, Nonempty (Basis { x // x ∈ s } R S) then detAux (Trunc.mk ⋯.some) else 1) ((lmul R S) x) = 1",
" (detAux (Trunc.mk ⋯.some)) ((lmul R S) x) = 1",
" 1 ((lmul R S) x) = 1",
" (∃ s, Nonempty (Basis { x // x ∈ s } R S)) → Module.Finite R S",
" Module.Finite R S",
" (norm R) ... |
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Ring.Basic
import Mathlib.Algebra.Order.Sub.Defs
import Mathlib.Order.Hom.Basic
#align_import algebra.order.sub.basic from "leanprover-community/mathlib"@"10b4e499f43088dd3bb7b5796184ad5216648ab1"
variable {α β : Type*}
section Add
variable [Preorder α] [Add α] [Sub α] [OrderedSub α] {a b c d : α}
theorem AddHom.le_map_tsub [Preorder β] [Add β] [Sub β] [OrderedSub β] (f : AddHom α β)
(hf : Monotone f) (a b : α) : f a - f b ≤ f (a - b) := by
rw [tsub_le_iff_right, ← f.map_add]
exact hf le_tsub_add
#align add_hom.le_map_tsub AddHom.le_map_tsub
theorem le_mul_tsub {R : Type*} [Distrib R] [Preorder R] [Sub R] [OrderedSub R]
[CovariantClass R R (· * ·) (· ≤ ·)] {a b c : R} : a * b - a * c ≤ a * (b - c) :=
(AddHom.mulLeft a).le_map_tsub (monotone_id.const_mul' a) _ _
#align le_mul_tsub le_mul_tsub
| Mathlib/Algebra/Order/Sub/Basic.lean | 36 | 38 | theorem le_tsub_mul {R : Type*} [CommSemiring R] [Preorder R] [Sub R] [OrderedSub R]
[CovariantClass R R (· * ·) (· ≤ ·)] {a b c : R} : a * c - b * c ≤ (a - b) * c := by |
simpa only [mul_comm _ c] using le_mul_tsub
| [
" f a - f b ≤ f (a - b)",
" f a ≤ f (a - b + b)",
" a * c - b * c ≤ (a - b) * c"
] | [
" f a - f b ≤ f (a - b)",
" f a ≤ f (a - b + b)"
] |
import Mathlib.Algebra.Homology.Linear
import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex
import Mathlib.Tactic.Abel
#align_import algebra.homology.homotopy from "leanprover-community/mathlib"@"618ea3d5c99240cd7000d8376924906a148bf9ff"
universe v u
open scoped Classical
noncomputable section
open CategoryTheory Category Limits HomologicalComplex
variable {ι : Type*}
variable {V : Type u} [Category.{v} V] [Preadditive V]
variable {c : ComplexShape ι} {C D E : HomologicalComplex V c}
variable (f g : C ⟶ D) (h k : D ⟶ E) (i : ι)
section
def dNext (i : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X i ⟶ D.X i) :=
AddMonoidHom.mk' (fun f => C.d i (c.next i) ≫ f (c.next i) i) fun _ _ =>
Preadditive.comp_add _ _ _ _ _ _
#align d_next dNext
def fromNext (i : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.xNext i ⟶ D.X i) :=
AddMonoidHom.mk' (fun f => f (c.next i) i) fun _ _ => rfl
#align from_next fromNext
@[simp]
theorem dNext_eq_dFrom_fromNext (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) :
dNext i f = C.dFrom i ≫ fromNext i f :=
rfl
#align d_next_eq_d_from_from_next dNext_eq_dFrom_fromNext
theorem dNext_eq (f : ∀ i j, C.X i ⟶ D.X j) {i i' : ι} (w : c.Rel i i') :
dNext i f = C.d i i' ≫ f i' i := by
obtain rfl := c.next_eq' w
rfl
#align d_next_eq dNext_eq
lemma dNext_eq_zero (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) (hi : ¬ c.Rel i (c.next i)) :
dNext i f = 0 := by
dsimp [dNext]
rw [shape _ _ _ hi, zero_comp]
@[simp 1100]
theorem dNext_comp_left (f : C ⟶ D) (g : ∀ i j, D.X i ⟶ E.X j) (i : ι) :
(dNext i fun i j => f.f i ≫ g i j) = f.f i ≫ dNext i g :=
(f.comm_assoc _ _ _).symm
#align d_next_comp_left dNext_comp_left
@[simp 1100]
theorem dNext_comp_right (f : ∀ i j, C.X i ⟶ D.X j) (g : D ⟶ E) (i : ι) :
(dNext i fun i j => f i j ≫ g.f j) = dNext i f ≫ g.f i :=
(assoc _ _ _).symm
#align d_next_comp_right dNext_comp_right
def prevD (j : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X j ⟶ D.X j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j) ≫ D.d (c.prev j) j) fun _ _ =>
Preadditive.add_comp _ _ _ _ _ _
#align prev_d prevD
lemma prevD_eq_zero (f : ∀ i j, C.X i ⟶ D.X j) (i : ι) (hi : ¬ c.Rel (c.prev i) i) :
prevD i f = 0 := by
dsimp [prevD]
rw [shape _ _ _ hi, comp_zero]
def toPrev (j : ι) : (∀ i j, C.X i ⟶ D.X j) →+ (C.X j ⟶ D.xPrev j) :=
AddMonoidHom.mk' (fun f => f j (c.prev j)) fun _ _ => rfl
#align to_prev toPrev
@[simp]
theorem prevD_eq_toPrev_dTo (f : ∀ i j, C.X i ⟶ D.X j) (j : ι) :
prevD j f = toPrev j f ≫ D.dTo j :=
rfl
#align prev_d_eq_to_prev_d_to prevD_eq_toPrev_dTo
theorem prevD_eq (f : ∀ i j, C.X i ⟶ D.X j) {j j' : ι} (w : c.Rel j' j) :
prevD j f = f j j' ≫ D.d j' j := by
obtain rfl := c.prev_eq' w
rfl
#align prev_d_eq prevD_eq
@[simp 1100]
theorem prevD_comp_left (f : C ⟶ D) (g : ∀ i j, D.X i ⟶ E.X j) (j : ι) :
(prevD j fun i j => f.f i ≫ g i j) = f.f j ≫ prevD j g :=
assoc _ _ _
#align prev_d_comp_left prevD_comp_left
@[simp 1100]
| Mathlib/Algebra/Homology/Homotopy.lean | 109 | 112 | theorem prevD_comp_right (f : ∀ i j, C.X i ⟶ D.X j) (g : D ⟶ E) (j : ι) :
(prevD j fun i j => f i j ≫ g.f j) = prevD j f ≫ g.f j := by |
dsimp [prevD]
simp only [assoc, g.comm]
| [
" (dNext i) f = C.d i i' ≫ f i' i",
" (dNext i) f = C.d i (c.next i) ≫ f (c.next i) i",
" (dNext i) f = 0",
" C.d i (c.next i) ≫ f (c.next i) i = 0",
" (prevD i) f = 0",
" f i (c.prev i) ≫ D.d (c.prev i) i = 0",
" (prevD j) f = f j j' ≫ D.d j' j",
" (prevD j) f = f j (c.prev j) ≫ D.d (c.prev j) j",
... | [
" (dNext i) f = C.d i i' ≫ f i' i",
" (dNext i) f = C.d i (c.next i) ≫ f (c.next i) i",
" (dNext i) f = 0",
" C.d i (c.next i) ≫ f (c.next i) i = 0",
" (prevD i) f = 0",
" f i (c.prev i) ≫ D.d (c.prev i) i = 0",
" (prevD j) f = f j j' ≫ D.d j' j",
" (prevD j) f = f j (c.prev j) ≫ D.d (c.prev j) j"
] |
import Mathlib.Analysis.Convex.Between
import Mathlib.Analysis.Convex.Normed
import Mathlib.Analysis.Normed.Group.AddTorsor
#align_import analysis.convex.side from "leanprover-community/mathlib"@"a63928c34ec358b5edcda2bf7513c50052a5230f"
variable {R V V' P P' : Type*}
open AffineEquiv AffineMap
namespace AffineSubspace
section StrictOrderedCommRing
variable [StrictOrderedCommRing R] [AddCommGroup V] [Module R V] [AddTorsor V P]
variable [AddCommGroup V'] [Module R V'] [AddTorsor V' P']
def WSameSide (s : AffineSubspace R P) (x y : P) : Prop :=
∃ᵉ (p₁ ∈ s) (p₂ ∈ s), SameRay R (x -ᵥ p₁) (y -ᵥ p₂)
#align affine_subspace.w_same_side AffineSubspace.WSameSide
def SSameSide (s : AffineSubspace R P) (x y : P) : Prop :=
s.WSameSide x y ∧ x ∉ s ∧ y ∉ s
#align affine_subspace.s_same_side AffineSubspace.SSameSide
def WOppSide (s : AffineSubspace R P) (x y : P) : Prop :=
∃ᵉ (p₁ ∈ s) (p₂ ∈ s), SameRay R (x -ᵥ p₁) (p₂ -ᵥ y)
#align affine_subspace.w_opp_side AffineSubspace.WOppSide
def SOppSide (s : AffineSubspace R P) (x y : P) : Prop :=
s.WOppSide x y ∧ x ∉ s ∧ y ∉ s
#align affine_subspace.s_opp_side AffineSubspace.SOppSide
theorem WSameSide.map {s : AffineSubspace R P} {x y : P} (h : s.WSameSide x y) (f : P →ᵃ[R] P') :
(s.map f).WSameSide (f x) (f y) := by
rcases h with ⟨p₁, hp₁, p₂, hp₂, h⟩
refine ⟨f p₁, mem_map_of_mem f hp₁, f p₂, mem_map_of_mem f hp₂, ?_⟩
simp_rw [← linearMap_vsub]
exact h.map f.linear
#align affine_subspace.w_same_side.map AffineSubspace.WSameSide.map
| Mathlib/Analysis/Convex/Side.lean | 70 | 80 | theorem _root_.Function.Injective.wSameSide_map_iff {s : AffineSubspace R P} {x y : P}
{f : P →ᵃ[R] P'} (hf : Function.Injective f) :
(s.map f).WSameSide (f x) (f y) ↔ s.WSameSide x y := by |
refine ⟨fun h => ?_, fun h => h.map _⟩
rcases h with ⟨fp₁, hfp₁, fp₂, hfp₂, h⟩
rw [mem_map] at hfp₁ hfp₂
rcases hfp₁ with ⟨p₁, hp₁, rfl⟩
rcases hfp₂ with ⟨p₂, hp₂, rfl⟩
refine ⟨p₁, hp₁, p₂, hp₂, ?_⟩
simp_rw [← linearMap_vsub, (f.linear_injective_iff.2 hf).sameRay_map_iff] at h
exact h
| [
" (AffineSubspace.map f s).WSameSide (f x) (f y)",
" SameRay R (f x -ᵥ f p₁) (f y -ᵥ f p₂)",
" SameRay R (f.linear (x -ᵥ p₁)) (f.linear (y -ᵥ p₂))",
" (map f s).WSameSide (f x) (f y) ↔ s.WSameSide x y",
" s.WSameSide x y",
" SameRay R (x -ᵥ p₁) (y -ᵥ p₂)"
] | [
" (AffineSubspace.map f s).WSameSide (f x) (f y)",
" SameRay R (f x -ᵥ f p₁) (f y -ᵥ f p₂)",
" SameRay R (f.linear (x -ᵥ p₁)) (f.linear (y -ᵥ p₂))"
] |
import Mathlib.MeasureTheory.Constructions.BorelSpace.Order
#align_import measure_theory.constructions.borel_space.basic from "leanprover-community/mathlib"@"9f55d0d4363ae59948c33864cbc52e0b12e0e8ce"
open Set Filter MeasureTheory MeasurableSpace
open scoped Classical Topology NNReal ENNReal MeasureTheory
universe u v w x y
variable {α β γ δ : Type*} {ι : Sort y} {s t u : Set α}
namespace Real
theorem borel_eq_generateFrom_Ioo_rat :
borel ℝ = .generateFrom (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) :=
isTopologicalBasis_Ioo_rat.borel_eq_generateFrom
#align real.borel_eq_generate_from_Ioo_rat Real.borel_eq_generateFrom_Ioo_rat
theorem borel_eq_generateFrom_Iio_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iio (a : ℝ)}) := by
rw [borel_eq_generateFrom_Iio]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsLUB (range ((↑) : ℚ → ℝ) ∩ Iio a) a := by
simp [isLUB_iff_le_iff, mem_upperBounds, ← le_iff_forall_rat_lt_imp_le]
rw [← this.biUnion_Iio_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Iio (b : ℝ)) (by simp)
theorem borel_eq_generateFrom_Ioi_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ioi (a : ℝ)}) := by
rw [borel_eq_generateFrom_Ioi]
refine le_antisymm
(generateFrom_le ?_)
(generateFrom_mono <| iUnion_subset fun q ↦ singleton_subset_iff.mpr <| mem_range_self _)
rintro _ ⟨a, rfl⟩
have : IsGLB (range ((↑) : ℚ → ℝ) ∩ Ioi a) a := by
simp [isGLB_iff_le_iff, mem_lowerBounds, ← le_iff_forall_lt_rat_imp_le]
rw [← this.biUnion_Ioi_eq, ← image_univ, ← image_inter_preimage, univ_inter, biUnion_image]
exact MeasurableSet.biUnion (to_countable _)
fun b _ => GenerateMeasurable.basic (Ioi (b : ℝ)) (by simp)
theorem borel_eq_generateFrom_Iic_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Iic (a : ℝ)}) := by
rw [borel_eq_generateFrom_Ioi_rat, iUnion_singleton_eq_range, iUnion_singleton_eq_range]
refine le_antisymm (generateFrom_le ?_) (generateFrom_le ?_) <;>
rintro _ ⟨q, rfl⟩ <;>
dsimp only <;>
[rw [← compl_Iic]; rw [← compl_Ioi]] <;>
exact MeasurableSet.compl (GenerateMeasurable.basic _ (mem_range_self q))
theorem borel_eq_generateFrom_Ici_rat : borel ℝ = .generateFrom (⋃ a : ℚ, {Ici (a : ℝ)}) := by
rw [borel_eq_generateFrom_Iio_rat, iUnion_singleton_eq_range, iUnion_singleton_eq_range]
refine le_antisymm (generateFrom_le ?_) (generateFrom_le ?_) <;>
rintro _ ⟨q, rfl⟩ <;>
dsimp only <;>
[rw [← compl_Ici]; rw [← compl_Iio]] <;>
exact MeasurableSet.compl (GenerateMeasurable.basic _ (mem_range_self q))
theorem isPiSystem_Ioo_rat :
IsPiSystem (⋃ (a : ℚ) (b : ℚ) (_ : a < b), {Ioo (a : ℝ) (b : ℝ)}) := by
convert isPiSystem_Ioo ((↑) : ℚ → ℝ) ((↑) : ℚ → ℝ)
ext x
simp [eq_comm]
#align real.is_pi_system_Ioo_rat Real.isPiSystem_Ioo_rat
| Mathlib/MeasureTheory/Constructions/BorelSpace/Real.lean | 91 | 94 | theorem isPiSystem_Iio_rat : IsPiSystem (⋃ a : ℚ, {Iio (a : ℝ)}) := by |
convert isPiSystem_image_Iio (((↑) : ℚ → ℝ) '' univ)
ext x
simp only [iUnion_singleton_eq_range, mem_range, image_univ, mem_image, exists_exists_eq_and]
| [
" borel ℝ = generateFrom (⋃ a, {Iio ↑a})",
" generateFrom (range Iio) = generateFrom (⋃ a, {Iio ↑a})",
" ∀ t ∈ range Iio, MeasurableSet t",
" MeasurableSet (Iio a)",
" IsLUB (range Rat.cast ∩ Iio a) a",
" MeasurableSet (⋃ y ∈ Rat.cast ⁻¹' Iio a, Iio ↑y)",
" Iio ↑b ∈ ⋃ a, {Iio ↑a}",
" borel ℝ = generat... | [
" borel ℝ = generateFrom (⋃ a, {Iio ↑a})",
" generateFrom (range Iio) = generateFrom (⋃ a, {Iio ↑a})",
" ∀ t ∈ range Iio, MeasurableSet t",
" MeasurableSet (Iio a)",
" IsLUB (range Rat.cast ∩ Iio a) a",
" MeasurableSet (⋃ y ∈ Rat.cast ⁻¹' Iio a, Iio ↑y)",
" Iio ↑b ∈ ⋃ a, {Iio ↑a}",
" borel ℝ = generat... |
import Mathlib.Algebra.Module.Submodule.Ker
open Function Submodule
namespace LinearMap
variable {R N M : Type*} [Semiring R] [AddCommMonoid N] [Module R N]
[AddCommMonoid M] [Module R M] (f i : N →ₗ[R] M)
def iterateMapComap (n : ℕ) := (fun K : Submodule R N ↦ (K.map i).comap f)^[n]
theorem iterateMapComap_le_succ (K : Submodule R N) (h : K.map f ≤ K.map i) (n : ℕ) :
f.iterateMapComap i n K ≤ f.iterateMapComap i (n + 1) K := by
nth_rw 2 [iterateMapComap]
rw [iterate_succ', Function.comp_apply, ← iterateMapComap, ← map_le_iff_le_comap]
induction n with
| zero => exact h
| succ n ih =>
simp_rw [iterateMapComap, iterate_succ', Function.comp_apply]
calc
_ ≤ (f.iterateMapComap i n K).map i := map_comap_le _ _
_ ≤ (((f.iterateMapComap i n K).map f).comap f).map i := map_mono (le_comap_map _ _)
_ ≤ _ := map_mono (comap_mono ih)
theorem iterateMapComap_eq_succ (K : Submodule R N)
(m : ℕ) (heq : f.iterateMapComap i m K = f.iterateMapComap i (m + 1) K)
(hf : Surjective f) (hi : Injective i) (n : ℕ) :
f.iterateMapComap i n K = f.iterateMapComap i (n + 1) K := by
induction n with
| zero =>
contrapose! heq
induction m with
| zero => exact heq
| succ m ih =>
rw [iterateMapComap, iterateMapComap, iterate_succ', iterate_succ']
exact fun H ↦ ih (map_injective_of_injective hi (comap_injective_of_surjective hf H))
| succ n ih =>
rw [iterateMapComap, iterateMapComap, iterate_succ', iterate_succ',
Function.comp_apply, Function.comp_apply, ← iterateMapComap, ← iterateMapComap, ih]
| Mathlib/Algebra/Module/Submodule/IterateMapComap.lean | 88 | 92 | theorem ker_le_of_iterateMapComap_eq_succ (K : Submodule R N)
(m : ℕ) (heq : f.iterateMapComap i m K = f.iterateMapComap i (m + 1) K)
(hf : Surjective f) (hi : Injective i) : LinearMap.ker f ≤ K := by |
rw [show K = _ from f.iterateMapComap_eq_succ i K m heq hf hi 0]
exact f.ker_le_comap
| [
" f.iterateMapComap i n K ≤ f.iterateMapComap i (n + 1) K",
" f.iterateMapComap i n K ≤ (fun K => comap f (map i K))^[n + 1] K",
" map f (f.iterateMapComap i n K) ≤ map i (f.iterateMapComap i n K)",
" map f (f.iterateMapComap i 0 K) ≤ map i (f.iterateMapComap i 0 K)",
" map f (f.iterateMapComap i (n + 1) K)... | [
" f.iterateMapComap i n K ≤ f.iterateMapComap i (n + 1) K",
" f.iterateMapComap i n K ≤ (fun K => comap f (map i K))^[n + 1] K",
" map f (f.iterateMapComap i n K) ≤ map i (f.iterateMapComap i n K)",
" map f (f.iterateMapComap i 0 K) ≤ map i (f.iterateMapComap i 0 K)",
" map f (f.iterateMapComap i (n + 1) K)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.