Skip to content

Commit

Permalink
feat(data/nat/factorization): Lemma on zero-ness of factorization (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Smaug123 committed Jun 5, 2022
1 parent 043fa29 commit 736b4e5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/data/nat/factorization.lean
Expand Up @@ -104,6 +104,15 @@ by rwa [←factors_count_eq, count_pos, mem_factors_iff_dvd hn hp]
lemma factorization_eq_zero_iff (n : ℕ) : n.factorization = 0 ↔ n = 0 ∨ n = 1 :=
by simp [factorization, add_equiv.map_eq_zero_iff, multiset.coe_eq_zero]

lemma factorization_eq_zero_iff' (n p : ℕ) :
n.factorization p = 0 ↔ ¬p.prime ∨ ¬p ∣ n ∨ n = 0 :=
begin
rw [←not_mem_support_iff, support_factorization, mem_to_finset],
rcases eq_or_ne n 0 with rfl | hn,
{ simp },
{ simp [hn, nat.mem_factors, not_and_distrib] },
end

/-- For nonzero `a` and `b`, the power of `p` in `a * b` is the sum of the powers in `a` and `b` -/
@[simp] lemma factorization_mul {a b : ℕ} (ha : a ≠ 0) (hb : b ≠ 0) :
(a * b).factorization = a.factorization + b.factorization :=
Expand Down

0 comments on commit 736b4e5

Please sign in to comment.