Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 3f26dfe

Browse files
committed
feat(data/int/basic): Units are either equal or negatives of each other (#14517)
This PR adds a lemma stating that units in the integers are either equal or negatives of each other. I have found this lemma to be useful for casework.
1 parent b332507 commit 3f26dfe

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/data/int/basic.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,13 @@ begin
13151315
{ exact is_unit_one.neg }
13161316
end
13171317

1318+
lemma is_unit_eq_or_eq_neg {a b : ℤ} (ha : is_unit a) (hb : is_unit b) : a = b ∨ a = -b :=
1319+
begin
1320+
rcases is_unit_eq_one_or hb with rfl | rfl,
1321+
{ exact is_unit_eq_one_or ha },
1322+
{ rwa [or_comm, neg_neg, ←is_unit_iff] },
1323+
end
1324+
13181325
lemma eq_one_or_neg_one_of_mul_eq_one {z w : ℤ} (h : z * w = 1) : z = 1 ∨ z = -1 :=
13191326
is_unit_iff.mp (is_unit_of_mul_eq_one z w h)
13201327

0 commit comments

Comments
 (0)