Skip to content

Commit

Permalink
refactor(algebra/{dual_number,triv_sq_zero_ext}): support non-commuta…
Browse files Browse the repository at this point in the history
…tive rings (#18384)

This changes the definition of multiplication on `triv_sq_zero_ext R M` as follows
```diff
-x * y = (x.1 * y.1, x.1 • y.2 + y.1 • x.2)
+x * y = (x.1 * y.1, x.1 • y.2 + op y.1 • x.2)
```
which for `R=M` gives the more natural `x.1 * y.2 + x.2 * y.1` in the second term instead of  `x.1 * y.2 + y.1 * x.2`.

This adds some slightly annoying typeclass arguments that could eventually be cleaned up by #10716; but that PR has rotted under the mathlib4 tide. Either way, the weird typeclass arguments needed with `triv_sq_zero_ext R M` are all invisible when working with `dual_number R`.

This is motivated by wanting to talk about `dual_number (quaternion R)` or  `dual_number (matrix n n R)`.

Unfortunately this breaks the `topological_semiring` instance (making it need an `@` and trigger the `fails_quickly` linter), but this instance isn't really interesting anyway.
  • Loading branch information
eric-wieser committed Feb 23, 2023
1 parent 1ed3a11 commit b8d2eaa
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/algebra/dual_number.lean
Expand Up @@ -56,7 +56,7 @@ open triv_sq_zero_ext
@[simp] lemma snd_eps [has_zero R] [has_one R] : snd ε = (1 : R) := snd_inr _ _

/-- A version of `triv_sq_zero_ext.snd_mul` with `*` instead of `•`. -/
@[simp] lemma snd_mul [semiring R] (x y : R[ε]) : snd (x * y) = fst x * snd y + fst y * snd x :=
@[simp] lemma snd_mul [semiring R] (x y : R[ε]) : snd (x * y) = fst x * snd y + snd x * fst y :=
snd_mul _ _

@[simp] lemma eps_mul_eps [semiring R] : (ε * ε : R[ε]) = 0 := inr_mul_inr _ _ _
Expand Down

0 comments on commit b8d2eaa

Please sign in to comment.