Skip to content

Commit

Permalink
feat(data/int/cast): cast_nat_abs (#8120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcommelin committed Jun 30, 2021
1 parent ad00a02 commit 0faf086
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/data/int/cast.lean
Expand Up @@ -189,6 +189,11 @@ monotone.map_max cast_mono
((abs q : ℤ) : α) = abs q :=
by simp [abs]

lemma cast_nat_abs {R : Type*} [linear_ordered_ring R] : ∀ (n : ℤ), (n.nat_abs : R) = abs n
| (n : ℕ) := by simp only [int.nat_abs_of_nat, int.cast_coe_nat, nat.abs_cast]
| -[1+n] := by simp only [int.nat_abs, int.cast_neg_succ_of_nat, abs_neg,
← nat.cast_succ, nat.abs_cast]

lemma coe_int_dvd [comm_ring α] (m n : ℤ) (h : m ∣ n) :
(m : α) ∣ (n : α) :=
ring_hom.map_dvd (int.cast_ring_hom α) h
Expand Down

0 comments on commit 0faf086

Please sign in to comment.