Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tactic/field_simp): extend
field_simp
to partial division and …
…units (#14897) Extend the `field_simp` tactic to deal with inverses of units in a general monoid/ring. [Zulip thread](https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F/topic/.E2.9C.94.20.60field_simp.60.20for.20units/near/286896891) Co-authored-by: Jon <jon.eugster@gmx.ch>
- Loading branch information
Jon Eugster
and
Jon
committed
Aug 3, 2022
1 parent
acc7dfa
commit 24a09b3
Showing
5 changed files
with
146 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import algebra.ring.basic | ||
import tactic.field_simp | ||
import tactic.ring | ||
|
||
/-! | ||
## `field_simp` tests. | ||
Check that `field_simp` works for units of a ring. | ||
-/ | ||
|
||
variables {R : Type*} [comm_ring R] (a b c d e f g : R) (u₁ u₂ : Rˣ) | ||
|
||
/-- | ||
Check that `divp_add_divp_same` takes priority over `divp_add_divp`. | ||
-/ | ||
example : a /ₚ u₁ + b /ₚ u₁ = (a + b) /ₚ u₁ := | ||
by field_simp | ||
|
||
/-- | ||
Check that `divp_sub_divp_same` takes priority over `divp_sub_divp`. | ||
-/ | ||
example : a /ₚ u₁ - b /ₚ u₁ = (a - b) /ₚ u₁ := | ||
by field_simp | ||
|
||
/-- | ||
Combining `eq_divp_iff_mul_eq` and `divp_eq_iff_mul_eq`. | ||
-/ | ||
example : a /ₚ u₁ = b /ₚ u₂ ↔ a * u₂ = b * u₁ := | ||
by field_simp | ||
|
||
/-- | ||
Making sure inverses of units are rewritten properly. | ||
-/ | ||
example : ↑u₁⁻¹ = 1 /ₚ u₁ := | ||
by field_simp | ||
|
||
/-- | ||
Checking arithmetic expressions. | ||
-/ | ||
example : (f - (e + c * -(a /ₚ u₁) * b + d) - g) = | ||
(f * u₁ - (e * u₁ + c * (-a) * b + d * u₁) - g * u₁) /ₚ u₁ := | ||
by field_simp | ||
|
||
/-- | ||
Division of units. | ||
-/ | ||
example : a /ₚ (u₁ / u₂) = a * u₂ /ₚ u₁ := | ||
by field_simp | ||
|
||
example : a /ₚ u₁ /ₚ u₂ = a /ₚ (u₂ * u₁) := | ||
by field_simp |