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

Commit 52b839f

Browse files
committed
feat(data/polynomial): is_unit_C (#2812)
1 parent 3e0668e commit 52b839f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/data/polynomial.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,18 @@ by rw [ne.def, ← degree_eq_bot];
964964
by rw [coeff_mul, nat.antidiagonal_zero];
965965
simp only [polynomial.coeff_X_zero, finset.sum_singleton, mul_zero]
966966

967+
lemma is_unit_C {x : R} : is_unit (C x) ↔ is_unit x :=
968+
begin
969+
rw [is_unit_iff_dvd_one, is_unit_iff_dvd_one],
970+
split,
971+
{ rintros ⟨g, hg⟩,
972+
replace hg := congr_arg (eval 0) hg,
973+
rw [eval_one, eval_mul, eval_C] at hg,
974+
exact ⟨g.eval 0, hg⟩ },
975+
{ rintros ⟨y, hy⟩,
976+
exact ⟨C y, by rw [← C_mul, ← hy, C_1]⟩ }
977+
end
978+
967979
end comm_semiring
968980

969981
instance subsingleton [subsingleton R] [comm_semiring R] : subsingleton (polynomial R) :=

0 commit comments

Comments
 (0)