The areas / V06. Rings, fields and ordered algebra
Mathlib.Algebra.DualNumber
31 declarations. Mathlib docs · Source
Dual numbers
The dual numbers over R are of the form a + bε, where a and b are typically elements of a
commutative ring R, and ε is a symbol satisfying ε^2 = 0 that commutes with every other
element. They are a special case of TrivSqZeroExt R M with M = R.
Notation
In the DualNumber locale:
R[ε]is a shorthand forDualNumber Rεis a shorthand forDualNumber.eps
Main definitions
DualNumberDualNumber.epsDualNumber.lift
Implementation notes
Rather than duplicating the API of TrivSqZeroExt, this file reuses the functions there.
References
- https://en.wikipedia.org/wiki/Dual_number
abbrev DualNumber E3 #
Type u_4 → Type u_4
The type of dual numbers, numbers of the form $a + bε$ where $ε^2 = 0$.
R[ε] is notation for DualNumber R.
def DualNumber.eps E3 #
{R : Type u_1} → [Zero R] → [One R] → DualNumber R
The unit element $ε$ that squares to zero, with notation ε.
def DualNumber.termε E1 #
Lean.ParserDescr
The unit element $ε$ that squares to zero, with notation ε.
def DualNumber.«term_[ε]» E1 #
Lean.TrailingParserDescr
The type of dual numbers, numbers of the form $a + bε$ where $ε^2 = 0$.
R[ε] is notation for DualNumber R.
theorem DualNumber.fst_eps E0 #
∀ {R : Type u_1} [inst : Zero R] [inst_1 : One R], TrivSqZeroExt.fst DualNumber.eps = 0
theorem DualNumber.snd_eps E0 #
∀ {R : Type u_1} [inst : Zero R] [inst_1 : One R], TrivSqZeroExt.snd DualNumber.eps = 1
theorem DualNumber.snd_mul E0 #
∀ {R : Type u_1} [inst : Semiring R] (x y : DualNumber R),
TrivSqZeroExt.snd (x * y) = TrivSqZeroExt.fst x * TrivSqZeroExt.snd y + TrivSqZeroExt.snd x * TrivSqZeroExt.fst y
A version of TrivSqZeroExt.snd_mul with * instead of •.
theorem DualNumber.eps_mul_eps E0 #
∀ {R : Type u_1} [inst : Semiring R], DualNumber.eps * DualNumber.eps = 0
theorem DualNumber.eps_pow_two E0 #
∀ {R : Type u_1} [inst : Semiring R], DualNumber.eps ^ 2 = 0
theorem DualNumber.inv_eps E0 #
∀ {R : Type u_1} [inst : DivisionRing R], DualNumber.eps⁻¹ = 0
theorem DualNumber.inr_eq_smul_eps E0 #
∀ {R : Type u_1} [inst : MulZeroOneClass R] (r : R), TrivSqZeroExt.inr r = r • DualNumber.eps
theorem DualNumber.commute_eps_left E1 #
∀ {R : Type u_1} [inst : Semiring R] (x : DualNumber R), Commute DualNumber.eps x
ε commutes with every element of the algebra.
theorem DualNumber.commute_eps_right E1 #
∀ {R : Type u_1} [inst : Semiring R] (x : DualNumber R), Commute x DualNumber.eps
ε commutes with every element of the algebra.
theorem DualNumber.algHom_ext' E1 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] ⦃f g : DualNumber A →ₐ[R] B⦄,
f.comp (TrivSqZeroExt.inlAlgHom R A A) = g.comp (TrivSqZeroExt.inlAlgHom R A A) →
f.toLinearMap ∘ₗ ↑R (LinearMap.toSpanSingleton A (DualNumber A) DualNumber.eps) =
g.toLinearMap ∘ₗ ↑R (LinearMap.toSpanSingleton A (DualNumber A) DualNumber.eps) →
f = g
For two R-algebra morphisms out of A[ε] to agree, it suffices for them to agree on the
elements of A and the A-multiples of ε.
theorem DualNumber.algHom_ext'_iff E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] {f g : DualNumber A →ₐ[R] B},
f = g ↔
f.comp (TrivSqZeroExt.inlAlgHom R A A) = g.comp (TrivSqZeroExt.inlAlgHom R A A) ∧
f.toLinearMap ∘ₗ ↑R (LinearMap.toSpanSingleton A (DualNumber A) DualNumber.eps) =
g.toLinearMap ∘ₗ ↑R (LinearMap.toSpanSingleton A (DualNumber A) DualNumber.eps)
theorem DualNumber.algHom_ext E1 #
∀ {R : Type u_1} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Algebra R A]
⦃f g : DualNumber R →ₐ[R] A⦄, f DualNumber.eps = g DualNumber.eps → f = g
For two R-algebra morphisms out of R[ε] to agree, it suffices for them to agree on ε.
theorem DualNumber.algHom_ext_iff E0 #
∀ {R : Type u_1} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Algebra R A]
{f g : DualNumber R →ₐ[R] A}, f = g ↔ f DualNumber.eps = g DualNumber.eps
theorem DualNumber.ringHom_ext E1 #
∀ {R : Type u_1} [inst : CommSemiring R] {R' : Type u_5} [inst_1 : CommSemiring R'] {f g : DualNumber R →+* R'},
f.comp (algebraMap R (DualNumber R)) = g.comp (algebraMap R (DualNumber R)) →
f DualNumber.eps = g DualNumber.eps → f = g
A ring morphism R[ε] →+* R' is determined by its restriction
on R and its value on ε.
theorem DualNumber.ringHom_ext_iff E0 #
∀ {R : Type u_1} [inst : CommSemiring R] {R' : Type u_5} [inst_1 : CommSemiring R'] {f g : DualNumber R →+* R'},
f = g ↔
f.comp (algebraMap R (DualNumber R)) = g.comp (algebraMap R (DualNumber R)) ∧ f DualNumber.eps = g DualNumber.eps
def DualNumber.lift E3 #
{R : Type u_1} →
{B : Type u_3} →
{A : Type u_4} →
[inst : CommSemiring R] →
[inst_1 : Semiring A] →
[inst_2 : Semiring B] →
[inst_3 : Algebra R A] →
[inst_4 : Algebra R B] →
{ fe // fe.2 * fe.2 = 0 ∧ ∀ (a : A), Commute fe.2 (fe.1 a) } ≃ (DualNumber A →ₐ[R] B)
A universal property of the dual numbers, providing a unique A[ε] →ₐ[R] B for every map
f : A →ₐ[R] B and a choice of element e : B which squares to 0 and commutes with the range of
f.
This isomorphism is named to match the similar Complex.lift.
Note that when f : R →ₐ[R] B := Algebra.ofId R B, the commutativity assumption is automatic, and
we are free to choose any element e : B.
theorem DualNumber.lift_apply_apply E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { _fe // _fe.2 * _fe.2 = 0 ∧ ∀ (a : A), Commute _fe.2 (_fe.1 a) })
(a : DualNumber A), (DualNumber.lift fe) a = (↑fe).1 (TrivSqZeroExt.fst a) + (↑fe).1 (TrivSqZeroExt.snd a) * (↑fe).2
theorem DualNumber.coe_lift_symm_apply E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (F : DualNumber A →ₐ[R] B),
↑(DualNumber.lift.symm F) = (F.comp (TrivSqZeroExt.inlAlgHom R A A), F DualNumber.eps)
theorem DualNumber.lift_apply_inl E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { _fe // _fe.2 * _fe.2 = 0 ∧ ∀ (a : A), Commute _fe.2 (_fe.1 a) })
(a : A), (DualNumber.lift fe) (TrivSqZeroExt.inl a) = (↑fe).1 a
When applied to inl, DualNumber.lift applies the map f : A →ₐ[R] B.
theorem DualNumber.lift_comp_inlHom E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B]
(fe : { _fe // _fe.2 * _fe.2 = 0 ∧ ∀ (a : A), Commute _fe.2 (_fe.1 a) }),
(DualNumber.lift fe).comp (TrivSqZeroExt.inlAlgHom R A A) = (↑fe).1
theorem DualNumber.lift_smul E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { _fe // _fe.2 * _fe.2 = 0 ∧ ∀ (a : A), Commute _fe.2 (_fe.1 a) })
(a : A) (ad : DualNumber A), (DualNumber.lift fe) (a • ad) = (↑fe).1 a * (DualNumber.lift fe) ad
Scaling on the left is sent by DualNumber.lift to multiplication on the left
theorem DualNumber.lift_op_smul E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { _fe // _fe.2 * _fe.2 = 0 ∧ ∀ (a : A), Commute _fe.2 (_fe.1 a) })
(a : A) (ad : DualNumber A), (DualNumber.lift fe) (MulOpposite.op a • ad) = (DualNumber.lift fe) ad * (↑fe).1 a
Scaling on the right is sent by DualNumber.lift to multiplication on the right
theorem DualNumber.lift_apply_eps E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { fe // fe.2 * fe.2 = 0 ∧ ∀ (a : A), Commute fe.2 (fe.1 a) }),
(DualNumber.lift fe) DualNumber.eps = (↑fe).2
When applied to ε, DualNumber.lift produces the element of B that squares to 0.
theorem DualNumber.lift_inlAlgHom_eps E0 #
∀ {R : Type u_1} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Algebra R A],
DualNumber.lift ⟨(TrivSqZeroExt.inlAlgHom R A A, DualNumber.eps), ⋯⟩ = AlgHom.id R (DualNumber A)
Lifting DualNumber.eps itself gives the identity.
theorem DualNumber.range_inlAlgHom_sup_adjoin_eps E0 #
∀ {R : Type u_1} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Algebra R A],
(TrivSqZeroExt.inlAlgHom R A A).range ⊔ R[DualNumber.eps] = ⊤
theorem DualNumber.range_lift E0 #
∀ {R : Type u_1} {B : Type u_3} {A : Type u_4} [inst : CommSemiring R] [inst_1 : Semiring A] [inst_2 : Semiring B]
[inst_3 : Algebra R A] [inst_4 : Algebra R B] (fe : { fe // fe.2 * fe.2 = 0 ∧ ∀ (a : A), Commute fe.2 (fe.1 a) }),
(DualNumber.lift fe).range = (↑fe).1.range ⊔ R[(↑fe).2]
instance DualNumber.instRepr E0 #
{R : Type u_1} → [Repr R] → Repr (DualNumber R)
Show DualNumber with values x and y as an "x + y*ε" string