File: Mathlib/Algebra/DualNumber.lean

full_name: DualNumber
code: /-- The type of dual numbers, numbers of the form $a + bε$ where $ε^2 = 0$.
`R[ε]` is notation for `DualNumber R`. -/
abbrev DualNumber (R : Type*) : Type _ 
goal: Type u_4

full_name: DualNumber.eps
code: /-- The unit element $ε$ that squares to zero, with notation `ε`. -/
def DualNumber.eps [Zero R] [One R] : DualNumber R 
goal: R[ε]

full_name: DualNumber._aux_Mathlib_Algebra_DualNumber___unexpand_DualNumber_eps_1
code: @[inherit_doc]
scoped[DualNumber] notation "ε" => DualNumber.eps
goal: Lean.PrettyPrinter.Unexpander

full_name: DualNumber._aux_Mathlib_Algebra_DualNumber___macroRules_DualNumber_termε_1
code: @[inherit_doc]
scoped[DualNumber] notation "ε" => DualNumber.eps
goal: Lean.Macro

full_name: DualNumber.«_aux_Mathlib_Algebra_DualNumber___macroRules_DualNumber_term_[ε]_1»
code: @[inherit_doc]
scoped[DualNumber] postfix:1024 "[ε]" => DualNumber
goal: Lean.Macro

full_name: DualNumber._aux_Mathlib_Algebra_DualNumber___unexpand_DualNumber_1
code: @[inherit_doc]
scoped[DualNumber] postfix:1024 "[ε]" => DualNumber
goal: Lean.PrettyPrinter.Unexpander

full_name: DualNumber.fst_eps
code: @[simp]
theorem fst_eps [Zero R] [One R] : fst ε = (0 : R) 
goal: TrivSqZeroExt.fst ε = 0

full_name: DualNumber.snd_eps
code: @[simp]
theorem snd_eps [Zero R] [One R] : snd ε = (1 : R) 
goal: TrivSqZeroExt.snd ε = 1

full_name: DualNumber.snd_mul
code: /-- A version of `TrivSqZeroExt.snd_mul` with `*` instead of `•`. -/
@[simp]
theorem snd_mul [Semiring R] (x y : R[ε]) : snd (x * y) = fst x * snd y + snd x * fst y 
goal: TrivSqZeroExt.snd (x * y) = TrivSqZeroExt.fst x * TrivSqZeroExt.snd y + TrivSqZeroExt.snd x * TrivSqZeroExt.fst y

full_name: DualNumber.eps_mul_eps
code: @[simp]
theorem eps_mul_eps [Semiring R] : (ε * ε : R[ε]) = 0 
goal: ε * ε = 0

full_name: DualNumber.inv_eps
code: @[simp]
theorem inv_eps [DivisionRing R] : (ε : R[ε])⁻¹ = 0 
goal: ε⁻¹ = 0

full_name: DualNumber.inr_eq_smul_eps
code: @[simp]
theorem inr_eq_smul_eps [MulZeroOneClass R] (r : R) : inr r = (r • ε : R[ε]) 
goal: TrivSqZeroExt.inr r = r • ε

full_name: DualNumber.commute_eps_left
code: /-- `ε` commutes with every element of the algebra. -/
theorem commute_eps_left [Semiring R] (x : DualNumber R) : Commute ε x 
goal: Commute ε x

full_name: DualNumber.commute_eps_right
code: /-- `ε` commutes with every element of the algebra. -/
theorem commute_eps_right [Semiring R] (x : DualNumber R) : Commute x ε 
goal: Commute x ε

full_name: DualNumber.algHom_ext'
code: /-- 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 `ε`. -/
@[ext 1100]
nonrec theorem algHom_ext' ⦃f g : A[ε] →ₐ[R] B⦄
    (hinl : f.comp (inlAlgHom _ _ _) = g.comp (inlAlgHom _ _ _))
    (hinr : f.toLinearMap ∘ₗ (LinearMap.toSpanSingleton A A[ε] ε).restrictScalars R =
        g.toLinearMap ∘ₗ (LinearMap.toSpanSingleton A A[ε] ε).restrictScalars R) :
      f = g 
goal: f = g

full_name: DualNumber.algHom_ext
code: /-- For two `R`-algebra morphisms out of `R[ε]` to agree, it suffices for them to agree on `ε`. -/
@[ext 1200]
nonrec theorem algHom_ext ⦃f g : R[ε] →ₐ[R] A⦄ (hε : f ε = g ε) : f = g 
goal: f = g

full_name: DualNumber.lift
code: /-- 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`. -/
def lift :
    {fe : (A →ₐ[R] B) × B // fe.2 * fe.2 = 0 ∧ ∀ a, Commute fe.2 (fe.1 a)} ≃ (A[ε] →ₐ[R] B) 
goal: { fe // fe.2 * fe.2 = 0 ∧ ∀ (a : A), Commute fe.2 (fe.1 a) } ≃ (A[ε] →ₐ[R] B)

full_name: DualNumber.lift_apply_apply
code: theorem lift_apply_apply (fe : {_fe : (A →ₐ[R] B) × B // _}) (a : A[ε]) :
    lift fe a = fe.val.1 a.fst + fe.val.1 a.snd * fe.val.2 
goal: (DualNumber.lift fe) a = (↑fe).1 (TrivSqZeroExt.fst a) + (↑fe).1 (TrivSqZeroExt.snd a) * (↑fe).2

full_name: DualNumber.coe_lift_symm_apply
code: @[simp] theorem coe_lift_symm_apply (F : A[ε] →ₐ[R] B) :
    (lift.symm F).val = (F.comp (inlAlgHom _ _ _), F ε) 
goal: ↑(DualNumber.lift.symm F) = (F.comp (TrivSqZeroExt.inlAlgHom R A A), F ε)

full_name: DualNumber.lift_apply_inl
code: /-- When applied to `inl`, `DualNumber.lift` applies the map `f : A →ₐ[R] B`. -/
@[simp] theorem lift_apply_inl (fe : {fe : (A →ₐ[R] B) × B // _}) (a : A) :
    lift fe (inl a : A[ε]) = fe.val.1 a 
goal: (DualNumber.lift fe) (TrivSqZeroExt.inl a) = (↑fe).1 a

full_name: DualNumber.lift_smul
code: /-- Scaling on the left is sent by `DualNumber.lift` to multiplication on the left -/
@[simp] theorem lift_smul (fe : {fe : (A →ₐ[R] B) × B // _}) (a : A) (ad : A[ε]) :
    lift fe (a • ad) = fe.val.1 a * lift fe ad 
goal: (DualNumber.lift fe) (a • ad) = (↑fe).1 a * (DualNumber.lift fe) ad

full_name: DualNumber.lift_op_smul
code: /-- Scaling on the right is sent by `DualNumber.lift` to multiplication on the right -/
@[simp] theorem lift_op_smul (fe : {fe : (A →ₐ[R] B) × B // _}) (a : A) (ad : A[ε]) :
    lift fe (MulOpposite.op a • ad) = lift fe ad * fe.val.1 a 
goal: (DualNumber.lift fe) (MulOpposite.op a • ad) = (DualNumber.lift fe) ad * (↑fe).1 a

full_name: DualNumber.lift_apply_eps
code: /-- When applied to `ε`, `DualNumber.lift` produces the element of `B` that squares to 0. -/
@[simp] theorem lift_apply_eps
    (fe : {fe : (A →ₐ[R] B) × B // fe.2 * fe.2 = 0 ∧ ∀ a, Commute fe.2 (fe.1 a)}) :
    lift fe (ε : A[ε]) = fe.val.2 
goal: (DualNumber.lift fe) ε = (↑fe).2

full_name: DualNumber.lift_inlAlgHom_eps
code: /-- Lifting `DualNumber.eps` itself gives the identity. -/
@[simp]
theorem lift_inlAlgHom_eps :
    lift ⟨(inlAlgHom _ _ _, ε), eps_mul_eps, fun _ => commute_eps_left _⟩ = AlgHom.id R A[ε] 
goal: DualNumber.lift ⟨(TrivSqZeroExt.inlAlgHom R A A, ε), ⋯⟩ = AlgHom.id R A[ε]

full_name: DualNumber.instRepr
code: /-- Show DualNumber with values x and y as an "x + y*ε" string -/
instance instRepr [Repr R] : Repr (DualNumber R) 
goal: Repr R[ε]