state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
case this.Hcont
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
β’ ContinuousOn (fun x => iteratedFDerivWithin π m f t x) t | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
| apply (H.iteratedFDeriv m).continuousOn.congr | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hcont
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
β’ Set.EqOn (fun x => iteratedFDerivWithin π m f t x) (_root_.iteratedFDeriv π m f) t | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
| intro x hx | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hcont
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
xβ : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
x : E
hx : x β t
β’ (fun x => iteratedFDerivWithin π m f t x) x = _root_.iteratedFDeriv π m f x | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
| exact iteratedFDerivWithin_of_isOpen _ t_open hx | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hdiff
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
β’ β (m : β), βm < n β DifferentiableOn π (fun x => iteratedFDerivWithin π m f t x) t | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· | rintro m - | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· | Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hdiff
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
β’ DifferentiableOn π (fun x => iteratedFDerivWithin π m f t x) t | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
| apply (H.iteratedFDeriv m).differentiableOn.congr | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hdiff
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
β’ β x β t, iteratedFDerivWithin π m f t x = _root_.iteratedFDeriv π m f x | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
| intro x hx | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case this.Hdiff
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
xβ : E
s : Set E
instβ : CompleteSpace F
h : AnalyticOn π f s
n : ββ
t : Set E := {x | AnalyticAt π f x}
H : AnalyticOn π f t
t_open : IsOpen t
m : β
x : E
hx : x β t
β’ iteratedFDerivWithin π m f t x = _root_.iteratedFDeriv π m f x | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
| exact iteratedFDerivWithin_of_isOpen _ t_open hx | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
| Mathlib.Analysis.Calculus.FDeriv.Analytic.143_0.XLJ3uW4JYwyXQcn | /-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
s : Set E
instβ : CompleteSpace F
h : AnalyticAt π f x
n : ββ
β’ ContDiffAt π n f x | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
#align analytic_on.cont_diff_on AnalyticOn.contDiffOn
theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
| obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn | theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
| Mathlib.Analysis.Calculus.FDeriv.Analytic.161_0.XLJ3uW4JYwyXQcn | theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case intro.intro
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π E F
r : ββ₯0β
f : E β F
x : E
sβ : Set E
instβ : CompleteSpace F
h : AnalyticAt π f x
n : ββ
s : Set E
hs : s β nhds x
hf : AnalyticOn π f s
β’ ContDiffAt π n f x | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
#align analytic_on.cont_diff_on AnalyticOn.contDiffOn
theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn
| exact hf.contDiffOn.contDiffAt hs | theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn
| Mathlib.Analysis.Calculus.FDeriv.Analytic.161_0.XLJ3uW4JYwyXQcn | theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x | Mathlib_Analysis_Calculus_FDeriv_Analytic |
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π π F
r : ββ₯0β
f : π β F
x : π
s : Set π
instβ : CompleteSpace F
h : AnalyticOn π f s
n : β
β’ AnalyticOn π (_root_.deriv^[n] f) s | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
#align analytic_on.cont_diff_on AnalyticOn.contDiffOn
theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn
exact hf.contDiffOn.contDiffAt hs
end fderiv
section deriv
variable {p : FormalMultilinearSeries π π F} {r : ββ₯0β}
variable {f : π β F} {x : π} {s : Set π}
protected theorem HasFPowerSeriesAt.hasStrictDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictFDerivAt.hasStrictDerivAt
#align has_fpower_series_at.has_strict_deriv_at HasFPowerSeriesAt.hasStrictDerivAt
protected theorem HasFPowerSeriesAt.hasDerivAt (h : HasFPowerSeriesAt f p x) :
HasDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictDerivAt.hasDerivAt
#align has_fpower_series_at.has_deriv_at HasFPowerSeriesAt.hasDerivAt
protected theorem HasFPowerSeriesAt.deriv (h : HasFPowerSeriesAt f p x) :
deriv f x = p 1 fun _ => 1 :=
h.hasDerivAt.deriv
#align has_fpower_series_at.deriv HasFPowerSeriesAt.deriv
/-- If a function is analytic on a set `s`, so is its derivative. -/
theorem AnalyticOn.deriv [CompleteSpace F] (h : AnalyticOn π f s) : AnalyticOn π (deriv f) s :=
(ContinuousLinearMap.apply π F (1 : π)).comp_analyticOn h.fderiv
#align analytic_on.deriv AnalyticOn.deriv
/-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
| induction' n with n IH | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
| Mathlib.Analysis.Calculus.FDeriv.Analytic.194_0.XLJ3uW4JYwyXQcn | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case zero
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π π F
r : ββ₯0β
f : π β F
x : π
s : Set π
instβ : CompleteSpace F
h : AnalyticOn π f s
β’ AnalyticOn π (_root_.deriv^[Nat.zero] f) s | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
#align analytic_on.cont_diff_on AnalyticOn.contDiffOn
theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn
exact hf.contDiffOn.contDiffAt hs
end fderiv
section deriv
variable {p : FormalMultilinearSeries π π F} {r : ββ₯0β}
variable {f : π β F} {x : π} {s : Set π}
protected theorem HasFPowerSeriesAt.hasStrictDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictFDerivAt.hasStrictDerivAt
#align has_fpower_series_at.has_strict_deriv_at HasFPowerSeriesAt.hasStrictDerivAt
protected theorem HasFPowerSeriesAt.hasDerivAt (h : HasFPowerSeriesAt f p x) :
HasDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictDerivAt.hasDerivAt
#align has_fpower_series_at.has_deriv_at HasFPowerSeriesAt.hasDerivAt
protected theorem HasFPowerSeriesAt.deriv (h : HasFPowerSeriesAt f p x) :
deriv f x = p 1 fun _ => 1 :=
h.hasDerivAt.deriv
#align has_fpower_series_at.deriv HasFPowerSeriesAt.deriv
/-- If a function is analytic on a set `s`, so is its derivative. -/
theorem AnalyticOn.deriv [CompleteSpace F] (h : AnalyticOn π f s) : AnalyticOn π (deriv f) s :=
(ContinuousLinearMap.apply π F (1 : π)).comp_analyticOn h.fderiv
#align analytic_on.deriv AnalyticOn.deriv
/-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
induction' n with n IH
Β· | exact h | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
induction' n with n IH
Β· | Mathlib.Analysis.Calculus.FDeriv.Analytic.194_0.XLJ3uW4JYwyXQcn | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
case succ
π : Type u_1
instββ΅ : NontriviallyNormedField π
E : Type u_2
instββ΄ : NormedAddCommGroup E
instβΒ³ : NormedSpace π E
F : Type u_3
instβΒ² : NormedAddCommGroup F
instβΒΉ : NormedSpace π F
p : FormalMultilinearSeries π π F
r : ββ₯0β
f : π β F
x : π
s : Set π
instβ : CompleteSpace F
h : AnalyticOn π f s
n : β
IH : AnalyticOn π (_root_.deriv^[n] f) s
β’ AnalyticOn π (_root_.deriv^[Nat.succ n] f) s | /-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
-/
import Mathlib.Analysis.Analytic.Basic
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.ContDiff.Defs
#align_import analysis.calculus.fderiv_analytic from "leanprover-community/mathlib"@"3bce8d800a6f2b8f63fe1e588fd76a9ff4adcebe"
/-!
# Frechet derivatives of analytic functions.
A function expressible as a power series at a point has a Frechet derivative there.
Also the special case in terms of `deriv` when the domain is 1-dimensional.
-/
open Filter Asymptotics
open scoped ENNReal
variable {π : Type*} [NontriviallyNormedField π]
variable {E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
variable {F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
section fderiv
variable {p : FormalMultilinearSeries π E F} {r : ββ₯0β}
variable {f : E β F} {x : E} {s : Set E}
theorem HasFPowerSeriesAt.hasStrictFDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x := by
refine' h.isBigO_image_sub_norm_mul_norm_sub.trans_isLittleO (IsLittleO.of_norm_right _)
refine' isLittleO_iff_exists_eq_mul.2 β¨fun y => βy - (x, x)β, _, EventuallyEq.rflβ©
refine' (continuous_id.sub continuous_const).norm.tendsto' _ _ _
rw [_root_.id, sub_self, norm_zero]
#align has_fpower_series_at.has_strict_fderiv_at HasFPowerSeriesAt.hasStrictFDerivAt
theorem HasFPowerSeriesAt.hasFDerivAt (h : HasFPowerSeriesAt f p x) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p 1)) x :=
h.hasStrictFDerivAt.hasFDerivAt
#align has_fpower_series_at.has_fderiv_at HasFPowerSeriesAt.hasFDerivAt
theorem HasFPowerSeriesAt.differentiableAt (h : HasFPowerSeriesAt f p x) : DifferentiableAt π f x :=
h.hasFDerivAt.differentiableAt
#align has_fpower_series_at.differentiable_at HasFPowerSeriesAt.differentiableAt
theorem AnalyticAt.differentiableAt : AnalyticAt π f x β DifferentiableAt π f x
| β¨_, hpβ© => hp.differentiableAt
#align analytic_at.differentiable_at AnalyticAt.differentiableAt
theorem AnalyticAt.differentiableWithinAt (h : AnalyticAt π f x) : DifferentiableWithinAt π f s x :=
h.differentiableAt.differentiableWithinAt
#align analytic_at.differentiable_within_at AnalyticAt.differentiableWithinAt
theorem HasFPowerSeriesAt.fderiv_eq (h : HasFPowerSeriesAt f p x) :
fderiv π f x = continuousMultilinearCurryFin1 π E F (p 1) :=
h.hasFDerivAt.fderiv
#align has_fpower_series_at.fderiv_eq HasFPowerSeriesAt.fderiv_eq
theorem HasFPowerSeriesOnBall.differentiableOn [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) : DifferentiableOn π f (EMetric.ball x r) := fun _ hy =>
(h.analyticAt_of_mem hy).differentiableWithinAt
#align has_fpower_series_on_ball.differentiable_on HasFPowerSeriesOnBall.differentiableOn
theorem AnalyticOn.differentiableOn (h : AnalyticOn π f s) : DifferentiableOn π f s := fun y hy =>
(h y hy).differentiableWithinAt
#align analytic_on.differentiable_on AnalyticOn.differentiableOn
theorem HasFPowerSeriesOnBall.hasFDerivAt [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
HasFDerivAt f (continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1)) (x + y) :=
(h.changeOrigin hy).hasFPowerSeriesAt.hasFDerivAt
#align has_fpower_series_on_ball.has_fderiv_at HasFPowerSeriesOnBall.hasFDerivAt
theorem HasFPowerSeriesOnBall.fderiv_eq [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r)
{y : E} (hy : (βyββ : ββ₯0β) < r) :
fderiv π f (x + y) = continuousMultilinearCurryFin1 π E F (p.changeOrigin y 1) :=
(h.hasFDerivAt hy).fderiv
#align has_fpower_series_on_ball.fderiv_eq HasFPowerSeriesOnBall.fderiv_eq
/-- If a function has a power series on a ball, then so does its derivative. -/
theorem HasFPowerSeriesOnBall.fderiv [CompleteSpace F] (h : HasFPowerSeriesOnBall f p x r) :
HasFPowerSeriesOnBall (fderiv π f)
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r := by
suffices A :
HasFPowerSeriesOnBall
(fun z => continuousMultilinearCurryFin1 π E F (p.changeOrigin (z - x) 1))
((continuousMultilinearCurryFin1 π E F :
(E[Γ1]βL[π] F) βL[π] E βL[π] F).compFormalMultilinearSeries
(p.changeOriginSeries 1))
x r
Β· apply A.congr
intro z hz
dsimp
rw [β h.fderiv_eq, add_sub_cancel'_right]
simpa only [edist_eq_coe_nnnorm_sub, EMetric.mem_ball] using hz
suffices B :
HasFPowerSeriesOnBall (fun z => p.changeOrigin (z - x) 1) (p.changeOriginSeries 1) x r
exact
(continuousMultilinearCurryFin1 π E
F).toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesOnBall
B
simpa using
((p.hasFPowerSeriesOnBall_changeOrigin 1 (h.r_pos.trans_le h.r_le)).mono h.r_pos
h.r_le).comp_sub
x
#align has_fpower_series_on_ball.fderiv HasFPowerSeriesOnBall.fderiv
/-- If a function is analytic on a set `s`, so is its FrΓ©chet derivative. -/
theorem AnalyticOn.fderiv [CompleteSpace F] (h : AnalyticOn π f s) :
AnalyticOn π (fderiv π f) s := by
intro y hy
rcases h y hy with β¨p, r, hpβ©
exact hp.fderiv.analyticAt
#align analytic_on.fderiv AnalyticOn.fderiv
/-- If a function is analytic on a set `s`, so are its successive FrΓ©chet derivative. -/
theorem AnalyticOn.iteratedFDeriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (iteratedFDeriv π n f) s := by
induction' n with n IH
Β· rw [iteratedFDeriv_zero_eq_comp]
exact ((continuousMultilinearCurryFin0 π E F).symm : F βL[π] E[Γ0]βL[π] F).comp_analyticOn h
Β· rw [iteratedFDeriv_succ_eq_comp_left]
-- Porting note: for reasons that I do not understand at all, `?g` cannot be inlined.
convert @ContinuousLinearMap.comp_analyticOn π E
?_ (ContinuousMultilinearMap π (fun _ : Fin (n + 1) β¦ E) F)
?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_
s ?g IH.fderiv
case g =>
exact β(continuousMultilinearCurryLeftEquiv π (fun _ : Fin (n + 1) => E) F)
rfl
#align analytic_on.iterated_fderiv AnalyticOn.iteratedFDeriv
/-- An analytic function is infinitely differentiable. -/
theorem AnalyticOn.contDiffOn [CompleteSpace F] (h : AnalyticOn π f s) {n : ββ} :
ContDiffOn π n f s := by
let t := { x | AnalyticAt π f x }
suffices : ContDiffOn π n f t; exact this.mono h
have H : AnalyticOn π f t := fun x hx => hx
have t_open : IsOpen t := isOpen_analyticAt π f
apply contDiffOn_of_continuousOn_differentiableOn
Β· rintro m -
apply (H.iteratedFDeriv m).continuousOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
Β· rintro m -
apply (H.iteratedFDeriv m).differentiableOn.congr
intro x hx
exact iteratedFDerivWithin_of_isOpen _ t_open hx
#align analytic_on.cont_diff_on AnalyticOn.contDiffOn
theorem AnalyticAt.contDiffAt [CompleteSpace F] (h : AnalyticAt π f x) {n : ββ} :
ContDiffAt π n f x := by
obtain β¨s, hs, hfβ© := h.exists_mem_nhds_analyticOn
exact hf.contDiffOn.contDiffAt hs
end fderiv
section deriv
variable {p : FormalMultilinearSeries π π F} {r : ββ₯0β}
variable {f : π β F} {x : π} {s : Set π}
protected theorem HasFPowerSeriesAt.hasStrictDerivAt (h : HasFPowerSeriesAt f p x) :
HasStrictDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictFDerivAt.hasStrictDerivAt
#align has_fpower_series_at.has_strict_deriv_at HasFPowerSeriesAt.hasStrictDerivAt
protected theorem HasFPowerSeriesAt.hasDerivAt (h : HasFPowerSeriesAt f p x) :
HasDerivAt f (p 1 fun _ => 1) x :=
h.hasStrictDerivAt.hasDerivAt
#align has_fpower_series_at.has_deriv_at HasFPowerSeriesAt.hasDerivAt
protected theorem HasFPowerSeriesAt.deriv (h : HasFPowerSeriesAt f p x) :
deriv f x = p 1 fun _ => 1 :=
h.hasDerivAt.deriv
#align has_fpower_series_at.deriv HasFPowerSeriesAt.deriv
/-- If a function is analytic on a set `s`, so is its derivative. -/
theorem AnalyticOn.deriv [CompleteSpace F] (h : AnalyticOn π f s) : AnalyticOn π (deriv f) s :=
(ContinuousLinearMap.apply π F (1 : π)).comp_analyticOn h.fderiv
#align analytic_on.deriv AnalyticOn.deriv
/-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
induction' n with n IH
Β· exact h
Β· | simpa only [Function.iterate_succ', Function.comp_apply] using IH.deriv | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s := by
induction' n with n IH
Β· exact h
Β· | Mathlib.Analysis.Calculus.FDeriv.Analytic.194_0.XLJ3uW4JYwyXQcn | /-- If a function is analytic on a set `s`, so are its successive derivatives. -/
theorem AnalyticOn.iterated_deriv [CompleteSpace F] (h : AnalyticOn π f s) (n : β) :
AnalyticOn π (_root_.deriv^[n] f) s | Mathlib_Analysis_Calculus_FDeriv_Analytic |
F : Type u
K : Type v
A : Type w
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
β’ lift.{w, v} (Module.rank F K) * lift.{v, w} (Module.rank K A) = lift.{v, w} (Module.rank F A) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
| obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K) | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
| Mathlib.FieldTheory.Tower.51_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) | Mathlib_FieldTheory_Tower |
case intro.mk
F : Type u
K : Type v
A : Type w
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
fstβ : Type v
b : Basis fstβ F K
β’ lift.{w, v} (Module.rank F K) * lift.{v, w} (Module.rank K A) = lift.{v, w} (Module.rank F A) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
| obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A) | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
| Mathlib.FieldTheory.Tower.51_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) | Mathlib_FieldTheory_Tower |
case intro.mk.intro.mk
F : Type u
K : Type v
A : Type w
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
fstβΒΉ : Type v
b : Basis fstβΒΉ F K
fstβ : Type w
c : Basis fstβ K A
β’ lift.{w, v} (Module.rank F K) * lift.{v, w} (Module.rank K A) = lift.{v, w} (Module.rank F A) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
| rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}] | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
| Mathlib.FieldTheory.Tower.51_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) | Mathlib_FieldTheory_Tower |
Fβ : Type u
Kβ : Type v
Aβ : Type w
instβΒ²ΒΉ : CommRing Fβ
instβΒ²β° : Ring Kβ
instβΒΉβΉ : AddCommGroup Aβ
instβΒΉβΈ : Algebra Fβ Kβ
instβΒΉβ· : Module Kβ Aβ
instβΒΉβΆ : Module Fβ Aβ
instβΒΉβ΅ : IsScalarTower Fβ Kβ Aβ
instβΒΉβ΄ : StrongRankCondition Fβ
instβΒΉΒ³ : StrongRankCondition Kβ
instβΒΉΒ² : Module.Free Fβ Kβ
instβΒΉΒΉ : Module.Free Kβ Aβ
F : Type u
K A : Type v
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
β’ Module.rank F K * Module.rank K A = Module.rank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
| convert lift_rank_mul_lift_rank F K A | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
| Mathlib.FieldTheory.Tower.65_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A | Mathlib_FieldTheory_Tower |
case h.e'_2.h.e'_5
Fβ : Type u
Kβ : Type v
Aβ : Type w
instβΒ²ΒΉ : CommRing Fβ
instβΒ²β° : Ring Kβ
instβΒΉβΉ : AddCommGroup Aβ
instβΒΉβΈ : Algebra Fβ Kβ
instβΒΉβ· : Module Kβ Aβ
instβΒΉβΆ : Module Fβ Aβ
instβΒΉβ΅ : IsScalarTower Fβ Kβ Aβ
instβΒΉβ΄ : StrongRankCondition Fβ
instβΒΉΒ³ : StrongRankCondition Kβ
instβΒΉΒ² : Module.Free Fβ Kβ
instβΒΉΒΉ : Module.Free Kβ Aβ
F : Type u
K A : Type v
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
β’ Module.rank F K = lift.{v, v} (Module.rank F K) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | rw [lift_id] | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | Mathlib.FieldTheory.Tower.65_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A | Mathlib_FieldTheory_Tower |
case h.e'_2.h.e'_6
Fβ : Type u
Kβ : Type v
Aβ : Type w
instβΒ²ΒΉ : CommRing Fβ
instβΒ²β° : Ring Kβ
instβΒΉβΉ : AddCommGroup Aβ
instβΒΉβΈ : Algebra Fβ Kβ
instβΒΉβ· : Module Kβ Aβ
instβΒΉβΆ : Module Fβ Aβ
instβΒΉβ΅ : IsScalarTower Fβ Kβ Aβ
instβΒΉβ΄ : StrongRankCondition Fβ
instβΒΉΒ³ : StrongRankCondition Kβ
instβΒΉΒ² : Module.Free Fβ Kβ
instβΒΉΒΉ : Module.Free Kβ Aβ
F : Type u
K A : Type v
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
β’ Module.rank K A = lift.{v, v} (Module.rank K A) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | rw [lift_id] | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | Mathlib.FieldTheory.Tower.65_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A | Mathlib_FieldTheory_Tower |
case h.e'_3
Fβ : Type u
Kβ : Type v
Aβ : Type w
instβΒ²ΒΉ : CommRing Fβ
instβΒ²β° : Ring Kβ
instβΒΉβΉ : AddCommGroup Aβ
instβΒΉβΈ : Algebra Fβ Kβ
instβΒΉβ· : Module Kβ Aβ
instβΒΉβΆ : Module Fβ Aβ
instβΒΉβ΅ : IsScalarTower Fβ Kβ Aβ
instβΒΉβ΄ : StrongRankCondition Fβ
instβΒΉΒ³ : StrongRankCondition Kβ
instβΒΉΒ² : Module.Free Fβ Kβ
instβΒΉΒΉ : Module.Free Kβ Aβ
F : Type u
K A : Type v
instβΒΉβ° : CommRing F
instββΉ : Ring K
instββΈ : AddCommGroup A
instββ· : Algebra F K
instββΆ : Module K A
instββ΅ : Module F A
instββ΄ : IsScalarTower F K A
instβΒ³ : StrongRankCondition F
instβΒ² : StrongRankCondition K
instβΒΉ : Module.Free F K
instβ : Module.Free K A
β’ Module.rank F A = lift.{v, v} (Module.rank F A) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | rw [lift_id] | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> | Mathlib.FieldTheory.Tower.65_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instβΒΉΒ² : CommRing F
instβΒΉΒΉ : Ring K
instβΒΉβ° : AddCommGroup A
instββΉ : Algebra F K
instββΈ : Module K A
instββ· : Module F A
instββΆ : IsScalarTower F K A
instββ΅ : StrongRankCondition F
instββ΄ : StrongRankCondition K
instβΒ³ : Module.Free F K
instβΒ² : Module.Free K A
instβΒΉ : Module.Finite F K
instβ : Module.Finite K A
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
| letI := nontrivial_of_invariantBasisNumber F | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
| Mathlib.FieldTheory.Tower.76_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instβΒΉΒ² : CommRing F
instβΒΉΒΉ : Ring K
instβΒΉβ° : AddCommGroup A
instββΉ : Algebra F K
instββΈ : Module K A
instββ· : Module F A
instββΆ : IsScalarTower F K A
instββ΅ : StrongRankCondition F
instββ΄ : StrongRankCondition K
instβΒ³ : Module.Free F K
instβΒ² : Module.Free K A
instβΒΉ : Module.Finite F K
instβ : Module.Finite K A
this : Nontrivial F := nontrivial_of_invariantBasisNumber F
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
| let b := Module.Free.chooseBasis F K | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
| Mathlib.FieldTheory.Tower.76_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instβΒΉΒ² : CommRing F
instβΒΉΒΉ : Ring K
instβΒΉβ° : AddCommGroup A
instββΉ : Algebra F K
instββΈ : Module K A
instββ· : Module F A
instββΆ : IsScalarTower F K A
instββ΅ : StrongRankCondition F
instββ΄ : StrongRankCondition K
instβΒ³ : Module.Free F K
instβΒ² : Module.Free K A
instβΒΉ : Module.Finite F K
instβ : Module.Finite K A
this : Nontrivial F := nontrivial_of_invariantBasisNumber F
b : Basis (Module.Free.ChooseBasisIndex F K) F K := Module.Free.chooseBasis F K
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
| let c := Module.Free.chooseBasis K A | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
| Mathlib.FieldTheory.Tower.76_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instβΒΉΒ² : CommRing F
instβΒΉΒΉ : Ring K
instβΒΉβ° : AddCommGroup A
instββΉ : Algebra F K
instββΈ : Module K A
instββ· : Module F A
instββΆ : IsScalarTower F K A
instββ΅ : StrongRankCondition F
instββ΄ : StrongRankCondition K
instβΒ³ : Module.Free F K
instβΒ² : Module.Free K A
instβΒΉ : Module.Finite F K
instβ : Module.Finite K A
this : Nontrivial F := nontrivial_of_invariantBasisNumber F
b : Basis (Module.Free.ChooseBasisIndex F K) F K := Module.Free.chooseBasis F K
c : Basis (Module.Free.ChooseBasisIndex K A) K A := Module.Free.chooseBasis K A
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
| rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod] | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
| Mathlib.FieldTheory.Tower.76_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instββΆ : Field F
instββ΅ : DivisionRing K
instββ΄ : AddCommGroup A
instβΒ³ : Algebra F K
instβΒ² : Module K A
instβΒΉ : Module F A
instβ : IsScalarTower F K A
hf : FiniteDimensional F A
b : Finset A
hb : span F βb = β€
β’ restrictScalars F (span K βb) = restrictScalars F β€ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
| rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le] | theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
| Mathlib.FieldTheory.Tower.114_0.ihtkOmbgx804u7P | theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instββΆ : Field F
instββ΅ : DivisionRing K
instββ΄ : AddCommGroup A
instβΒ³ : Algebra F K
instβΒ² : Module K A
instβΒΉ : Module F A
instβ : IsScalarTower F K A
hf : FiniteDimensional F A
b : Finset A
hb : span F βb = β€
β’ βb β β(restrictScalars F (span K βb)) | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
| exact Submodule.subset_span | theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
| Mathlib.FieldTheory.Tower.114_0.ihtkOmbgx804u7P | theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A | Mathlib_FieldTheory_Tower |
F : Type u
K : Type v
A : Type w
instββ· : Field F
instββΆ : DivisionRing K
instββ΅ : AddCommGroup A
instββ΄ : Algebra F K
instβΒ³ : Module K A
instβΒ² : Module F A
instβΒΉ : IsScalarTower F K A
instβ : FiniteDimensional F K
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
| by_cases hA : FiniteDimensional K A | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
| Mathlib.FieldTheory.Tower.121_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
case pos
F : Type u
K : Type v
A : Type w
instββ· : Field F
instββΆ : DivisionRing K
instββ΅ : AddCommGroup A
instββ΄ : Algebra F K
instβΒ³ : Module K A
instβΒ² : Module F A
instβΒΉ : IsScalarTower F K A
instβ : FiniteDimensional F K
hA : FiniteDimensional K A
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· | replace hA : FiniteDimensional K A := hA | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· | Mathlib.FieldTheory.Tower.121_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
case pos
F : Type u
K : Type v
A : Type w
instββ· : Field F
instββΆ : DivisionRing K
instββ΅ : AddCommGroup A
instββ΄ : Algebra F K
instβΒ³ : Module K A
instβΒ² : Module F A
instβΒΉ : IsScalarTower F K A
instβ : FiniteDimensional F K
hA : FiniteDimensional K A
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
| rw [finrank_mul_finrank'] | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
| Mathlib.FieldTheory.Tower.121_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
case neg
F : Type u
K : Type v
A : Type w
instββ· : Field F
instββΆ : DivisionRing K
instββ΅ : AddCommGroup A
instββ΄ : Algebra F K
instβΒ³ : Module K A
instβΒ² : Module F A
instβΒΉ : IsScalarTower F K A
instβ : FiniteDimensional F K
hA : Β¬FiniteDimensional K A
β’ finrank F K * finrank K A = finrank F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· | rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional] | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· | Mathlib.FieldTheory.Tower.121_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
case neg
F : Type u
K : Type v
A : Type w
instββ· : Field F
instββΆ : DivisionRing K
instββ΅ : AddCommGroup A
instββ΄ : Algebra F K
instβΒ³ : Module K A
instβΒ² : Module F A
instβΒΉ : IsScalarTower F K A
instβ : FiniteDimensional F K
hA : Β¬FiniteDimensional K A
β’ Β¬FiniteDimensional F A | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
| exact mt (@right F K A _ _ _ _ _ _ _) hA | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
| Mathlib.FieldTheory.Tower.121_0.ihtkOmbgx804u7P | /-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A | Mathlib_FieldTheory_Tower |
F : Type u
Kβ : Type v
Aβ : Type w
instββΉ : Field F
instββΈ : DivisionRing Kβ
instββ· : AddCommGroup Aβ
instββΆ : Algebra F Kβ
instββ΅ : Module Kβ Aβ
instββ΄ : Module F Aβ
instβΒ³ : IsScalarTower F Kβ Aβ
A : Type u_1
instβΒ² : Ring A
instβΒΉ : IsDomain A
instβ : Algebra F A
hp : Nat.Prime (finrank F A)
K : Subalgebra F A
β’ K = β₯ β¨ K = β€ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
exact mt (@right F K A _ _ _ _ _ _ _) hA
#align finite_dimensional.finrank_mul_finrank FiniteDimensional.finrank_mul_finrank
theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
| haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
| Mathlib.FieldTheory.Tower.133_0.ihtkOmbgx804u7P | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) | Mathlib_FieldTheory_Tower |
F : Type u
Kβ : Type v
Aβ : Type w
instββΉ : Field F
instββΈ : DivisionRing Kβ
instββ· : AddCommGroup Aβ
instββΆ : Algebra F Kβ
instββ΅ : Module Kβ Aβ
instββ΄ : Module F Aβ
instβΒ³ : IsScalarTower F Kβ Aβ
A : Type u_1
instβΒ² : Ring A
instβΒΉ : IsDomain A
instβ : Algebra F A
hp : Nat.Prime (finrank F A)
K : Subalgebra F A
this : FiniteDimensional F A
β’ K = β₯ β¨ K = β€ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
exact mt (@right F K A _ _ _ _ _ _ _) hA
#align finite_dimensional.finrank_mul_finrank FiniteDimensional.finrank_mul_finrank
theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
| letI := divisionRingOfFiniteDimensional F K | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
| Mathlib.FieldTheory.Tower.133_0.ihtkOmbgx804u7P | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) | Mathlib_FieldTheory_Tower |
F : Type u
Kβ : Type v
Aβ : Type w
instββΉ : Field F
instββΈ : DivisionRing Kβ
instββ· : AddCommGroup Aβ
instββΆ : Algebra F Kβ
instββ΅ : Module Kβ Aβ
instββ΄ : Module F Aβ
instβΒ³ : IsScalarTower F Kβ Aβ
A : Type u_1
instβΒ² : Ring A
instβΒΉ : IsDomain A
instβ : Algebra F A
hp : Nat.Prime (finrank F A)
K : Subalgebra F A
thisβ : FiniteDimensional F A
this : DivisionRing β₯K := divisionRingOfFiniteDimensional F β₯K
β’ K = β₯ β¨ K = β€ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
exact mt (@right F K A _ _ _ _ _ _ _) hA
#align finite_dimensional.finrank_mul_finrank FiniteDimensional.finrank_mul_finrank
theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
| refine' (hp.eq_one_or_self_of_dvd _ β¨_, (finrank_mul_finrank F K A).symmβ©).imp _ fun h => _ | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
| Mathlib.FieldTheory.Tower.133_0.ihtkOmbgx804u7P | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) | Mathlib_FieldTheory_Tower |
case refine'_1
F : Type u
Kβ : Type v
Aβ : Type w
instββΉ : Field F
instββΈ : DivisionRing Kβ
instββ· : AddCommGroup Aβ
instββΆ : Algebra F Kβ
instββ΅ : Module Kβ Aβ
instββ΄ : Module F Aβ
instβΒ³ : IsScalarTower F Kβ Aβ
A : Type u_1
instβΒ² : Ring A
instβΒΉ : IsDomain A
instβ : Algebra F A
hp : Nat.Prime (finrank F A)
K : Subalgebra F A
thisβ : FiniteDimensional F A
this : DivisionRing β₯K := divisionRingOfFiniteDimensional F β₯K
β’ finrank F β₯K = 1 β K = β₯ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
exact mt (@right F K A _ _ _ _ _ _ _) hA
#align finite_dimensional.finrank_mul_finrank FiniteDimensional.finrank_mul_finrank
theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
refine' (hp.eq_one_or_self_of_dvd _ β¨_, (finrank_mul_finrank F K A).symmβ©).imp _ fun h => _
Β· | exact Subalgebra.eq_bot_of_finrank_one | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
refine' (hp.eq_one_or_self_of_dvd _ β¨_, (finrank_mul_finrank F K A).symmβ©).imp _ fun h => _
Β· | Mathlib.FieldTheory.Tower.133_0.ihtkOmbgx804u7P | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) | Mathlib_FieldTheory_Tower |
case refine'_2
F : Type u
Kβ : Type v
Aβ : Type w
instββΉ : Field F
instββΈ : DivisionRing Kβ
instββ· : AddCommGroup Aβ
instββΆ : Algebra F Kβ
instββ΅ : Module Kβ Aβ
instββ΄ : Module F Aβ
instβΒ³ : IsScalarTower F Kβ Aβ
A : Type u_1
instβΒ² : Ring A
instβΒΉ : IsDomain A
instβ : Algebra F A
hp : Nat.Prime (finrank F A)
K : Subalgebra F A
thisβ : FiniteDimensional F A
this : DivisionRing β₯K := divisionRingOfFiniteDimensional F β₯K
h : finrank F β₯K = finrank F A
β’ K = β€ | /-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import Mathlib.Data.Nat.Prime
import Mathlib.RingTheory.AlgebraTower
import Mathlib.LinearAlgebra.FiniteDimensional
import Mathlib.LinearAlgebra.FreeModule.Finite.Matrix
#align_import field_theory.tower from "leanprover-community/mathlib"@"c7bce2818663f456335892ddbdd1809f111a5b72"
/-!
# Tower of field extensions
In this file we prove the tower law for arbitrary extensions and finite extensions.
Suppose `L` is a field extension of `K` and `K` is a field extension of `F`.
Then `[L:F] = [L:K] [K:F]` where `[Eβ:Eβ]` means the `Eβ`-dimension of `Eβ`.
In fact we generalize it to rings and modules, where `L` is not necessarily a field,
but just a free module over `K`.
## Implementation notes
We prove two versions, since there are two notions of dimensions: `Module.rank` which gives
the dimension of an arbitrary vector space as a cardinal, and `FiniteDimensional.finrank` which
gives the dimension of a finite-dimensional vector space as a natural number.
## Tags
tower law
-/
universe u v w uβ vβ wβ
open BigOperators Cardinal Submodule
variable (F : Type u) (K : Type v) (A : Type w)
section Ring
variable [CommRing F] [Ring K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
variable [StrongRankCondition F] [StrongRankCondition K]
[Module.Free F K] [Module.Free K A]
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem lift_rank_mul_lift_rank :
Cardinal.lift.{w} (Module.rank F K) * Cardinal.lift.{v} (Module.rank K A) =
Cardinal.lift.{v} (Module.rank F A) := by
-- porting note: `Module.Free.exists_basis` now has implicit arguments, but this is annoying
-- to fix as it is a projection.
obtain β¨_, bβ© := Module.Free.exists_basis (R := F) (M := K)
obtain β¨_, cβ© := Module.Free.exists_basis (R := K) (M := A)
rw [β (Module.rank F K).lift_id, β b.mk_eq_rank, β (Module.rank K A).lift_id, β c.mk_eq_rank, β
lift_umax.{w, v}, β (b.smul c).mk_eq_rank, mk_prod, lift_mul, lift_lift, lift_lift, lift_lift,
lift_lift, lift_umax.{v, w}]
#align lift_rank_mul_lift_rank lift_rank_mul_lift_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$.
This is a simpler version of `lift_rank_mul_lift_rank` with `K` and `A` in the same universe. -/
theorem rank_mul_rank (F : Type u) (K A : Type v) [CommRing F] [Ring K] [AddCommGroup A]
[Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A] [StrongRankCondition F]
[StrongRankCondition K] [Module.Free F K] [Module.Free K A] :
Module.rank F K * Module.rank K A = Module.rank F A := by
convert lift_rank_mul_lift_rank F K A <;> rw [lift_id]
#align rank_mul_rank rank_mul_rank
/-- Tower law: if `A` is a `K`-module and `K` is an extension of `F` then
$\operatorname{rank}_F(A) = \operatorname{rank}_F(K) * \operatorname{rank}_K(A)$. -/
theorem FiniteDimensional.finrank_mul_finrank' [Module.Finite F K]
[Module.Finite K A] : finrank F K * finrank K A = finrank F A := by
letI := nontrivial_of_invariantBasisNumber F
let b := Module.Free.chooseBasis F K
let c := Module.Free.chooseBasis K A
rw [finrank_eq_card_basis b, finrank_eq_card_basis c, finrank_eq_card_basis (b.smul c),
Fintype.card_prod]
#align finite_dimensional.finrank_mul_finrank' FiniteDimensional.finrank_mul_finrank'
end Ring
section Field
variable [Field F] [DivisionRing K] [AddCommGroup A]
variable [Algebra F K] [Module K A] [Module F A] [IsScalarTower F K A]
namespace FiniteDimensional
open IsNoetherian
theorem trans [FiniteDimensional F K] [FiniteDimensional K A] : FiniteDimensional F A :=
Module.Finite.trans K A
#align finite_dimensional.trans FiniteDimensional.trans
/-- In a tower of field extensions `L / K / F`, if `L / F` is finite, so is `K / F`.
(In fact, it suffices that `L` is a nontrivial ring.)
Note this cannot be an instance as Lean cannot infer `L`.
-/
theorem left (K L : Type*) [Field K] [Algebra F K] [Ring L] [Nontrivial L] [Algebra F L]
[Algebra K L] [IsScalarTower F K L] [FiniteDimensional F L] : FiniteDimensional F K :=
FiniteDimensional.of_injective (IsScalarTower.toAlgHom F K L).toLinearMap (RingHom.injective _)
#align finite_dimensional.left FiniteDimensional.left
theorem right [hf : FiniteDimensional F A] : FiniteDimensional K A :=
let β¨β¨b, hbβ©β© := hf
β¨β¨b, Submodule.restrictScalars_injective F _ _ <| by
rw [Submodule.restrictScalars_top, eq_top_iff, β hb, Submodule.span_le]
exact Submodule.subset_spanβ©β©
#align finite_dimensional.right FiniteDimensional.right
/-- Tower law: if `A` is a `K`-vector space and `K` is a field extension of `F` then
`dim_F(A) = dim_F(K) * dim_K(A)`.
This is `FiniteDimensional.finrank_mul_finrank'` with one fewer finiteness assumption. -/
theorem finrank_mul_finrank [FiniteDimensional F K] : finrank F K * finrank K A = finrank F A := by
by_cases hA : FiniteDimensional K A
Β· replace hA : FiniteDimensional K A := hA -- porting note: broken instance cache
rw [finrank_mul_finrank']
Β· rw [finrank_of_infinite_dimensional hA, mul_zero, finrank_of_infinite_dimensional]
exact mt (@right F K A _ _ _ _ _ _ _) hA
#align finite_dimensional.finrank_mul_finrank FiniteDimensional.finrank_mul_finrank
theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
refine' (hp.eq_one_or_self_of_dvd _ β¨_, (finrank_mul_finrank F K A).symmβ©).imp _ fun h => _
Β· exact Subalgebra.eq_bot_of_finrank_one
Β· | exact
Algebra.toSubmodule_eq_top.1 (eq_top_of_finrank_eq <| K.finrank_toSubmodule.trans h) | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) :=
{ toNontrivial :=
β¨β¨β₯, β€, fun he =>
Nat.not_prime_one ((Subalgebra.bot_eq_top_iff_finrank_eq_one.1 he).subst hp)β©β©
eq_bot_or_eq_top := fun K => by
haveI : FiniteDimensional _ _ := finiteDimensional_of_finrank hp.pos
letI := divisionRingOfFiniteDimensional F K
refine' (hp.eq_one_or_self_of_dvd _ β¨_, (finrank_mul_finrank F K A).symmβ©).imp _ fun h => _
Β· exact Subalgebra.eq_bot_of_finrank_one
Β· | Mathlib.FieldTheory.Tower.133_0.ihtkOmbgx804u7P | theorem Subalgebra.isSimpleOrder_of_finrank_prime (A) [Ring A] [IsDomain A] [Algebra F A]
(hp : (finrank F A).Prime) : IsSimpleOrder (Subalgebra F A) | Mathlib_FieldTheory_Tower |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a : k
β’ slope f a a = 0 | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
| rw [slope, sub_self, inv_zero, zero_smul] | @[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.46_0.R1BInF4Gl9ffltx | @[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
β’ (b - a) β’ slope f a b = f b -α΅₯ f a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
| rcases eq_or_ne a b with (rfl | hne) | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.55_0.R1BInF4Gl9ffltx | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a | Mathlib_LinearAlgebra_AffineSpace_Slope |
case inl
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a : k
β’ (a - a) β’ slope f a a = f a -α΅₯ f a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· | rw [sub_self, zero_smul, vsub_self] | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.55_0.R1BInF4Gl9ffltx | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a | Mathlib_LinearAlgebra_AffineSpace_Slope |
case inr
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
hne : a β b
β’ (b - a) β’ slope f a b = f b -α΅₯ f a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· | rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)] | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.55_0.R1BInF4Gl9ffltx | @[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
β’ (b - a) β’ slope f a b +α΅₯ f a = f b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
| rw [sub_smul_slope, vsub_vadd] | theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.62_0.R1BInF4Gl9ffltx | theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β E
c : PE
β’ (slope fun x => f x +α΅₯ c) = slope f | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
| ext a b | @[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.66_0.R1BInF4Gl9ffltx | @[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f | Mathlib_LinearAlgebra_AffineSpace_Slope |
case h.h
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β E
c : PE
a b : k
β’ slope (fun x => f x +α΅₯ c) a b = slope f a b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
| simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub] | @[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
| Mathlib.LinearAlgebra.AffineSpace.Slope.66_0.R1BInF4Gl9ffltx | @[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β E
a b : k
h : a β b
β’ slope (fun x => (x - a) β’ f x) a b = f b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
| simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)] | @[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.72_0.R1BInF4Gl9ffltx | @[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
h : slope f a b = 0
β’ f a = f b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
| rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd] | theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.78_0.R1BInF4Gl9ffltx | theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instββΆ : Field k
instββ΅ : AddCommGroup E
instββ΄ : Module k E
instβΒ³ : AddTorsor E PE
F : Type u_4
PF : Type u_5
instβΒ² : AddCommGroup F
instβΒΉ : Module k F
instβ : AddTorsor F PF
f : PE βα΅[k] PF
g : k β PE
a b : k
β’ slope (βf β g) a b = f.linear (slope g a b) | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
| simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub] | theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.82_0.R1BInF4Gl9ffltx | theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
β’ slope f a b = slope f b a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
| rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub] | theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.92_0.R1BInF4Gl9ffltx | theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
β’ ((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
| by_cases hab : a = b | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
hab : a = b
β’ ((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· | subst hab | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a c : k
β’ ((a - a) / (c - a)) β’ slope f a a + ((c - a) / (c - a)) β’ slope f a c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
| rw [sub_self, zero_div, zero_smul, zero_add] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a c : k
β’ ((c - a) / (c - a)) β’ slope f a c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
| by_cases hac : a = c | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a c : k
hac : a = c
β’ ((c - a) / (c - a)) β’ slope f a c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· | simp [hac] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case neg
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a c : k
hac : Β¬a = c
β’ ((c - a) / (c - a)) β’ slope f a c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· | rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case neg
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
hab : Β¬a = b
β’ ((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
| by_cases hbc : b = c | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
hab : Β¬a = b
hbc : b = c
β’ ((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· | subst hbc | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case pos
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b : k
hab : Β¬a = b
β’ ((b - a) / (b - a)) β’ slope f a b + ((b - b) / (b - a)) β’ slope f b b = slope f a b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
| simp [sub_ne_zero.2 (Ne.symm hab)] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case neg
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
hab : Β¬a = b
hbc : Β¬b = c
β’ ((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
| rw [add_comm] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
case neg
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
hab : Β¬a = b
hbc : Β¬b = c
β’ ((c - b) / (c - a)) β’ slope f b c + ((b - a) / (c - a)) β’ slope f a b = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
| simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel] | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
| Mathlib.LinearAlgebra.AffineSpace.Slope.96_0.R1BInF4Gl9ffltx | /-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b c : k
h : a β c
β’ (lineMap (slope f a b) (slope f b c)) ((c - b) / (c - a)) = slope f a c | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
| field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module] | /-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.116_0.R1BInF4Gl9ffltx | /-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c | Mathlib_LinearAlgebra_AffineSpace_Slope |
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b r : k
β’ (lineMap (slope f ((lineMap a b) r) b) (slope f a ((lineMap a b) r))) r = slope f a b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module]
#align line_map_slope_slope_sub_div_sub lineMap_slope_slope_sub_div_sub
/-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
| obtain rfl | hab : a = b β¨ a β b := Classical.em _ | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
| Mathlib.LinearAlgebra.AffineSpace.Slope.124_0.R1BInF4Gl9ffltx | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b | Mathlib_LinearAlgebra_AffineSpace_Slope |
case inl
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a r : k
β’ (lineMap (slope f ((lineMap a a) r) a) (slope f a ((lineMap a a) r))) r = slope f a a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module]
#align line_map_slope_slope_sub_div_sub lineMap_slope_slope_sub_div_sub
/-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· | simp | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· | Mathlib.LinearAlgebra.AffineSpace.Slope.124_0.R1BInF4Gl9ffltx | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b | Mathlib_LinearAlgebra_AffineSpace_Slope |
case inr
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b r : k
hab : a β b
β’ (lineMap (slope f ((lineMap a b) r) b) (slope f a ((lineMap a b) r))) r = slope f a b | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module]
#align line_map_slope_slope_sub_div_sub lineMap_slope_slope_sub_div_sub
/-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
| rw [slope_comm _ a, slope_comm _ a, slope_comm _ _ b] | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
| Mathlib.LinearAlgebra.AffineSpace.Slope.124_0.R1BInF4Gl9ffltx | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b | Mathlib_LinearAlgebra_AffineSpace_Slope |
case inr
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b r : k
hab : a β b
β’ (lineMap (slope f b ((lineMap a b) r)) (slope f ((lineMap a b) r) a)) r = slope f b a | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module]
#align line_map_slope_slope_sub_div_sub lineMap_slope_slope_sub_div_sub
/-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
rw [slope_comm _ a, slope_comm _ a, slope_comm _ _ b]
| convert lineMap_slope_slope_sub_div_sub f b (lineMap a b r) a hab.symm using 2 | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
rw [slope_comm _ a, slope_comm _ a, slope_comm _ _ b]
| Mathlib.LinearAlgebra.AffineSpace.Slope.124_0.R1BInF4Gl9ffltx | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b | Mathlib_LinearAlgebra_AffineSpace_Slope |
case h.e'_2.h.e'_6
k : Type u_1
E : Type u_2
PE : Type u_3
instβΒ³ : Field k
instβΒ² : AddCommGroup E
instβΒΉ : Module k E
instβ : AddTorsor E PE
f : k β PE
a b r : k
hab : a β b
β’ r = (a - (lineMap a b) r) / (a - b) | /-
Copyright (c) 2020 Yury G. Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury G. Kudryashov
-/
import Mathlib.LinearAlgebra.AffineSpace.AffineMap
import Mathlib.Tactic.FieldSimp
#align_import linear_algebra.affine_space.slope from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Slope of a function
In this file we define the slope of a function `f : k β PE` taking values in an affine space over
`k` and prove some basic theorems about `slope`. The `slope` function naturally appears in the Mean
Value Theorem, and in the proof of the fact that a function with nonnegative second derivative on an
interval is convex on this interval.
## Tags
affine space, slope
-/
open AffineMap
variable {k E PE : Type*} [Field k] [AddCommGroup E] [Module k E] [AddTorsor E PE]
/-- `slope f a b = (b - a)β»ΒΉ β’ (f b -α΅₯ f a)` is the slope of a function `f` on the interval
`[a, b]`. Note that `slope f a a = 0`, not the derivative of `f` at `a`. -/
def slope (f : k β PE) (a b : k) : E :=
(b - a)β»ΒΉ β’ (f b -α΅₯ f a)
#align slope slope
theorem slope_fun_def (f : k β PE) : slope f = fun a b => (b - a)β»ΒΉ β’ (f b -α΅₯ f a) :=
rfl
#align slope_fun_def slope_fun_def
theorem slope_def_field (f : k β k) (a b : k) : slope f a b = (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_def_field slope_def_field
theorem slope_fun_def_field (f : k β k) (a : k) : slope f a = fun b => (f b - f a) / (b - a) :=
(div_eq_inv_mul _ _).symm
#align slope_fun_def_field slope_fun_def_field
@[simp]
theorem slope_same (f : k β PE) (a : k) : (slope f a a : E) = 0 := by
rw [slope, sub_self, inv_zero, zero_smul]
#align slope_same slope_same
theorem slope_def_module (f : k β E) (a b : k) : slope f a b = (b - a)β»ΒΉ β’ (f b - f a) :=
rfl
#align slope_def_module slope_def_module
@[simp]
theorem sub_smul_slope (f : k β PE) (a b : k) : (b - a) β’ slope f a b = f b -α΅₯ f a := by
rcases eq_or_ne a b with (rfl | hne)
Β· rw [sub_self, zero_smul, vsub_self]
Β· rw [slope, smul_inv_smulβ (sub_ne_zero.2 hne.symm)]
#align sub_smul_slope sub_smul_slope
theorem sub_smul_slope_vadd (f : k β PE) (a b : k) : (b - a) β’ slope f a b +α΅₯ f a = f b := by
rw [sub_smul_slope, vsub_vadd]
#align sub_smul_slope_vadd sub_smul_slope_vadd
@[simp]
theorem slope_vadd_const (f : k β E) (c : PE) : (slope fun x => f x +α΅₯ c) = slope f := by
ext a b
simp only [slope, vadd_vsub_vadd_cancel_right, vsub_eq_sub]
#align slope_vadd_const slope_vadd_const
@[simp]
theorem slope_sub_smul (f : k β E) {a b : k} (h : a β b) :
slope (fun x => (x - a) β’ f x) a b = f b := by
simp [slope, inv_smul_smulβ (sub_ne_zero.2 h.symm)]
#align slope_sub_smul slope_sub_smul
theorem eq_of_slope_eq_zero {f : k β PE} {a b : k} (h : slope f a b = (0 : E)) : f a = f b := by
rw [β sub_smul_slope_vadd f a b, h, smul_zero, zero_vadd]
#align eq_of_slope_eq_zero eq_of_slope_eq_zero
theorem AffineMap.slope_comp {F PF : Type*} [AddCommGroup F] [Module k F] [AddTorsor F PF]
(f : PE βα΅[k] PF) (g : k β PE) (a b : k) : slope (f β g) a b = f.linear (slope g a b) := by
simp only [slope, (Β· β Β·), f.linear.map_smul, f.linearMap_vsub]
#align affine_map.slope_comp AffineMap.slope_comp
theorem LinearMap.slope_comp {F : Type*} [AddCommGroup F] [Module k F] (f : E ββ[k] F) (g : k β E)
(a b : k) : slope (f β g) a b = f (slope g a b) :=
f.toAffineMap.slope_comp g a b
#align linear_map.slope_comp LinearMap.slope_comp
theorem slope_comm (f : k β PE) (a b : k) : slope f a b = slope f b a := by
rw [slope, slope, β neg_vsub_eq_vsub_rev, smul_neg, β neg_smul, neg_inv, neg_sub]
#align slope_comm slope_comm
/-- `slope f a c` is a linear combination of `slope f a b` and `slope f b c`. This version
explicitly provides coefficients. If `a β c`, then the sum of the coefficients is `1`, so it is
actually an affine combination, see `lineMap_slope_slope_sub_div_sub`. -/
theorem sub_div_sub_smul_slope_add_sub_div_sub_smul_slope (f : k β PE) (a b c : k) :
((b - a) / (c - a)) β’ slope f a b + ((c - b) / (c - a)) β’ slope f b c = slope f a c := by
by_cases hab : a = b
Β· subst hab
rw [sub_self, zero_div, zero_smul, zero_add]
by_cases hac : a = c
Β· simp [hac]
Β· rw [div_self (sub_ne_zero.2 <| Ne.symm hac), one_smul]
by_cases hbc : b = c;
Β· subst hbc
simp [sub_ne_zero.2 (Ne.symm hab)]
rw [add_comm]
simp_rw [slope, div_eq_inv_mul, mul_smul, β smul_add,
smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hab), smul_inv_smulβ (sub_ne_zero.2 <| Ne.symm hbc),
vsub_add_vsub_cancel]
#align sub_div_sub_smul_slope_add_sub_div_sub_smul_slope sub_div_sub_smul_slope_add_sub_div_sub_smul_slope
/-- `slope f a c` is an affine combination of `slope f a b` and `slope f b c`. This version uses
`lineMap` to express this property. -/
theorem lineMap_slope_slope_sub_div_sub (f : k β PE) (a b c : k) (h : a β c) :
lineMap (slope f a b) (slope f b c) ((c - b) / (c - a)) = slope f a c := by
field_simp [sub_ne_zero.2 h.symm, β sub_div_sub_smul_slope_add_sub_div_sub_smul_slope f a b c,
lineMap_apply_module]
#align line_map_slope_slope_sub_div_sub lineMap_slope_slope_sub_div_sub
/-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
rw [slope_comm _ a, slope_comm _ a, slope_comm _ _ b]
convert lineMap_slope_slope_sub_div_sub f b (lineMap a b r) a hab.symm using 2
| rw [lineMap_apply_ring, eq_div_iff (sub_ne_zero.2 hab), sub_mul, one_mul, mul_sub, β sub_sub,
sub_sub_cancel] | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b := by
obtain rfl | hab : a = b β¨ a β b := Classical.em _; Β· simp
rw [slope_comm _ a, slope_comm _ a, slope_comm _ _ b]
convert lineMap_slope_slope_sub_div_sub f b (lineMap a b r) a hab.symm using 2
| Mathlib.LinearAlgebra.AffineSpace.Slope.124_0.R1BInF4Gl9ffltx | /-- `slope f a b` is an affine combination of `slope f a (lineMap a b r)` and
`slope f (lineMap a b r) b`. We use `lineMap` to express this property. -/
theorem lineMap_slope_lineMap_slope_lineMap (f : k β PE) (a b r : k) :
lineMap (slope f (lineMap a b r) b) (slope f a (lineMap a b r)) r = slope f a b | Mathlib_LinearAlgebra_AffineSpace_Slope |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
β’ (π (π_ C) β π (π_ C)) β« (Ξ»_ (π_ C)).hom = (Ο_ (π_ C)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by | coherence | /-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by | Mathlib.CategoryTheory.Monoidal.Mon_.55_0.NTUMzhXPwXsmsYt | /-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
β’ ((Ξ»_ (π_ C)).hom β π (π_ C)) β« (Ξ»_ (π_ C)).hom =
(Ξ±_ (π_ C) (π_ C) (π_ C)).hom β« (π (π_ C) β (Ξ»_ (π_ C)).hom) β« (Ξ»_ (π_ C)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by | coherence | /-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by | Mathlib.CategoryTheory.Monoidal.Mon_.55_0.NTUMzhXPwXsmsYt | /-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M : Mon_ C
Z : C
f : Z βΆ M.X
β’ (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
| rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality] | @[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
| Mathlib.CategoryTheory.Monoidal.Mon_.72_0.NTUMzhXPwXsmsYt | @[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M : Mon_ C
Z : C
f : Z βΆ M.X
β’ (f β M.one) β« M.mul = (Ο_ Z).hom β« f | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
| rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality] | @[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
| Mathlib.CategoryTheory.Monoidal.Mon_.77_0.NTUMzhXPwXsmsYt | @[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M : Mon_ C
β’ (π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by | simp | theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by | Mathlib.CategoryTheory.Monoidal.Mon_.82_0.NTUMzhXPwXsmsYt | theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M Aβ Bβ : Mon_ C
f : Aβ βΆ Bβ
e : IsIso ((forget C).map f)
β’ Bβ.mul β« inv f.hom = (inv f.hom β inv f.hom) β« Aβ.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
| simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] | /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
| Mathlib.CategoryTheory.Monoidal.Mon_.152_0.NTUMzhXPwXsmsYt | /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M Aβ Bβ : Mon_ C
f : Aβ βΆ Bβ
e : IsIso ((forget C).map f)
β’ f β« Hom.mk (inv f.hom) = π Aβ β§ Hom.mk (inv f.hom) β« f = π Bβ | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by | aesop_cat | /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by | Mathlib.CategoryTheory.Monoidal.Mon_.152_0.NTUMzhXPwXsmsYt | /-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
β’ N.one β« f.inv = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by | rw [β one_f] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by | Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
β’ (M.one β« f.hom) β« f.inv = M.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; | simp | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; | Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
β’ N.mul β« f.inv = (f.inv β f.inv) β« M.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
| rw [β cancel_mono f.hom] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
| Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
β’ (N.mul β« f.inv) β« f.hom = ((f.inv β f.inv) β« M.mul) β« f.hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
| slice_rhs 2 3 => rw [mul_f] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
| Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| M.mul β« f.hom
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| f.inv β f.inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | rw [mul_f] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| M.mul β« f.hom
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| f.inv β f.inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | rw [mul_f] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| M.mul β« f.hom
case a
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
| f.inv β f.inv | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | rw [mul_f] | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
Mβ M N : Mon_ C
f : M.X β
N.X
one_f : M.one β« f.hom = N.one
mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul
β’ (N.mul β« f.inv) β« f.hom = (f.inv β f.inv) β« (f.hom β f.hom) β« N.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
| simp | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
| Mathlib.CategoryTheory.Monoidal.Mon_.161_0.NTUMzhXPwXsmsYt | /-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
β’ (trivial C).one β« A.one = A.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by | dsimp | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by | Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
β’ π (π_ C) β« A.one = A.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; | simp | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; | Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
β’ (trivial C).mul β« A.one = (A.one β A.one) β« A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by | dsimp | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by | Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
β’ (Ξ»_ (π_ C)).hom β« A.one = (A.one β A.one) β« A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; | simp [A.one_mul, unitors_equal] | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; | Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
f : trivial C βΆ A
β’ f = default | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
| ext | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
| Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
case w
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
f : trivial C βΆ A
β’ f.hom = default.hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; | simp | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; | Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
case w
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
f : trivial C βΆ A
β’ f.hom = A.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
| rw [β Category.id_comp f.hom] | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
| Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
case w
C : Type uβ
instβΒΉ : Category.{vβ, uβ} C
instβ : MonoidalCategory C
M A : Mon_ C
f : trivial C βΆ A
β’ π (trivial C).X β« f.hom = A.one | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
| erw [f.one_hom] | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
| Mathlib.CategoryTheory.Monoidal.Mon_.179_0.NTUMzhXPwXsmsYt | instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
β’ (F.Ξ΅ β« F.map A.one β π (F.obj A.X)) β« ΞΌ F A.X A.X β« F.map A.mul = (Ξ»_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
| conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.Ξ΅ β« F.map A.one β π (F.obj A.X)) β« ΞΌ F A.X A.X β« F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | rw [comp_tensor_id, β F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.Ξ΅ β« F.map A.one β π (F.obj A.X)) β« ΞΌ F A.X A.X β« F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | rw [comp_tensor_id, β F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.Ξ΅ β« F.map A.one β π (F.obj A.X)) β« ΞΌ F A.X A.X β« F.map A.mul | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | rw [comp_tensor_id, β F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
β’ ((F.Ξ΅ β F.map (π A.X)) β« (F.map A.one β F.map (π A.X))) β« ΞΌ F A.X A.X β« F.map A.mul = (Ξ»_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
| slice_lhs 2 3 => rw [F.ΞΌ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.one β F.map (π A.X)) β« ΞΌ F A.X A.X
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.ΞΌ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.one β F.map (π A.X)) β« ΞΌ F A.X A.X
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.ΞΌ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| (F.map A.one β F.map (π A.X)) β« ΞΌ F A.X A.X
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X) | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | rw [F.ΞΌ_natural] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
β’ (F.Ξ΅ β F.map (π A.X)) β« (ΞΌ F (π_ C) A.X β« F.map (A.one β π A.X)) β« F.map A.mul = (Ξ»_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
| slice_lhs 3 4 => rw [β F.toFunctor.map_comp, A.one_mul] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.one β π A.X) β« F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X)
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| ΞΌ F (π_ C) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | rw [β F.toFunctor.map_comp, A.one_mul] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.one β π A.X) β« F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X)
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| ΞΌ F (π_ C) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | rw [β F.toFunctor.map_comp, A.one_mul] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.map (A.one β π A.X) β« F.map A.mul
case a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| F.Ξ΅ β F.map (π A.X)
case a.a
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
| ΞΌ F (π_ C) A.X | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | rw [β F.toFunctor.map_comp, A.one_mul] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => | Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
β’ (F.Ξ΅ β F.map (π A.X)) β« ΞΌ F (π_ C) A.X β« F.map (Ξ»_ A.X).hom = (Ξ»_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => rw [β F.toFunctor.map_comp, A.one_mul]
| rw [F.toFunctor.map_id] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => rw [β F.toFunctor.map_comp, A.one_mul]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
C : Type uβ
instβΒ³ : Category.{vβ, uβ} C
instβΒ² : MonoidalCategory C
D : Type uβ
instβΒΉ : Category.{vβ, uβ} D
instβ : MonoidalCategory D
F : LaxMonoidalFunctor C D
A : Mon_ C
β’ (F.Ξ΅ β π (F.obj A.X)) β« ΞΌ F (π_ C) A.X β« F.map (Ξ»_ A.X).hom = (Ξ»_ (F.obj A.X)).hom | /-
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
import Mathlib.CategoryTheory.Monoidal.Braided
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
import Mathlib.Algebra.PUnitInstances
#align_import category_theory.monoidal.Mon_ from "leanprover-community/mathlib"@"a836c6dba9bd1ee2a0cdc9af0006a596f243031c"
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
-/
set_option linter.uppercaseLean3 false
universe vβ vβ uβ uβ u
open CategoryTheory MonoidalCategory
variable (C : Type uβ) [Category.{vβ} C] [MonoidalCategory.{vβ} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon_ where
X : C
one : π_ C βΆ X
mul : X β X βΆ X
one_mul : (one β π X) β« mul = (Ξ»_ X).hom := by aesop_cat
mul_one : (π X β one) β« mul = (Ο_ X).hom := by aesop_cat
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc : (mul β π X) β« mul = (Ξ±_ X X X).hom β« (π X β mul) β« mul := by aesop_cat
#align Mon_ Mon_
attribute [reassoc] Mon_.one_mul Mon_.mul_one
-- We prove a more general `@[simp]` lemma below.
attribute [reassoc (attr := simp)] Mon_.mul_assoc
namespace Mon_
/-- The trivial monoid object. We later show this is initial in `Mon_ C`.
-/
@[simps]
def trivial : Mon_ C where
X := π_ C
one := π _
mul := (Ξ»_ _).hom
mul_assoc := by coherence
mul_one := by coherence
#align Mon_.trivial Mon_.trivial
instance : Inhabited (Mon_ C) :=
β¨trivial Cβ©
variable {C}
variable {M : Mon_ C}
@[simp]
theorem one_mul_hom {Z : C} (f : Z βΆ M.X) : (M.one β f) β« M.mul = (Ξ»_ Z).hom β« f := by
rw [β id_tensor_comp_tensor_id, Category.assoc, M.one_mul, leftUnitor_naturality]
#align Mon_.one_mul_hom Mon_.one_mul_hom
@[simp]
theorem mul_one_hom {Z : C} (f : Z βΆ M.X) : (f β M.one) β« M.mul = (Ο_ Z).hom β« f := by
rw [β tensor_id_comp_id_tensor, Category.assoc, M.mul_one, rightUnitor_naturality]
#align Mon_.mul_one_hom Mon_.mul_one_hom
theorem assoc_flip :
(π M.X β M.mul) β« M.mul = (Ξ±_ M.X M.X M.X).inv β« (M.mul β π M.X) β« M.mul := by simp
#align Mon_.assoc_flip Mon_.assoc_flip
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon_ C) where
hom : M.X βΆ N.X
one_hom : M.one β« hom = N.one := by aesop_cat
mul_hom : M.mul β« hom = (hom β hom) β« N.mul := by aesop_cat
#align Mon_.hom Mon_.Hom
attribute [reassoc (attr := simp)] Hom.one_hom Hom.mul_hom
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon_ C) : Hom M M where
hom := π M.X
#align Mon_.id Mon_.id
instance homInhabited (M : Mon_ C) : Inhabited (Hom M M) :=
β¨id Mβ©
#align Mon_.hom_inhabited Mon_.homInhabited
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon_ C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom β« g.hom
#align Mon_.comp Mon_.comp
instance : Category (Mon_ C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
-- Porting note: added, as `Hom.ext` does not apply to a morphism.
@[ext]
lemma ext {X Y : Mon_ C} {f g : X βΆ Y} (w : f.hom = g.hom) : f = g :=
Hom.ext _ _ w
@[simp]
theorem id_hom' (M : Mon_ C) : (π M : Hom M M).hom = π M.X :=
rfl
#align Mon_.id_hom' Mon_.id_hom'
@[simp]
theorem comp_hom' {M N K : Mon_ C} (f : M βΆ N) (g : N βΆ K) :
(f β« g : Hom M K).hom = f.hom β« g.hom :=
rfl
#align Mon_.comp_hom' Mon_.comp_hom'
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon_ C β₯€ C where
obj A := A.X
map f := f.hom
#align Mon_.forget Mon_.forget
end
instance forget_faithful : Faithful (@forget C _ _) where
#align Mon_.forget_faithful Mon_.forget_faithful
instance {A B : Mon_ C} (f : A βΆ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : ReflectsIsomorphisms (forget C) where
reflects f e :=
β¨β¨{ hom := inv f.hom
mul_hom := by
simp only [IsIso.comp_inv_eq, Hom.mul_hom, Category.assoc, β tensor_comp_assoc,
IsIso.inv_hom_id, tensor_id, Category.id_comp] },
by aesop_catβ©β©
/-- Construct an isomorphism of monoids by giving an isomorphism between the underlying objects
and checking compatibility with unit and multiplication only in the forward direction.
-/
def isoOfIso {M N : Mon_ C} (f : M.X β
N.X) (one_f : M.one β« f.hom = N.one)
(mul_f : M.mul β« f.hom = (f.hom β f.hom) β« N.mul) : M β
N where
hom :=
{ hom := f.hom
one_hom := one_f
mul_hom := mul_f }
inv :=
{ hom := f.inv
one_hom := by rw [β one_f]; simp
mul_hom := by
rw [β cancel_mono f.hom]
slice_rhs 2 3 => rw [mul_f]
simp }
#align Mon_.iso_of_iso Mon_.isoOfIso
instance uniqueHomFromTrivial (A : Mon_ C) : Unique (trivial C βΆ A) where
default :=
{ hom := A.one
one_hom := by dsimp; simp
mul_hom := by dsimp; simp [A.one_mul, unitors_equal] }
uniq f := by
ext; simp
rw [β Category.id_comp f.hom]
erw [f.one_hom]
#align Mon_.unique_hom_from_trivial Mon_.uniqueHomFromTrivial
open CategoryTheory.Limits
instance : HasInitial (Mon_ C) :=
hasInitial_of_unique (trivial C)
end Mon_
namespace CategoryTheory.LaxMonoidalFunctor
variable {C} {D : Type uβ} [Category.{vβ} D] [MonoidalCategory.{vβ} D]
-- TODO: mapMod F A : Mod A β₯€ Mod (F.mapMon A)
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => rw [β F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
| rw [F.left_unitality] | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A :=
{ X := F.obj A.X
one := F.Ξ΅ β« F.map A.one
mul := F.ΞΌ _ _ β« F.map A.mul
one_mul := by
conv_lhs => rw [comp_tensor_id, β F.toFunctor.map_id]
slice_lhs 2 3 => rw [F.ΞΌ_natural]
slice_lhs 3 4 => rw [β F.toFunctor.map_comp, A.one_mul]
rw [F.toFunctor.map_id]
| Mathlib.CategoryTheory.Monoidal.Mon_.202_0.NTUMzhXPwXsmsYt | /-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C β₯€ D` induces a functor `Mon_ C β₯€ Mon_ D`.
-/
@[simps]
def mapMon (F : LaxMonoidalFunctor C D) : Mon_ C β₯€ Mon_ D where
obj A | Mathlib_CategoryTheory_Monoidal_Mon_ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.