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

Commit 9d04844

Browse files
committed
feat(data/int/basic): Sum of units casework lemma (#14557)
This PR adds a casework lemma for when the sum of two units equals the sum of two units. I needed this lemma for irreducibility of x^n-x-1. Co-authored-by: tb65536 <tb65536@users.noreply.github.com>
1 parent 759516c commit 9d04844

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/data/int/basic.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,16 @@ by rw [←units.coe_mul, units_mul_self, units.coe_one]
13681368
@[simp] lemma neg_one_pow_ne_zero {n : ℕ} : (-1 : ℤ)^n ≠ 0 :=
13691369
pow_ne_zero _ (abs_pos.mp trivial)
13701370

1371+
lemma is_unit_add_is_unit_eq_is_unit_add_is_unit {a b c d : ℤ}
1372+
(ha : is_unit a) (hb : is_unit b) (hc : is_unit c) (hd : is_unit d) :
1373+
a + b = c + d ↔ a = c ∧ b = d ∨ a = d ∧ b = c :=
1374+
begin
1375+
rw is_unit_iff at ha hb hc hd,
1376+
cases ha; cases hb; cases hc; cases hd;
1377+
subst ha; subst hb; subst hc; subst hd;
1378+
tidy,
1379+
end
1380+
13711381
/-! ### bitwise ops -/
13721382

13731383
@[simp] lemma bodd_zero : bodd 0 = ff := rfl

0 commit comments

Comments
 (0)