data.int.basicMathlib.Data.Int.Basic

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

feat(ring_theory/zmod): Criterion for zmod to be a reduced ring (#16998)

I couldn't find a good place for this without adding some imports, so a new file seemed appropriate.

Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>

Diff
@@ -186,6 +186,8 @@ variables {a b : ℤ} {n : ℕ}
 
 attribute [simp] nat_abs_of_nat nat_abs_zero nat_abs_one
 
+lemma nat_abs_surjective : nat_abs.surjective := λ n, ⟨n, nat_abs_of_nat n⟩
+
 theorem nat_abs_add_le (a b : ℤ) : nat_abs (a + b) ≤ nat_abs a + nat_abs b :=
 begin
   have : ∀ (a b : ℕ), nat_abs (sub_nat_nat a (nat.succ b)) ≤ nat.succ (a + b),

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(archive/imo/imo2006_q5): IMO 2006 Q5 (#15613)

See module docstring for a thorough explanation of the proof.

Co-authored-by: Thomas Browning <tb65536@uw.edu>

Diff
@@ -86,6 +86,9 @@ namespace int
 
 @[simp] lemma add_neg_one (i : ℤ) : i + -1 = i - 1 := rfl
 
+@[simp] theorem sign_coe_add_one (n : ℕ) : int.sign (n + 1) = 1 := rfl
+@[simp] theorem sign_neg_succ_of_nat (n : ℕ) : int.sign -[1+ n] = -1 := rfl
+
 @[simp] lemma default_eq_zero : default = (0 : ℤ) := rfl
 
 meta instance : has_to_format ℤ := ⟨λ z, to_string z⟩

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

refactor(algebra/group/basic): rework lemmas on inv and neg (#17483)

This PR adds the following lemma (and its additive equivalent).

theorem inv_eq_iff_eq_inv : a⁻¹ = b ↔ a = b⁻¹

and removes eq_inv_of_eq_inv, eq_inv_iff_eq_inv and inv_eq_iff_inv_eq (and their additive equivalents).

Diff
@@ -147,7 +147,7 @@ theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a :=
 by rw [neg_succ, succ_pred]
 
 theorem neg_pred (a : ℤ) : -pred a = succ (-a) :=
-by rw [eq_neg_of_eq_neg (neg_succ (-a)).symm, neg_neg]
+by rw [neg_eq_iff_eq_neg.mp (neg_succ (-a)), neg_neg]
 
 theorem pred_neg_pred (a : ℤ) : pred (-pred a) = -a :=
 by rw [neg_pred, pred_succ]
@@ -337,9 +337,8 @@ end
 
 theorem mod_add_div_aux (m n : ℕ) : (n - (m % n + 1) - (n * (m / n) + n) : ℤ) = -[1+ m] :=
 begin
-  rw [← sub_sub, neg_succ_of_nat_coe, sub_sub (n:ℤ)],
-  apply eq_neg_of_eq_neg,
-  rw [neg_sub, sub_sub_self, add_right_comm],
+  rw [← sub_sub, neg_succ_of_nat_coe, sub_sub (n:ℤ), eq_comm, neg_eq_iff_eq_neg,
+      neg_sub, sub_sub_self, add_right_comm],
   exact @congr_arg ℕ ℤ _ _ (λi, (i + 1 : ℤ)) (nat.mod_add_div _ _).symm
 end
 

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

chore(data/int/order/basic): Fix lemma name (#17967)

int.coe_nat_abs wasn't referring to the correct lemma. Change the name, add the lemma it should correspond to and tag both with simp and norm_cast.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -181,7 +181,7 @@ end
 
 variables {a b : ℤ} {n : ℕ}
 
-attribute [simp] nat_abs nat_abs_of_nat nat_abs_zero nat_abs_one
+attribute [simp] nat_abs_of_nat nat_abs_zero nat_abs_one
 
 theorem nat_abs_add_le (a b : ℤ) : nat_abs (a + b) ≤ nat_abs a + nat_abs b :=
 begin
@@ -212,7 +212,7 @@ lemma nat_abs_mul_nat_abs_eq {a b : ℤ} {c : ℕ} (h : a * b = (c : ℤ)) :
   a.nat_abs * b.nat_abs = c :=
 by rw [← nat_abs_mul, h, nat_abs_of_nat]
 
-@[simp] lemma nat_abs_mul_self' (a : ℤ) : (nat_abs a * nat_abs a : ℤ) = a * a :=
+lemma nat_abs_mul_self' (a : ℤ) : (nat_abs a * nat_abs a : ℤ) = a * a :=
 by rw [← int.coe_nat_mul, nat_abs_mul_self]
 
 theorem neg_succ_of_nat_eq' (m : ℕ) : -[1+ m] = -m - 1 :=

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

refactor(data/set/intervals/monotone): split (#17893)

Also generalize&golf monotone_on.exists_monotone_extension and rename order.monotone to order.monotone.basic.

Lean 4 version is leanprover-community/mathlib4#947

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
 import data.nat.basic
-import order.monotone
+import order.monotone.basic
 
 /-!
 # Basic instances on the integers

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Data.Nat.Defs
+import Algebra.Group.Nat
 import Order.Monotone.Basic
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Data.Nat.Basic
+import Data.Nat.Defs
 import Order.Monotone.Basic
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
@@ -108,11 +108,11 @@ theorem add_neg_one (i : ℤ) : i + -1 = i - 1 :=
 #align int.add_neg_one Int.add_neg_one
 -/
 
-#print Int.sign_coe_add_one /-
+#print Int.sign_natCast_add_one /-
 @[simp]
-theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
+theorem sign_natCast_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
   rfl
-#align int.sign_coe_add_one Int.sign_coe_add_one
+#align int.sign_coe_add_one Int.sign_natCast_add_one
 -/
 
 #print Int.sign_negSucc /-
@@ -215,10 +215,10 @@ theorem ofNat_lt {m n : ℕ} : (↑m : ℤ) < ↑n ↔ m < n :=
 #align int.coe_nat_lt Int.ofNat_lt
 -/
 
-#print Int.coe_nat_inj' /-
-theorem coe_nat_inj' {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n :=
+#print Int.natCast_inj /-
+theorem natCast_inj {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n :=
   Int.ofNat_inj m n
-#align int.coe_nat_inj' Int.coe_nat_inj'
+#align int.coe_nat_inj' Int.natCast_inj
 -/
 
 #print Int.coe_nat_strictMono /-
@@ -226,10 +226,10 @@ theorem coe_nat_strictMono : StrictMono (coe : ℕ → ℤ) := fun _ _ => Int.of
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
 -/
 
-#print Int.coe_nat_nonneg /-
-theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) :=
+#print Int.natCast_nonneg /-
+theorem natCast_nonneg (n : ℕ) : 0 ≤ (n : ℤ) :=
   ofNat_le.2 (Nat.zero_le _)
-#align int.coe_nat_nonneg Int.coe_nat_nonneg
+#align int.coe_nat_nonneg Int.natCast_nonneg
 -/
 
 #print Int.negSucc_ne_zero /-
@@ -261,15 +261,15 @@ def pred (a : ℤ) :=
 #align int.pred Int.pred
 -/
 
-#print Int.nat_succ_eq_int_succ /-
-theorem nat_succ_eq_int_succ (n : ℕ) : (Nat.succ n : ℤ) = Int.succ n :=
+#print Int.natCast_succ /-
+theorem natCast_succ (n : ℕ) : (Nat.succ n : ℤ) = Int.succ n :=
   rfl
-#align int.nat_succ_eq_int_succ Int.nat_succ_eq_int_succ
+#align int.nat_succ_eq_int_succ Int.natCast_succ
 -/
 
 #print Int.pred_succ /-
 theorem pred_succ (a : ℤ) : pred (succ a) = a :=
-  add_sub_cancel _ _
+  add_sub_cancel_right _ _
 #align int.pred_succ Int.pred_succ
 -/
 
@@ -313,10 +313,10 @@ theorem neg_nat_succ (n : ℕ) : -(Nat.succ n : ℤ) = pred (-n) :=
 #align int.neg_nat_succ Int.neg_nat_succ
 -/
 
-#print Int.succ_neg_nat_succ /-
-theorem succ_neg_nat_succ (n : ℕ) : succ (-Nat.succ n) = -n :=
+#print Int.succ_neg_natCast_succ /-
+theorem succ_neg_natCast_succ (n : ℕ) : succ (-Nat.succ n) = -n :=
   succ_neg_succ n
-#align int.succ_neg_nat_succ Int.succ_neg_nat_succ
+#align int.succ_neg_nat_succ Int.succ_neg_natCast_succ
 -/
 
 #print Int.add_one_le_iff /-
@@ -325,11 +325,11 @@ theorem add_one_le_iff {a b : ℤ} : a + 1 ≤ b ↔ a < b :=
 #align int.add_one_le_iff Int.add_one_le_iff
 -/
 
-#print Int.coe_pred_of_pos /-
+#print Int.natCast_pred_of_pos /-
 @[norm_cast]
-theorem coe_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by cases n;
+theorem natCast_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by cases n;
   cases h; simp
-#align int.coe_pred_of_pos Int.coe_pred_of_pos
+#align int.coe_pred_of_pos Int.natCast_pred_of_pos
 -/
 
 #print Int.induction_on /-
@@ -418,14 +418,16 @@ theorem negSucc_eq' (m : ℕ) : -[m+1] = -m - 1 := by simp [neg_succ_of_nat_eq,
 
 #print Int.natAbs_ne_zero_of_ne_zero /-
 theorem natAbs_ne_zero_of_ne_zero {z : ℤ} (hz : z ≠ 0) : z.natAbs ≠ 0 := fun h =>
-  hz <| Int.eq_zero_of_natAbs_eq_zero h
+  hz <| Int.natAbs_eq_zero h
 #align int.nat_abs_ne_zero_of_ne_zero Int.natAbs_ne_zero_of_ne_zero
 -/
 
+/- warning: int.nat_abs_eq_zero clashes with int.eq_zero_of_nat_abs_eq_zero -> Int.natAbs_eq_zero
+Case conversion may be inaccurate. Consider using '#align int.nat_abs_eq_zero Int.natAbs_eq_zeroₓ'. -/
 #print Int.natAbs_eq_zero /-
 @[simp]
 theorem natAbs_eq_zero {a : ℤ} : a.natAbs = 0 ↔ a = 0 :=
-  ⟨Int.eq_zero_of_natAbs_eq_zero, fun h => h.symm ▸ rfl⟩
+  ⟨Int.natAbs_eq_zero, fun h => h.symm ▸ rfl⟩
 #align int.nat_abs_eq_zero Int.natAbs_eq_zero
 -/
 
@@ -471,11 +473,11 @@ theorem ofNat_div (m n : ℕ) : ofNat (m / n) = ofNat m / ofNat n :=
 #align int.of_nat_div Int.ofNat_div
 -/
 
-#print Int.coe_nat_div /-
+#print Int.natCast_div /-
 @[simp, norm_cast]
-theorem coe_nat_div (m n : ℕ) : ((m / n : ℕ) : ℤ) = m / n :=
+theorem natCast_div (m n : ℕ) : ((m / n : ℕ) : ℤ) = m / n :=
   rfl
-#align int.coe_nat_div Int.coe_nat_div
+#align int.coe_nat_div Int.natCast_div
 -/
 
 #print Int.negSucc_ediv /-
@@ -517,7 +519,7 @@ protected theorem div_neg : ∀ a b : ℤ, a / -b = -(a / b)
 theorem ediv_of_neg_of_pos {a b : ℤ} (Ha : a < 0) (Hb : 0 < b) : a / b = -((-a - 1) / b + 1) :=
   match a, b, eq_negSucc_of_lt_zero Ha, eq_succ_of_zero_lt Hb with
   | _, _, ⟨m, rfl⟩, ⟨n, rfl⟩ => by
-    change (- -[m+1] : ℤ) with (m + 1 : ℤ) <;> rw [add_sub_cancel] <;> rfl
+    change (- -[m+1] : ℤ) with (m + 1 : ℤ) <;> rw [add_sub_cancel_right] <;> rfl
 #align int.div_of_neg_of_pos Int.ediv_of_neg_of_pos
 -/
 
@@ -553,11 +555,11 @@ theorem ofNat_mod_ofNat (m n : Nat) : (m % n : ℤ) = ofNat (m % n) :=
 #align int.of_nat_mod Int.ofNat_mod_ofNat
 -/
 
-#print Int.coe_nat_mod /-
+#print Int.natCast_mod /-
 @[simp, norm_cast]
-theorem coe_nat_mod (m n : ℕ) : (↑(m % n) : ℤ) = ↑m % ↑n :=
+theorem natCast_mod (m n : ℕ) : (↑(m % n) : ℤ) = ↑m % ↑n :=
   rfl
-#align int.coe_nat_mod Int.coe_nat_mod
+#align int.coe_nat_mod Int.natCast_mod
 -/
 
 #print Int.negSucc_emod /-
@@ -700,12 +702,12 @@ theorem natAbs_sign_of_nonzero {z : ℤ} (hz : z ≠ 0) : z.sign.natAbs = 1 := b
 #align int.nat_abs_sign_of_nonzero Int.natAbs_sign_of_nonzero
 -/
 
-#print Int.sign_coe_nat_of_nonzero /-
-theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 :=
+#print Int.sign_natCast_of_ne_zero /-
+theorem sign_natCast_of_ne_zero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 :=
   by
   obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hn
   exact Int.sign_of_succ n
-#align int.sign_coe_nat_of_nonzero Int.sign_coe_nat_of_nonzero
+#align int.sign_coe_nat_of_nonzero Int.sign_natCast_of_ne_zero
 -/
 
 #print Int.sign_neg /-
@@ -793,18 +795,18 @@ theorem toNat_of_nonneg {a : ℤ} (h : 0 ≤ a) : (toNat a : ℤ) = a := by
 #align int.to_nat_of_nonneg Int.toNat_of_nonneg
 -/
 
-#print Int.toNat_coe_nat /-
+#print Int.toNat_natCast /-
 @[simp]
-theorem toNat_coe_nat (n : ℕ) : toNat ↑n = n :=
+theorem toNat_natCast (n : ℕ) : toNat ↑n = n :=
   rfl
-#align int.to_nat_coe_nat Int.toNat_coe_nat
+#align int.to_nat_coe_nat Int.toNat_natCast
 -/
 
-#print Int.toNat_coe_nat_add_one /-
+#print Int.toNat_natCast_add_one /-
 @[simp]
-theorem toNat_coe_nat_add_one {n : ℕ} : ((n : ℤ) + 1).toNat = n + 1 :=
+theorem toNat_natCast_add_one {n : ℕ} : ((n : ℤ) + 1).toNat = n + 1 :=
   rfl
-#align int.to_nat_coe_nat_add_one Int.toNat_coe_nat_add_one
+#align int.to_nat_coe_nat_add_one Int.toNat_natCast_add_one
 -/
 
 #print Int.self_le_toNat /-
@@ -874,7 +876,7 @@ def toNat' : ℤ → Option ℕ
 
 #print Int.mem_toNat' /-
 theorem mem_toNat' : ∀ (a : ℤ) (n : ℕ), n ∈ toNat' a ↔ a = n
-  | (m : ℕ), n => Option.some_inj.trans coe_nat_inj'.symm
+  | (m : ℕ), n => Option.some_inj.trans natCast_inj.symm
   | -[m+1], n => by constructor <;> intro h <;> cases h
 #align int.mem_to_nat' Int.mem_toNat'
 -/
Diff
@@ -681,7 +681,7 @@ theorem mul_emod_mul_of_pos {a : ℤ} (H : 0 < a) (b c : ℤ) : a * b % (a * c)
 -/
 
 theorem mul_div_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : b * (a / b) = a := by
-  have := mod_add_div a b <;> rwa [H, zero_add] at this 
+  have := mod_add_div a b <;> rwa [H, zero_add] at this
 #align int.mul_div_cancel_of_mod_eq_zero Int.mul_div_cancel_of_mod_eq_zeroₓ
 
 theorem div_mul_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : a / b * b = a := by
Diff
@@ -203,16 +203,12 @@ theorem negSucc_mul_negSucc (m n : ℕ) : -[m+1] * -[n+1] = succ m * succ n :=
 #align int.neg_succ_mul_neg_succ Int.negSucc_mul_negSucc
 -/
 
-/- warning: int.coe_nat_le clashes with int.coe_nat_le_coe_nat_iff -> Int.ofNat_le
-Case conversion may be inaccurate. Consider using '#align int.coe_nat_le Int.ofNat_leₓ'. -/
 #print Int.ofNat_le /-
 theorem ofNat_le {m n : ℕ} : (↑m : ℤ) ≤ ↑n ↔ m ≤ n :=
   ofNat_le m n
 #align int.coe_nat_le Int.ofNat_le
 -/
 
-/- warning: int.coe_nat_lt clashes with int.coe_nat_lt_coe_nat_iff -> Int.ofNat_lt
-Case conversion may be inaccurate. Consider using '#align int.coe_nat_lt Int.ofNat_ltₓ'. -/
 #print Int.ofNat_lt /-
 theorem ofNat_lt {m n : ℕ} : (↑m : ℤ) < ↑n ↔ m < n :=
   ofNat_lt m n
Diff
@@ -652,7 +652,7 @@ theorem mul_ediv_mul_of_pos {a : ℤ} (b c : ℤ) (H : 0 < a) : a * b / (a * c)
       rw [mul_neg, Int.div_neg, Int.div_neg] <;> apply congr_arg Neg.neg <;> apply this
   fun m k b =>
   match b, k with
-  | (n : ℕ), k => congr_arg ofNat (Nat.mul_div_mul _ _ m.succ_pos)
+  | (n : ℕ), k => congr_arg ofNat (Nat.mul_div_mul_left _ _ m.succ_pos)
   | -[n+1], 0 => by rw [Int.ofNat_zero, MulZeroClass.mul_zero, Int.div_zero, Int.div_zero]
   | -[n+1], k + 1 =>
     congr_arg negSucc <|
@@ -660,7 +660,7 @@ theorem mul_ediv_mul_of_pos {a : ℤ} (b c : ℤ) (H : 0 < a) : a * b / (a * c)
         by
         apply Nat.div_eq_of_lt_le
         · refine' le_trans _ (Nat.le_add_right _ _)
-          rw [← Nat.mul_div_mul _ _ m.succ_pos]
+          rw [← Nat.mul_div_mul_left _ _ m.succ_pos]
           apply Nat.div_mul_le_self
         · change m.succ * n.succ ≤ _
           rw [mul_left_comm]
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Mathbin.Data.Nat.Basic
-import Mathbin.Order.Monotone.Basic
+import Data.Nat.Basic
+import Order.Monotone.Basic
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
 
Diff
@@ -41,14 +41,14 @@ instance : CommRing ℤ where
   add_left_neg := Int.add_left_neg
   add_comm := Int.add_comm
   mul := Int.mul
-  mul_assoc := Int.mul_assoc
+  mul_assoc := Int.hMul_assoc
   one := Int.one
-  one_mul := Int.one_mul
-  mul_one := Int.mul_one
+  one_mul := Int.one_hMul
+  mul_one := Int.hMul_one
   sub := Int.sub
   left_distrib := Int.mul_add
   right_distrib := Int.add_mul
-  mul_comm := Int.mul_comm
+  mul_comm := Int.hMul_comm
   natCast := Int.ofNat
   natCast_zero := rfl
   natCast_succ n := rfl
@@ -56,9 +56,9 @@ instance : CommRing ℤ where
   intCast_ofNat n := rfl
   intCast_negSucc n := rfl
   zsmul := (· * ·)
-  zsmul_zero' := Int.zero_mul
+  zsmul_zero' := Int.zero_hMul
   zsmul_succ' n x := by
-    rw [Nat.succ_eq_add_one, Nat.add_comm, of_nat_add, Int.add_mul, of_nat_one, Int.one_mul]
+    rw [Nat.succ_eq_add_one, Nat.add_comm, of_nat_add, Int.add_mul, of_nat_one, Int.one_hMul]
   zsmul_neg' n x := Int.neg_mul_eq_neg_mul_symm (n.succ : ℤ) x
 
 /-! ### Extra instances to short-circuit type class resolution
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 00d163e35035c3577c1c79fa53b68de17781ffc1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Nat.Basic
 import Mathbin.Order.Monotone.Basic
 
+#align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
+
 /-!
 # Basic instances on the integers
 
Diff
@@ -228,8 +228,10 @@ theorem coe_nat_inj' {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n :=
 #align int.coe_nat_inj' Int.coe_nat_inj'
 -/
 
+#print Int.coe_nat_strictMono /-
 theorem coe_nat_strictMono : StrictMono (coe : ℕ → ℤ) := fun _ _ => Int.ofNat_lt.2
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
+-/
 
 #print Int.coe_nat_nonneg /-
 theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) :=
@@ -671,15 +673,19 @@ theorem mul_ediv_mul_of_pos {a : ℤ} (b c : ℤ) (H : 0 < a) : a * b / (a * c)
 #align int.mul_div_mul_of_pos Int.mul_ediv_mul_of_pos
 -/
 
+#print Int.mul_ediv_mul_of_pos_left /-
 @[simp]
 theorem mul_ediv_mul_of_pos_left (a : ℤ) {b : ℤ} (H : 0 < b) (c : ℤ) : a * b / (c * b) = a / c := by
   rw [mul_comm, mul_comm c, mul_div_mul_of_pos _ _ H]
 #align int.mul_div_mul_of_pos_left Int.mul_ediv_mul_of_pos_left
+-/
 
+#print Int.mul_emod_mul_of_pos /-
 @[simp]
 theorem mul_emod_mul_of_pos {a : ℤ} (H : 0 < a) (b c : ℤ) : a * b % (a * c) = a * (b % c) := by
   rw [mod_def, mod_def, mul_div_mul_of_pos _ _ H, mul_sub_left_distrib, mul_assoc]
 #align int.mul_mod_mul_of_pos Int.mul_emod_mul_of_pos
+-/
 
 theorem mul_div_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : b * (a / b) = a := by
   have := mod_add_div a b <;> rwa [H, zero_add] at this 
@@ -689,9 +695,11 @@ theorem div_mul_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : a / b * b =
   rw [mul_comm, mul_div_cancel_of_mod_eq_zero H]
 #align int.div_mul_cancel_of_mod_eq_zero Int.div_mul_cancel_of_mod_eq_zeroₓ
 
+#print Int.natAbs_sign /-
 theorem natAbs_sign (z : ℤ) : z.sign.natAbs = if z = 0 then 0 else 1 := by
   rcases z with ((_ | _) | _) <;> rfl
 #align int.nat_abs_sign Int.natAbs_sign
+-/
 
 #print Int.natAbs_sign_of_nonzero /-
 theorem natAbs_sign_of_nonzero {z : ℤ} (hz : z ≠ 0) : z.sign.natAbs = 1 := by
@@ -713,11 +721,13 @@ theorem sign_neg (z : ℤ) : Int.sign (-z) = -Int.sign z := by rcases z with ((_
 #align int.sign_neg Int.sign_neg
 -/
 
+#print Int.div_sign /-
 theorem div_sign : ∀ a b, a / sign b = a * sign b
   | a, (n + 1 : ℕ) => by unfold SignType.sign <;> simp
   | a, 0 => by simp [SignType.sign]
   | a, -[n+1] => by simp [SignType.sign]
 #align int.div_sign Int.div_sign
+-/
 
 #print Int.sign_mul /-
 @[simp]
@@ -762,10 +772,12 @@ theorem negSucc_add_negSucc (m n : ℕ) : -[m+1] + -[n+1] = -[Nat.succ (m + n)+1
 /-! ### to_nat -/
 
 
+#print Int.toNat_eq_max /-
 theorem toNat_eq_max : ∀ a : ℤ, (toNat a : ℤ) = max a 0
   | (n : ℕ) => (max_eq_left (ofNat_zero_le n)).symm
   | -[n+1] => (max_eq_right (le_of_lt (negSucc_lt_zero n))).symm
 #align int.to_nat_eq_max Int.toNat_eq_max
+-/
 
 #print Int.toNat_zero /-
 @[simp]
Diff
@@ -380,8 +380,8 @@ theorem natAbs_add_le (a b : ℤ) : natAbs (a + b) ≤ natAbs a + natAbs b :=
     · apply succ_le_succ
       rw [← succ.inj e, ← add_assoc, add_comm]
       apply Nat.le_add_right
-  cases a <;> cases' b with b b <;> simp [nat_abs, Nat.succ_add] <;> try rfl <;>
-      [skip;rw [add_comm a b]] <;>
+  cases a <;> cases' b with b b <;> simp [nat_abs, Nat.succ_add] <;> try rfl <;> [skip;
+      rw [add_comm a b]] <;>
     apply this
 #align int.nat_abs_add_le Int.natAbs_add_le
 -/
@@ -682,7 +682,7 @@ theorem mul_emod_mul_of_pos {a : ℤ} (H : 0 < a) (b c : ℤ) : a * b % (a * c)
 #align int.mul_mod_mul_of_pos Int.mul_emod_mul_of_pos
 
 theorem mul_div_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : b * (a / b) = a := by
-  have := mod_add_div a b <;> rwa [H, zero_add] at this
+  have := mod_add_div a b <;> rwa [H, zero_add] at this 
 #align int.mul_div_cancel_of_mod_eq_zero Int.mul_div_cancel_of_mod_eq_zeroₓ
 
 theorem div_mul_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : a / b * b = a := by
Diff
@@ -228,12 +228,6 @@ theorem coe_nat_inj' {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n :=
 #align int.coe_nat_inj' Int.coe_nat_inj'
 -/
 
-/- warning: int.coe_nat_strict_mono -> Int.coe_nat_strictMono is a dubious translation:
-lean 3 declaration is
-  StrictMono.{0, 0} Nat Int (PartialOrder.toPreorder.{0} Nat (LinearOrder.toPartialOrder.{0} Nat Nat.linearOrder)) (PartialOrder.toPreorder.{0} Int (LinearOrder.toPartialOrder.{0} Int Int.linearOrder)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))))
-but is expected to have type
-  StrictMono.{0, 0} Nat Int (PartialOrder.toPreorder.{0} Nat (LinearOrder.toPartialOrder.{0} Nat Nat.linearOrder)) (PartialOrder.toPreorder.{0} Int (LinearOrder.toPartialOrder.{0} Int Int.instLinearOrderInt)) (fun (x._@.Mathlib.Data.Int.Basic._hyg.840 : Nat) => Nat.cast.{0} Int instNatCastInt x._@.Mathlib.Data.Int.Basic._hyg.840)
-Case conversion may be inaccurate. Consider using '#align int.coe_nat_strict_mono Int.coe_nat_strictMonoₓ'. -/
 theorem coe_nat_strictMono : StrictMono (coe : ℕ → ℤ) := fun _ _ => Int.ofNat_lt.2
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
 
@@ -677,23 +671,11 @@ theorem mul_ediv_mul_of_pos {a : ℤ} (b c : ℤ) (H : 0 < a) : a * b / (a * c)
 #align int.mul_div_mul_of_pos Int.mul_ediv_mul_of_pos
 -/
 
-/- warning: int.mul_div_mul_of_pos_left -> Int.mul_ediv_mul_of_pos_left is a dubious translation:
-lean 3 declaration is
-  forall (a : Int) {b : Int}, (LT.lt.{0} Int Int.hasLt (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))) b) -> (forall (c : Int), Eq.{1} Int (HDiv.hDiv.{0, 0, 0} Int Int Int (instHDiv.{0} Int Int.hasDiv) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) a b) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) c b)) (HDiv.hDiv.{0, 0, 0} Int Int Int (instHDiv.{0} Int Int.hasDiv) a c))
-but is expected to have type
-  forall (a : Int) {b : Int} (H : Int), (LT.lt.{0} Int Int.instLTInt (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)) b) -> (Eq.{1} Int (HDiv.hDiv.{0, 0, 0} Int Int Int (instHDiv.{0} Int Int.instDivInt_1) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) a b) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) H b)) (HDiv.hDiv.{0, 0, 0} Int Int Int (instHDiv.{0} Int Int.instDivInt_1) a H))
-Case conversion may be inaccurate. Consider using '#align int.mul_div_mul_of_pos_left Int.mul_ediv_mul_of_pos_leftₓ'. -/
 @[simp]
 theorem mul_ediv_mul_of_pos_left (a : ℤ) {b : ℤ} (H : 0 < b) (c : ℤ) : a * b / (c * b) = a / c := by
   rw [mul_comm, mul_comm c, mul_div_mul_of_pos _ _ H]
 #align int.mul_div_mul_of_pos_left Int.mul_ediv_mul_of_pos_left
 
-/- warning: int.mul_mod_mul_of_pos -> Int.mul_emod_mul_of_pos is a dubious translation:
-lean 3 declaration is
-  forall {a : Int}, (LT.lt.{0} Int Int.hasLt (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))) a) -> (forall (b : Int) (c : Int), Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) a b) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) a c)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) a (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.hasMod) b c)))
-but is expected to have type
-  forall {a : Int} (H : Int) (b : Int), (LT.lt.{0} Int Int.instLTInt (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)) a) -> (Eq.{1} Int (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) a H) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) a b)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) a (HMod.hMod.{0, 0, 0} Int Int Int (instHMod.{0} Int Int.instModInt_1) H b)))
-Case conversion may be inaccurate. Consider using '#align int.mul_mod_mul_of_pos Int.mul_emod_mul_of_posₓ'. -/
 @[simp]
 theorem mul_emod_mul_of_pos {a : ℤ} (H : 0 < a) (b c : ℤ) : a * b % (a * c) = a * (b % c) := by
   rw [mod_def, mod_def, mul_div_mul_of_pos _ _ H, mul_sub_left_distrib, mul_assoc]
@@ -707,12 +689,6 @@ theorem div_mul_cancel_of_mod_eq_zero {a b : ℤ} (H : a % b = 0) : a / b * b =
   rw [mul_comm, mul_div_cancel_of_mod_eq_zero H]
 #align int.div_mul_cancel_of_mod_eq_zero Int.div_mul_cancel_of_mod_eq_zeroₓ
 
-/- warning: int.nat_abs_sign -> Int.natAbs_sign is a dubious translation:
-lean 3 declaration is
-  forall (z : Int), Eq.{1} Nat (Int.natAbs (Int.sign z)) (ite.{1} Nat (Eq.{1} Int z (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero)))) (Int.decidableEq z (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero)))) (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))
-but is expected to have type
-  forall (z : Int), Eq.{1} Nat (Int.natAbs (Int.sign z)) (ite.{1} Nat (Eq.{1} Int z (OfNat.ofNat.{0} Int 0 (instOfNatInt 0))) (Int.instDecidableEqInt z (OfNat.ofNat.{0} Int 0 (instOfNatInt 0))) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
-Case conversion may be inaccurate. Consider using '#align int.nat_abs_sign Int.natAbs_signₓ'. -/
 theorem natAbs_sign (z : ℤ) : z.sign.natAbs = if z = 0 then 0 else 1 := by
   rcases z with ((_ | _) | _) <;> rfl
 #align int.nat_abs_sign Int.natAbs_sign
@@ -737,12 +713,6 @@ theorem sign_neg (z : ℤ) : Int.sign (-z) = -Int.sign z := by rcases z with ((_
 #align int.sign_neg Int.sign_neg
 -/
 
-/- warning: int.div_sign -> Int.div_sign is a dubious translation:
-lean 3 declaration is
-  forall (a : Int) (b : Int), Eq.{1} Int (HDiv.hDiv.{0, 0, 0} Int Int Int (instHDiv.{0} Int Int.hasDiv) a (Int.sign b)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.hasMul) a (Int.sign b))
-but is expected to have type
-  forall (a : Int) (b : Int), Eq.{1} Int (Int.div a (Int.sign b)) (HMul.hMul.{0, 0, 0} Int Int Int (instHMul.{0} Int Int.instMulInt) a (Int.sign b))
-Case conversion may be inaccurate. Consider using '#align int.div_sign Int.div_signₓ'. -/
 theorem div_sign : ∀ a b, a / sign b = a * sign b
   | a, (n + 1 : ℕ) => by unfold SignType.sign <;> simp
   | a, 0 => by simp [SignType.sign]
@@ -792,12 +762,6 @@ theorem negSucc_add_negSucc (m n : ℕ) : -[m+1] + -[n+1] = -[Nat.succ (m + n)+1
 /-! ### to_nat -/
 
 
-/- warning: int.to_nat_eq_max -> Int.toNat_eq_max is a dubious translation:
-lean 3 declaration is
-  forall (a : Int), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (Int.toNat a)) (LinearOrder.max.{0} Int Int.linearOrder a (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))))
-but is expected to have type
-  forall (a : Int), Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (Int.toNat a)) (Max.max.{0} Int Int.instMaxInt a (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)))
-Case conversion may be inaccurate. Consider using '#align int.to_nat_eq_max Int.toNat_eq_maxₓ'. -/
 theorem toNat_eq_max : ∀ a : ℤ, (toNat a : ℤ) = max a 0
   | (n : ℕ) => (max_eq_left (ofNat_zero_le n)).symm
   | -[n+1] => (max_eq_right (le_of_lt (negSucc_lt_zero n))).symm
Diff
@@ -167,9 +167,7 @@ theorem mul_def {a b : ℤ} : Int.mul a b = a * b :=
 
 #print Int.negSucc_not_nonneg /-
 @[simp]
-theorem negSucc_not_nonneg (n : ℕ) : 0 ≤ -[n+1] ↔ False :=
-  by
-  simp only [not_le, iff_false_iff]
+theorem negSucc_not_nonneg (n : ℕ) : 0 ≤ -[n+1] ↔ False := by simp only [not_le, iff_false_iff];
   exact Int.negSucc_lt_zero n
 #align int.neg_succ_not_nonneg Int.negSucc_not_nonneg
 -/
@@ -340,11 +338,8 @@ theorem add_one_le_iff {a b : ℤ} : a + 1 ≤ b ↔ a < b :=
 
 #print Int.coe_pred_of_pos /-
 @[norm_cast]
-theorem coe_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 :=
-  by
-  cases n
-  cases h
-  simp
+theorem coe_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by cases n;
+  cases h; simp
 #align int.coe_pred_of_pos Int.coe_pred_of_pos
 -/
 
@@ -358,11 +353,9 @@ protected theorem induction_on {p : ℤ → Prop} (i : ℤ) (hz : p 0) (hp : ∀
     · exact hz
     · exact hp _ i_ih
   · have : ∀ n : ℕ, p (-n) := by
-      intro n
-      induction n
+      intro n; induction n
       · simp [hz]
-      · convert hn _ n_ih using 1
-        simp [sub_eq_neg_add]
+      · convert hn _ n_ih using 1; simp [sub_eq_neg_add]
     exact this (i + 1)
 #align int.induction_on Int.induction_on
 -/
@@ -400,10 +393,8 @@ theorem natAbs_add_le (a b : ℤ) : natAbs (a + b) ≤ natAbs a + natAbs b :=
 -/
 
 #print Int.natAbs_sub_le /-
-theorem natAbs_sub_le (a b : ℤ) : natAbs (a - b) ≤ natAbs a + natAbs b :=
-  by
-  rw [sub_eq_add_neg, ← Int.natAbs_neg b]
-  apply nat_abs_add_le
+theorem natAbs_sub_le (a b : ℤ) : natAbs (a - b) ≤ natAbs a + natAbs b := by
+  rw [sub_eq_add_neg, ← Int.natAbs_neg b]; apply nat_abs_add_le
 #align int.nat_abs_sub_le Int.natAbs_sub_le
 -/
 
@@ -471,8 +462,7 @@ theorem natAbs_eq_natAbs_iff {a b : ℤ} : a.natAbs = b.natAbs ↔ a = b ∨ a =
   ·
     cases' Int.natAbs_eq a with h₁ h₁ <;> cases' Int.natAbs_eq b with h₂ h₂ <;> rw [h₁, h₂] <;>
       simp [h]
-  · cases h <;> rw [h]
-    rw [Int.natAbs_neg]
+  · cases h <;> rw [h]; rw [Int.natAbs_neg]
 #align int.nat_abs_eq_nat_abs_iff Int.natAbs_eq_natAbs_iff
 -/
 
@@ -646,16 +636,10 @@ theorem div_add_mod (a b : ℤ) : b * (a / b) + a % b = a :=
   (add_comm _ _).trans (emod_add_ediv _ _)
 #align int.div_add_mod Int.div_add_modₓ
 
-theorem mod_add_div' (m k : ℤ) : m % k + m / k * k = m :=
-  by
-  rw [mul_comm]
-  exact mod_add_div _ _
+theorem mod_add_div' (m k : ℤ) : m % k + m / k * k = m := by rw [mul_comm]; exact mod_add_div _ _
 #align int.mod_add_div' Int.mod_add_div'ₓ
 
-theorem div_add_mod' (m k : ℤ) : m / k * k + m % k = m :=
-  by
-  rw [mul_comm]
-  exact div_add_mod _ _
+theorem div_add_mod' (m k : ℤ) : m / k * k + m % k = m := by rw [mul_comm]; exact div_add_mod _ _
 #align int.div_add_mod' Int.div_add_mod'ₓ
 
 theorem mod_def (a b : ℤ) : a % b = a - b * (a / b) :=
Diff
@@ -393,8 +393,8 @@ theorem natAbs_add_le (a b : ℤ) : natAbs (a + b) ≤ natAbs a + natAbs b :=
     · apply succ_le_succ
       rw [← succ.inj e, ← add_assoc, add_comm]
       apply Nat.le_add_right
-  cases a <;> cases' b with b b <;> simp [nat_abs, Nat.succ_add] <;> try rfl <;> [skip,
-      rw [add_comm a b]] <;>
+  cases a <;> cases' b with b b <;> simp [nat_abs, Nat.succ_add] <;> try rfl <;>
+      [skip;rw [add_comm a b]] <;>
     apply this
 #align int.nat_abs_add_le Int.natAbs_add_le
 -/
Diff
@@ -374,8 +374,10 @@ variable {a b : ℤ} {n : ℕ}
 
 attribute [simp] nat_abs_of_nat nat_abs_zero nat_abs_one
 
+#print Int.natAbs_surjective /-
 theorem natAbs_surjective : natAbs.Surjective := fun n => ⟨n, natAbs_ofNat n⟩
 #align int.nat_abs_surjective Int.natAbs_surjective
+-/
 
 #print Int.natAbs_add_le /-
 theorem natAbs_add_le (a b : ℤ) : natAbs (a + b) ≤ natAbs a + natAbs b :=
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 728baa2f54e6062c5879a3e397ac6bac323e506f
+! leanprover-community/mathlib commit 00d163e35035c3577c1c79fa53b68de17781ffc1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -374,6 +374,9 @@ variable {a b : ℤ} {n : ℕ}
 
 attribute [simp] nat_abs_of_nat nat_abs_zero nat_abs_one
 
+theorem natAbs_surjective : natAbs.Surjective := fun n => ⟨n, natAbs_ofNat n⟩
+#align int.nat_abs_surjective Int.natAbs_surjective
+
 #print Int.natAbs_add_le /-
 theorem natAbs_add_le (a b : ℤ) : natAbs (a + b) ≤ natAbs a + natAbs b :=
   by
Diff
@@ -111,15 +111,19 @@ theorem add_neg_one (i : ℤ) : i + -1 = i - 1 :=
 #align int.add_neg_one Int.add_neg_one
 -/
 
+#print Int.sign_coe_add_one /-
 @[simp]
 theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
   rfl
 #align int.sign_coe_add_one Int.sign_coe_add_one
+-/
 
+#print Int.sign_negSucc /-
 @[simp]
 theorem sign_negSucc (n : ℕ) : Int.sign -[n+1] = -1 :=
   rfl
 #align int.sign_neg_succ_of_nat Int.sign_negSucc
+-/
 
 #print Int.default_eq_zero /-
 @[simp]
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit 728baa2f54e6062c5879a3e397ac6bac323e506f
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -111,6 +111,16 @@ theorem add_neg_one (i : ℤ) : i + -1 = i - 1 :=
 #align int.add_neg_one Int.add_neg_one
 -/
 
+@[simp]
+theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
+  rfl
+#align int.sign_coe_add_one Int.sign_coe_add_one
+
+@[simp]
+theorem sign_negSucc (n : ℕ) : Int.sign -[n+1] = -1 :=
+  rfl
+#align int.sign_neg_succ_of_nat Int.sign_negSucc
+
 #print Int.default_eq_zero /-
 @[simp]
 theorem default_eq_zero : default = (0 : ℤ) :=
Diff
@@ -220,7 +220,7 @@ theorem coe_nat_inj' {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n :=
 lean 3 declaration is
   StrictMono.{0, 0} Nat Int (PartialOrder.toPreorder.{0} Nat (LinearOrder.toPartialOrder.{0} Nat Nat.linearOrder)) (PartialOrder.toPreorder.{0} Int (LinearOrder.toPartialOrder.{0} Int Int.linearOrder)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))))
 but is expected to have type
-  StrictMono.{0, 0} Nat Int (PartialOrder.toPreorder.{0} Nat (LinearOrder.toPartialOrder.{0} Nat Nat.linearOrder)) (PartialOrder.toPreorder.{0} Int (LinearOrder.toPartialOrder.{0} Int Int.instLinearOrderInt)) (fun (x._@.Mathlib.Data.Int.Basic._hyg.840 : Nat) => Nat.cast.{0} Int Int.instNatCastInt x._@.Mathlib.Data.Int.Basic._hyg.840)
+  StrictMono.{0, 0} Nat Int (PartialOrder.toPreorder.{0} Nat (LinearOrder.toPartialOrder.{0} Nat Nat.linearOrder)) (PartialOrder.toPreorder.{0} Int (LinearOrder.toPartialOrder.{0} Int Int.instLinearOrderInt)) (fun (x._@.Mathlib.Data.Int.Basic._hyg.840 : Nat) => Nat.cast.{0} Int instNatCastInt x._@.Mathlib.Data.Int.Basic._hyg.840)
 Case conversion may be inaccurate. Consider using '#align int.coe_nat_strict_mono Int.coe_nat_strictMonoₓ'. -/
 theorem coe_nat_strictMono : StrictMono (coe : ℕ → ℤ) := fun _ _ => Int.ofNat_lt.2
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
@@ -793,7 +793,7 @@ theorem negSucc_add_negSucc (m n : ℕ) : -[m+1] + -[n+1] = -[Nat.succ (m + n)+1
 lean 3 declaration is
   forall (a : Int), Eq.{1} Int ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) (Int.toNat a)) (LinearOrder.max.{0} Int Int.linearOrder a (OfNat.ofNat.{0} Int 0 (OfNat.mk.{0} Int 0 (Zero.zero.{0} Int Int.hasZero))))
 but is expected to have type
-  forall (a : Int), Eq.{1} Int (Nat.cast.{0} Int Int.instNatCastInt (Int.toNat a)) (Max.max.{0} Int Int.instMaxInt a (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)))
+  forall (a : Int), Eq.{1} Int (Nat.cast.{0} Int instNatCastInt (Int.toNat a)) (Max.max.{0} Int Int.instMaxInt a (OfNat.ofNat.{0} Int 0 (instOfNatInt 0)))
 Case conversion may be inaccurate. Consider using '#align int.to_nat_eq_max Int.toNat_eq_maxₓ'. -/
 theorem toNat_eq_max : ∀ a : ℤ, (toNat a : ℤ) = max a 0
   | (n : ℕ) => (max_eq_left (ofNat_zero_le n)).symm
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -291,7 +291,7 @@ theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a := by rw [neg_succ, succ_p
 
 #print Int.neg_pred /-
 theorem neg_pred (a : ℤ) : -pred a = succ (-a) := by
-  rw [eq_neg_of_eq_neg (neg_succ (-a)).symm, neg_neg]
+  rw [neg_eq_iff_eq_neg.mp (neg_succ (-a)), neg_neg]
 #align int.neg_pred Int.neg_pred
 -/
 
@@ -606,9 +606,8 @@ theorem emod_eq_of_lt {a b : ℤ} (H1 : 0 ≤ a) (H2 : a < b) : a % b = a :=
 
 theorem mod_add_div_aux (m n : ℕ) : (n - (m % n + 1) - (n * (m / n) + n) : ℤ) = -[m+1] :=
   by
-  rw [← sub_sub, neg_succ_of_nat_coe, sub_sub (n : ℤ)]
-  apply eq_neg_of_eq_neg
-  rw [neg_sub, sub_sub_self, add_right_comm]
+  rw [← sub_sub, neg_succ_of_nat_coe, sub_sub (n : ℤ), eq_comm, neg_eq_iff_eq_neg, neg_sub,
+    sub_sub_self, add_right_comm]
   exact @congr_arg ℕ ℤ _ _ (fun i => (i + 1 : ℤ)) (Nat.mod_add_div _ _).symm
 #align int.mod_add_div_aux Int.mod_add_div_aux
 
Diff
@@ -658,7 +658,7 @@ theorem mul_ediv_mul_of_pos {a : ℤ} (b c : ℤ) (H : 0 < a) : a * b / (a * c)
   fun m k b =>
   match b, k with
   | (n : ℕ), k => congr_arg ofNat (Nat.mul_div_mul _ _ m.succ_pos)
-  | -[n+1], 0 => by rw [Int.ofNat_zero, mul_zero, Int.div_zero, Int.div_zero]
+  | -[n+1], 0 => by rw [Int.ofNat_zero, MulZeroClass.mul_zero, Int.div_zero, Int.div_zero]
   | -[n+1], k + 1 =>
     congr_arg negSucc <|
       show (m.succ * n + m) / (m.succ * k.succ) = n / k.succ
@@ -762,7 +762,7 @@ theorem sign_mul : ∀ a b, sign (a * b) = sign a * sign b
 #print Int.mul_sign /-
 theorem mul_sign : ∀ i : ℤ, i * sign i = natAbs i
   | (n + 1 : ℕ) => mul_one _
-  | 0 => mul_zero _
+  | 0 => MulZeroClass.mul_zero _
   | -[n+1] => mul_neg_one _
 #align int.mul_sign Int.mul_sign
 -/

Changes in mathlib4

mathlib3
mathlib4
feat: Axiomatise b ≠ 0 → a * b / b = a (#12424)

This lets us unify a few lemmas between GroupWithZero and EuclideanDomain and two lemmas that were previously proved separately for Nat, Int, Polynomial.

Diff
@@ -39,6 +39,8 @@ instance instCommRing : CommRing ℤ where
   intCast_ofNat _ := rfl
   intCast_negSucc _ := rfl
 
+instance instMulDivCancelClass : MulDivCancelClass ℤ where mul_div_cancel _ _ := mul_ediv_cancel _
+
 @[simp, norm_cast]
 lemma cast_mul {α : Type*} [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fun m => by
   obtain ⟨m, rfl | rfl⟩ := Int.eq_nat_or_neg m
chore: Rename Int and Rat instances (#12235)

Fix a few names and deduplicate the AddCommGroup ℤ instance

Diff
@@ -20,9 +20,9 @@ See note [foundational algebra order theory].
 
 namespace Int
 
-instance instCommRingInt : CommRing ℤ where
+instance instCommRing : CommRing ℤ where
   __ := instAddCommGroup
-  __ := instCommSemigroupInt
+  __ := instCommSemigroup
   zero_mul := Int.zero_mul
   mul_zero := Int.mul_zero
   left_distrib := Int.mul_add
@@ -64,7 +64,7 @@ these instances non-computably.
 
 instance instCommSemiring : CommSemiring ℤ := inferInstance
 instance instSemiring     : Semiring ℤ     := inferInstance
-instance instRingInt      : Ring ℤ         := inferInstance
+instance instRing         : Ring ℤ         := inferInstance
 instance instDistrib      : Distrib ℤ      := inferInstance
 
 instance instCharZero : CharZero ℤ where
chore: Rename Int and Rat instances (#12235)

Fix a few names and deduplicate the AddCommGroup ℤ instance

Diff
@@ -24,7 +24,7 @@ namespace Int
 
 /-! ### Instances -/
 
-instance instCommMonoidInt : CommMonoid ℤ where
+instance instCommMonoid : CommMonoid ℤ where
   mul_comm := Int.mul_comm
   mul_one := Int.mul_one
   one_mul := Int.one_mul
@@ -58,15 +58,14 @@ These also prevent non-computable instances like `Int.normedCommRing` being used
 these instances non-computably.
 -/
 
-instance : AddCommMonoid ℤ    := by infer_instance
-instance : AddMonoid ℤ        := by infer_instance
-instance : Monoid ℤ           := by infer_instance
-instance : CommSemigroup ℤ    := by infer_instance
-instance : Semigroup ℤ        := by infer_instance
-instance : AddGroup ℤ         := by infer_instance
-instance : AddCommGroup ℤ     := by infer_instance
-instance : AddCommSemigroup ℤ := by infer_instance
-instance : AddSemigroup ℤ     := by infer_instance
+instance instAddCommMonoid    : AddCommMonoid ℤ    := by infer_instance
+instance instAddMonoid        : AddMonoid ℤ        := by infer_instance
+instance instMonoid           : Monoid ℤ           := by infer_instance
+instance instCommSemigroup    : CommSemigroup ℤ    := by infer_instance
+instance instSemigroup        : Semigroup ℤ        := by infer_instance
+instance instAddGroup         : AddGroup ℤ         := by infer_instance
+instance instAddCommSemigroup : AddCommSemigroup ℤ := by infer_instance
+instance instAddSemigroup     : AddSemigroup ℤ     := by infer_instance
 
 /-! ### Miscellaneous lemmas -/
 
chore: Rename isnatCast, delete Int.cast_Nat_cast (#12236)

Int.cast_Nat_cast dates back to the ad-hoc port, in #206.

Diff
@@ -70,12 +70,6 @@ instance instDistrib      : Distrib ℤ      := inferInstance
 instance instCharZero : CharZero ℤ where
   cast_injective _ _ := ofNat.inj
 
-/-! ### Miscellaneous lemmas -/
-
-lemma cast_Nat_cast {n : ℕ} {R : Type*} [AddGroupWithOne R] :
-    (Int.cast (Nat.cast n) : R) = Nat.cast n :=
-  Int.cast_natCast _
-
 end Int
 
 assert_not_exists Set.range
chore(Algebra/Ring/Int): add CharZero instance for Int (#12060)

This adds a shortcut instance CharZero ℤ in the file Algebra.Ring.Int (which contains a few other shortcut instances for already). The hope is that this will result in a speed-up.

Note: This requires adding import Mathlib.Algebra.CharZero.Defs.

See here on Zulip.

There is a positive effect (-22.5 s) on type class inference, but no significant change overall. Still, I think it makes sense to have it.

Diff
@@ -3,6 +3,7 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
+import Mathlib.Algebra.CharZero.Defs
 import Mathlib.Algebra.Group.Int
 import Mathlib.Algebra.Ring.Defs
 import Mathlib.Data.Int.Cast.Basic
@@ -61,10 +62,13 @@ These also prevent non-computable instances like `Int.normedCommRing` being used
 these instances non-computably.
 -/
 
-instance instCommSemiring : CommSemiring ℤ := by infer_instance
-instance instSemiring     : Semiring ℤ     := by infer_instance
-instance instRingInt      : Ring ℤ         := by infer_instance
-instance instDistrib      : Distrib ℤ      := by infer_instance
+instance instCommSemiring : CommSemiring ℤ := inferInstance
+instance instSemiring     : Semiring ℤ     := inferInstance
+instance instRingInt      : Ring ℤ         := inferInstance
+instance instDistrib      : Distrib ℤ      := inferInstance
+
+instance instCharZero : CharZero ℤ where
+  cast_injective _ _ := ofNat.inj
 
 /-! ### Miscellaneous lemmas -/
 
chore: Split Data.{Nat,Int}{.Order}.Basic in group vs ring instances (#11924)

Scatter the content of Data.Nat.Basic across:

  • Data.Nat.Defs for the lemmas having no dependencies
  • Algebra.Group.Nat for the monoid instances and the few miscellaneous lemmas needing them.
  • Algebra.Ring.Nat for the semiring instance and the few miscellaneous lemmas following it.

Similarly, scatter

  • Data.Int.Basic across Data.Int.Defs, Algebra.Group.Int, Algebra.Ring.Int
  • Data.Nat.Order.Basic across Data.Nat.Defs, Algebra.Order.Group.Nat, Algebra.Order.Ring.Nat
  • Data.Int.Order.Basic across Data.Int.Defs, Algebra.Order.Group.Int, Algebra.Order.Ring.Int

Also move a few lemmas from Data.Nat.Order.Lemmas to Data.Nat.Defs.

Before pre_11924

After post_11924

chore: Split Data.{Nat,Int}{.Order}.Basic in group vs ring instances (#11924)

Scatter the content of Data.Nat.Basic across:

  • Data.Nat.Defs for the lemmas having no dependencies
  • Algebra.Group.Nat for the monoid instances and the few miscellaneous lemmas needing them.
  • Algebra.Ring.Nat for the semiring instance and the few miscellaneous lemmas following it.

Similarly, scatter

  • Data.Int.Basic across Data.Int.Defs, Algebra.Group.Int, Algebra.Ring.Int
  • Data.Nat.Order.Basic across Data.Nat.Defs, Algebra.Order.Group.Nat, Algebra.Order.Ring.Nat
  • Data.Int.Order.Basic across Data.Int.Defs, Algebra.Order.Group.Int, Algebra.Order.Ring.Int

Also move a few lemmas from Data.Nat.Order.Lemmas to Data.Nat.Defs.

Before pre_11924

After post_11924

Diff
@@ -4,34 +4,36 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
 import Mathlib.Algebra.Group.TypeTags
-import Mathlib.Algebra.Ring.Defs
-import Mathlib.Data.Int.Cast.Basic
 import Mathlib.Order.Monotone.Basic
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
 
 /-!
-# Basic algebraic instances on the integers
+# The integers form a group
 
-This file contains instances on `ℤ`. The stronger one is `Int.linearOrderedCommRing`.
+This file contains the additive group and multiplicative monoid instances on the integers.
+
+See note [foundational algebra order theory].
 -/
 
+assert_not_exists Ring
+
 open Nat
 
 namespace Int
 
-instance instCommRingInt : CommRing ℤ where
-  zero_mul := Int.zero_mul
-  mul_zero := Int.mul_zero
+/-! ### Instances -/
+
+instance instCommMonoidInt : CommMonoid ℤ where
   mul_comm := Int.mul_comm
-  left_distrib := Int.mul_add
-  right_distrib := Int.add_mul
   mul_one := Int.mul_one
   one_mul := Int.one_mul
   npow n x := x ^ n
   npow_zero _ := rfl
-  npow_succ n x := rfl
+  npow_succ _ _ := rfl
   mul_assoc := Int.mul_assoc
+
+instance instAddCommGroup : AddCommGroup ℤ where
   add_comm := Int.add_comm
   add_assoc := Int.add_assoc
   add_zero := Int.add_zero
@@ -48,54 +50,27 @@ instance instCommRingInt : CommRing ℤ where
     simp only [ofNat_eq_coe, ofNat_succ, Int.add_mul, Int.add_comm, Int.one_mul]
   zsmul_neg' m n := by simp only [negSucc_coe, ofNat_succ, Int.neg_mul]
   sub_eq_add_neg _ _ := Int.sub_eq_add_neg
-  natCast := (·)
-  natCast_zero := rfl
-  natCast_succ _ := rfl
-  intCast := (·)
-  intCast_ofNat _ := rfl
-  intCast_negSucc _ := rfl
-
-@[simp, norm_cast] lemma cast_id {n : ℤ} : Int.cast n = n := rfl
-
-@[simp, norm_cast]
-theorem cast_mul {α : Type*} [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fun m => by
-  obtain ⟨m, rfl | rfl⟩ := Int.eq_nat_or_neg m
-  · induction m with
-    | zero => simp
-    | succ m ih => simp_all [add_mul]
-  · induction m with
-    | zero => simp
-    | succ m ih => simp_all [add_mul]
-#align int.cast_mul Int.cast_mulₓ -- dubious translation, type involves HasLiftT
-
-lemma cast_Nat_cast {n : ℕ} {R : Type*} [AddGroupWithOne R] :
-    (Int.cast (Nat.cast n) : R) = Nat.cast n :=
-  Int.cast_natCast _
 
-@[simp, norm_cast] lemma cast_pow {R : Type*} [Ring R] (n : ℤ) (m : ℕ) :
-    ↑(n ^ m) = (n ^ m : R) := by
-  induction' m with m ih <;> simp [_root_.pow_succ, *]
-#align int.cast_pow Int.cast_pow
-
-/-! ### Extra instances to short-circuit type class resolution
+/-!
+### Extra instances to short-circuit type class resolution
 
 These also prevent non-computable instances like `Int.normedCommRing` being used to construct
 these instances non-computably.
 -/
+
 instance : AddCommMonoid ℤ    := by infer_instance
 instance : AddMonoid ℤ        := by infer_instance
 instance : Monoid ℤ           := by infer_instance
-instance : CommMonoid ℤ       := by infer_instance
 instance : CommSemigroup ℤ    := by infer_instance
 instance : Semigroup ℤ        := by infer_instance
-instance : AddCommGroup ℤ     := by infer_instance
 instance : AddGroup ℤ         := by infer_instance
+instance : AddCommGroup ℤ     := by infer_instance
 instance : AddCommSemigroup ℤ := by infer_instance
 instance : AddSemigroup ℤ     := by infer_instance
-instance : CommSemiring ℤ     := by infer_instance
-instance : Semiring ℤ         := by infer_instance
-instance instRingInt : Ring ℤ             := by infer_instance
-instance : Distrib ℤ          := by infer_instance
+
+/-! ### Miscellaneous lemmas -/
+
+@[simp, norm_cast] lemma cast_id {n : ℤ} : Int.cast n = n := rfl
 
 lemma natAbs_pow (n : ℤ) (k : ℕ) : Int.natAbs (n ^ k) = Int.natAbs n ^ k := by
   induction' k with k ih
@@ -131,3 +106,4 @@ lemma zsmul_int_one (n : ℤ) : n • (1 : ℤ) = n := mul_one _
 #align zsmul_int_one zsmul_int_one
 
 assert_not_exists Set.range
+assert_not_exists Ring
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -70,7 +70,7 @@ theorem cast_mul {α : Type*} [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α)
 
 lemma cast_Nat_cast {n : ℕ} {R : Type*} [AddGroupWithOne R] :
     (Int.cast (Nat.cast n) : R) = Nat.cast n :=
-  Int.cast_ofNat _
+  Int.cast_natCast _
 
 @[simp, norm_cast] lemma cast_pow {R : Type*} [Ring R] (n : ℤ) (m : ℕ) :
     ↑(n ^ m) = (n ^ m : R) := by
change the order of operation in zsmulRec and nsmulRec (#11451)

We change the following field in the definition of an additive commutative monoid:

 nsmul_succ : ∀ (n : ℕ) (x : G),
-  AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+  AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x

where the latter is more natural

We adjust the definitions of ^ in monoids, groups, etc. Originally there was a warning comment about why this natural order was preferred

use x * npowRec n x and not npowRec n x * x in the definition to make sure that definitional unfolding of npowRec is blocked, to avoid deep recursion issues.

but it seems to no longer apply.

Remarks on the PR :

  • pow_succ and pow_succ' have switched their meanings.
  • Most of the time, the proofs were adjusted by priming/unpriming one lemma, or exchanging left and right; a few proofs were more complicated to adjust.
  • In particular, [Mathlib/NumberTheory/RamificationInertia.lean] used Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.
  • the docstring for Cauchy condensation test in [Mathlib/Analysis/PSeries.lean] was mathematically incorrect, I added the mention that the function is antitone.
Diff
@@ -30,7 +30,7 @@ instance instCommRingInt : CommRing ℤ where
   one_mul := Int.one_mul
   npow n x := x ^ n
   npow_zero _ := rfl
-  npow_succ _ _ := by rw [Int.mul_comm]; rfl
+  npow_succ n x := rfl
   mul_assoc := Int.mul_assoc
   add_comm := Int.add_comm
   add_assoc := Int.add_assoc
@@ -40,8 +40,8 @@ instance instCommRingInt : CommRing ℤ where
   nsmul := (·*·)
   nsmul_zero := Int.zero_mul
   nsmul_succ n x :=
-    show (n + 1 : ℤ) * x = x + n * x
-    by rw [Int.add_mul, Int.add_comm, Int.one_mul]
+    show (n + 1 : ℤ) * x = n * x + x
+    by rw [Int.add_mul, Int.one_mul]
   zsmul := (·*·)
   zsmul_zero' := Int.zero_mul
   zsmul_succ' m n := by
chore: remove more autoImplicit (#11336)

... or reduce its scope (the full removal is not as obvious).

Diff
@@ -16,8 +16,6 @@ import Mathlib.Order.Monotone.Basic
 This file contains instances on `ℤ`. The stronger one is `Int.linearOrderedCommRing`.
 -/
 
-set_option autoImplicit true
-
 open Nat
 
 namespace Int
@@ -57,10 +55,10 @@ instance instCommRingInt : CommRing ℤ where
   intCast_ofNat _ := rfl
   intCast_negSucc _ := rfl
 
-@[simp, norm_cast] lemma cast_id : Int.cast n = n := rfl
+@[simp, norm_cast] lemma cast_id {n : ℤ} : Int.cast n = n := rfl
 
 @[simp, norm_cast]
-theorem cast_mul [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fun m => by
+theorem cast_mul {α : Type*} [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fun m => by
   obtain ⟨m, rfl | rfl⟩ := Int.eq_nat_or_neg m
   · induction m with
     | zero => simp
@@ -70,10 +68,12 @@ theorem cast_mul [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fu
     | succ m ih => simp_all [add_mul]
 #align int.cast_mul Int.cast_mulₓ -- dubious translation, type involves HasLiftT
 
-lemma cast_Nat_cast [AddGroupWithOne R] : (Int.cast (Nat.cast n) : R) = Nat.cast n :=
+lemma cast_Nat_cast {n : ℕ} {R : Type*} [AddGroupWithOne R] :
+    (Int.cast (Nat.cast n) : R) = Nat.cast n :=
   Int.cast_ofNat _
 
-@[simp, norm_cast] lemma cast_pow [Ring R] (n : ℤ) (m : ℕ) : ↑(n ^ m) = (n ^ m : R) := by
+@[simp, norm_cast] lemma cast_pow {R : Type*} [Ring R] (n : ℤ) (m : ℕ) :
+    ↑(n ^ m) = (n ^ m : R) := by
   induction' m with m ih <;> simp [_root_.pow_succ, *]
 #align int.cast_pow Int.cast_pow
 
chore: Move Int and Nat cast lemmas (#9503)

Part of #9411

Diff
@@ -3,19 +3,17 @@ Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 -/
-import Mathlib.Init.Data.Int.Order
+import Mathlib.Algebra.Group.TypeTags
+import Mathlib.Algebra.Ring.Defs
 import Mathlib.Data.Int.Cast.Basic
-import Mathlib.Algebra.Ring.Basic
 import Mathlib.Order.Monotone.Basic
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
 
 /-!
-# Basic operations on the integers
+# Basic algebraic instances on the integers
 
-This file contains:
-* instances on `ℤ`. The stronger one is `Int.linearOrderedCommRing`.
-* some basic lemmas about integers
+This file contains instances on `ℤ`. The stronger one is `Int.linearOrderedCommRing`.
 -/
 
 set_option autoImplicit true
@@ -75,6 +73,10 @@ theorem cast_mul [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fu
 lemma cast_Nat_cast [AddGroupWithOne R] : (Int.cast (Nat.cast n) : R) = Nat.cast n :=
   Int.cast_ofNat _
 
+@[simp, norm_cast] lemma cast_pow [Ring R] (n : ℤ) (m : ℕ) : ↑(n ^ m) = (n ^ m : R) := by
+  induction' m with m ih <;> simp [_root_.pow_succ, *]
+#align int.cast_pow Int.cast_pow
+
 /-! ### Extra instances to short-circuit type class resolution
 
 These also prevent non-computable instances like `Int.normedCommRing` being used to construct
@@ -95,5 +97,37 @@ instance : Semiring ℤ         := by infer_instance
 instance instRingInt : Ring ℤ             := by infer_instance
 instance : Distrib ℤ          := by infer_instance
 
+lemma natAbs_pow (n : ℤ) (k : ℕ) : Int.natAbs (n ^ k) = Int.natAbs n ^ k := by
+  induction' k with k ih
+  · rfl
+  · rw [_root_.pow_succ, natAbs_mul, Nat.pow_succ, ih, Nat.mul_comm]
+#align int.nat_abs_pow Int.natAbs_pow
+
 theorem coe_nat_strictMono : StrictMono (· : ℕ → ℤ) := fun _ _ ↦ Int.ofNat_lt.2
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
+
+section Multiplicative
+
+open Multiplicative
+
+lemma toAdd_pow (a : Multiplicative ℤ) (b : ℕ) : toAdd (a ^ b) = toAdd a * b := mul_comm _ _
+#align int.to_add_pow Int.toAdd_pow
+
+lemma toAdd_zpow (a : Multiplicative ℤ) (b : ℤ) : toAdd (a ^ b) = toAdd a * b := mul_comm _ _
+#align int.to_add_zpow Int.toAdd_zpow
+
+@[simp] lemma ofAdd_mul (a b : ℤ) : ofAdd (a * b) = ofAdd a ^ b := (toAdd_zpow ..).symm
+#align int.of_add_mul Int.ofAdd_mul
+
+end Multiplicative
+
+end Int
+
+-- TODO: Do we really need this lemma? This is just `smul_eq_mul`
+lemma zsmul_int_int (a b : ℤ) : a • b = a * b := rfl
+#align zsmul_int_int zsmul_int_int
+
+lemma zsmul_int_one (n : ℤ) : n • (1 : ℤ) = n := mul_one _
+#align zsmul_int_one zsmul_int_one
+
+assert_not_exists Set.range
refactor: Split off basic Int file (#9443)

Data.Int.Basic is currently made of two things:

  • Basic lemmas that continue the theory in Std (and could belong there, really)
  • Basic algebraic order instances

I need the first ones earlier in the algebraic order hierarchy, hence the split.

Part of #9411

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -24,8 +24,6 @@ open Nat
 
 namespace Int
 
-instance instNontrivialInt : Nontrivial ℤ := ⟨⟨0, 1, Int.zero_ne_one⟩⟩
-
 instance instCommRingInt : CommRing ℤ where
   zero_mul := Int.zero_mul
   mul_zero := Int.mul_zero
@@ -74,20 +72,9 @@ theorem cast_mul [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fu
     | succ m ih => simp_all [add_mul]
 #align int.cast_mul Int.cast_mulₓ -- dubious translation, type involves HasLiftT
 
-@[simp] lemma ofNat_eq_cast : Int.ofNat n = n := rfl
-
 lemma cast_Nat_cast [AddGroupWithOne R] : (Int.cast (Nat.cast n) : R) = Nat.cast n :=
   Int.cast_ofNat _
 
-@[norm_cast]
-lemma cast_eq_cast_iff_Nat (m n : ℕ) : (m : ℤ) = (n : ℤ) ↔ m = n := ofNat_inj
-
-@[simp, norm_cast]
-lemma natAbs_cast (n : ℕ) : natAbs ↑n = n := rfl
-
-@[norm_cast]
-protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m - ↑n := ofNat_sub
-
 /-! ### Extra instances to short-circuit type class resolution
 
 These also prevent non-computable instances like `Int.normedCommRing` being used to construct
@@ -108,203 +95,5 @@ instance : Semiring ℤ         := by infer_instance
 instance instRingInt : Ring ℤ             := by infer_instance
 instance : Distrib ℤ          := by infer_instance
 
-#align int.neg_succ_not_nonneg Int.negSucc_not_nonneg
-#align int.neg_succ_not_pos Int.negSucc_not_pos
-#align int.neg_succ_sub_one Int.negSucc_sub_one
-#align int.coe_nat_mul_neg_succ Int.ofNat_mul_negSucc
-#align int.neg_succ_mul_coe_nat Int.negSucc_mul_ofNat
-#align int.neg_succ_mul_neg_succ Int.negSucc_mul_negSucc
-
-#align int.coe_nat_le Int.ofNat_le
-#align int.coe_nat_lt Int.ofNat_lt
-
-theorem coe_nat_inj' {m n : ℕ} : (↑m : ℤ) = ↑n ↔ m = n := Int.ofNat_inj
-#align int.coe_nat_inj' Int.coe_nat_inj'
-
 theorem coe_nat_strictMono : StrictMono (· : ℕ → ℤ) := fun _ _ ↦ Int.ofNat_lt.2
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
-
-theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := ofNat_le.2 (Nat.zero_le _)
-#align int.coe_nat_nonneg Int.coe_nat_nonneg
-
-#align int.neg_of_nat_ne_zero Int.negSucc_ne_zero
-#align int.zero_ne_neg_of_nat Int.zero_ne_negSucc
-
-@[simp]
-theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
-  rfl
-#align int.sign_coe_add_one Int.sign_coe_add_one
-
-#align int.sign_neg_succ_of_nat Int.sign_negSucc
-
-/-! ### succ and pred -/
-
-/-- Immediate successor of an integer: `succ n = n + 1` -/
-def succ (a : ℤ) := a + 1
-#align int.succ Int.succ
-
-/-- Immediate predecessor of an integer: `pred n = n - 1` -/
-def pred (a : ℤ) := a - 1
-#align int.pred Int.pred
-
-theorem nat_succ_eq_int_succ (n : ℕ) : (Nat.succ n : ℤ) = Int.succ n := rfl
-#align int.nat_succ_eq_int_succ Int.nat_succ_eq_int_succ
-
-theorem pred_succ (a : ℤ) : pred (succ a) = a := add_sub_cancel _ _
-#align int.pred_succ Int.pred_succ
-
-theorem succ_pred (a : ℤ) : succ (pred a) = a := sub_add_cancel _ _
-#align int.succ_pred Int.succ_pred
-
-theorem neg_succ (a : ℤ) : -succ a = pred (-a) := neg_add _ _
-#align int.neg_succ Int.neg_succ
-
-theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a := by rw [neg_succ, succ_pred]
-#align int.succ_neg_succ Int.succ_neg_succ
-
-theorem neg_pred (a : ℤ) : -pred a = succ (-a) := by
-  rw [neg_eq_iff_eq_neg.mp (neg_succ (-a)), neg_neg]
-#align int.neg_pred Int.neg_pred
-
-theorem pred_neg_pred (a : ℤ) : pred (-pred a) = -a := by rw [neg_pred, pred_succ]
-#align int.pred_neg_pred Int.pred_neg_pred
-
-theorem pred_nat_succ (n : ℕ) : pred (Nat.succ n) = n := pred_succ n
-#align int.pred_nat_succ Int.pred_nat_succ
-
-theorem neg_nat_succ (n : ℕ) : -(Nat.succ n : ℤ) = pred (-n) := neg_succ n
-#align int.neg_nat_succ Int.neg_nat_succ
-
-theorem succ_neg_nat_succ (n : ℕ) : succ (-Nat.succ n) = -n := succ_neg_succ n
-#align int.succ_neg_nat_succ Int.succ_neg_nat_succ
-
-@[norm_cast] theorem coe_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by
-  cases n; cases h; simp
-#align int.coe_pred_of_pos Int.coe_pred_of_pos
-
-@[elab_as_elim] protected theorem induction_on {p : ℤ → Prop} (i : ℤ)
-    (hz : p 0) (hp : ∀ i : ℕ, p i → p (i + 1)) (hn : ∀ i : ℕ, p (-i) → p (-i - 1)) : p i := by
-  induction i with
-  | ofNat i =>
-    induction i with
-    | zero => exact hz
-    | succ i ih => exact hp _ ih
-  | negSucc i =>
-    suffices ∀ n : ℕ, p (-n) from this (i + 1)
-    intro n; induction n with
-    | zero => simp [hz, Nat.cast_zero]
-    | succ n ih => convert hn _ ih using 1; simp [sub_eq_neg_add]
-#align int.induction_on Int.induction_on
-
-/-! ### nat abs -/
-
-theorem natAbs_surjective : natAbs.Surjective := fun n => ⟨n, natAbs_ofNat n⟩
-#align int.nat_abs_surjective Int.natAbs_surjective
-
-#align int.nat_abs_add_le Int.natAbs_add_le
-#align int.nat_abs_sub_le Int.natAbs_sub_le
-#align int.nat_abs_neg_of_nat Int.natAbs_negOfNat
-#align int.nat_abs_mul Int.natAbs_mul
-#align int.nat_abs_mul_nat_abs_eq Int.natAbs_mul_natAbs_eq
-#align int.nat_abs_mul_self' Int.natAbs_mul_self'
-#align int.neg_succ_of_nat_eq' Int.negSucc_eq'
-
-@[deprecated natAbs_ne_zero]
-theorem natAbs_ne_zero_of_ne_zero : ∀ {a : ℤ}, a ≠ 0 → natAbs a ≠ 0 := natAbs_ne_zero.2
-#align int.nat_abs_ne_zero_of_ne_zero Int.natAbs_ne_zero_of_ne_zero
-
-#align int.nat_abs_eq_zero Int.natAbs_eq_zero
-#align int.nat_abs_ne_zero Int.natAbs_ne_zero
-#align int.nat_abs_lt_nat_abs_of_nonneg_of_lt Int.natAbs_lt_natAbs_of_nonneg_of_lt
-#align int.nat_abs_eq_nat_abs_iff Int.natAbs_eq_natAbs_iff
-#align int.nat_abs_eq_iff Int.natAbs_eq_iff
-
-/-! ### `/`  -/
-
--- Porting note: Many of the theorems in this section are dubious alignments because the default
--- division on `Int` has changed from the E-rounding convention to the T-rounding convention
--- (see `Int.ediv`). We have attempted to align the theorems to continue to use the `/` symbol
--- where possible, but some theorems fail to hold on T-rounding division and have been aligned to
--- `Int.ediv` instead.
-
-#align int.of_nat_div Int.ofNat_div
-
-@[simp, norm_cast] theorem coe_nat_div (m n : ℕ) : ((m / n : ℕ) : ℤ) = m / n := rfl
-#align int.coe_nat_div Int.coe_nat_div
-
-theorem coe_nat_ediv (m n : ℕ) : ((m / n : ℕ) : ℤ) = ediv m n := rfl
-
-#align int.neg_succ_of_nat_div Int.negSucc_ediv
-
-#align int.div_neg Int.div_negₓ -- int div alignment
-
-theorem ediv_of_neg_of_pos {a b : ℤ} (Ha : a < 0) (Hb : 0 < b) : ediv a b = -((-a - 1) / b + 1) :=
-  match a, b, eq_negSucc_of_lt_zero Ha, eq_succ_of_zero_lt Hb with
-  | _, _, ⟨m, rfl⟩, ⟨n, rfl⟩ => by
-    rw [show (- -[m+1] : ℤ) = (m + 1 : ℤ) by rfl]; rw [add_sub_cancel]; rfl
-#align int.div_of_neg_of_pos Int.ediv_of_neg_of_pos
-
-#align int.div_nonneg Int.div_nonnegₓ -- int div alignment
-#align int.div_neg' Int.ediv_neg'
-#align int.div_one Int.div_oneₓ -- int div alignment
-#align int.div_eq_zero_of_lt Int.div_eq_zero_of_ltₓ -- int div alignment
-
-/-! ### mod -/
-
-#align int.of_nat_mod Int.ofNat_mod_ofNat
-
-@[simp, norm_cast] theorem coe_nat_mod (m n : ℕ) : (↑(m % n) : ℤ) = ↑m % ↑n := rfl
-#align int.coe_nat_mod Int.coe_nat_mod
-
-#align int.neg_succ_of_nat_mod Int.negSucc_emod
-#align int.mod_neg Int.mod_negₓ -- int div alignment
-#align int.zero_mod Int.zero_modₓ -- int div alignment
-#align int.mod_zero Int.mod_zeroₓ -- int div alignment
-#align int.mod_one Int.mod_oneₓ -- int div alignment
-#align int.mod_eq_of_lt Int.emod_eq_of_lt -- int div alignment
-#align int.mod_add_div Int.emod_add_ediv -- int div alignment
-#align int.div_add_mod Int.div_add_modₓ -- int div alignment
-#align int.mod_add_div' Int.mod_add_div'ₓ -- int div alignment
-#align int.div_add_mod' Int.div_add_mod'ₓ -- int div alignment
-#align int.mod_def Int.mod_defₓ -- int div alignment
-
-/-! ### properties of `/` and `%` -/
-
-#align int.mul_div_mul_of_pos Int.mul_ediv_mul_of_pos
-#align int.mul_div_mul_of_pos_left Int.mul_ediv_mul_of_pos_left
-#align int.mul_mod_mul_of_pos Int.mul_emod_mul_of_pos
-#align int.mul_div_cancel_of_mod_eq_zero Int.mul_div_cancel_of_mod_eq_zeroₓ -- int div alignment
-#align int.div_mul_cancel_of_mod_eq_zero Int.div_mul_cancel_of_mod_eq_zeroₓ -- int div alignment
-
-#align int.nat_abs_sign Int.natAbs_sign
-#align int.nat_abs_sign_of_nonzero Int.natAbs_sign_of_nonzero
-
-theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 := sign_ofNat_of_nonzero hn
-#align int.sign_coe_nat_of_nonzero Int.sign_coe_nat_of_nonzero
-
-#align int.div_sign Int.div_sign -- int div alignment
-#align int.of_nat_add_neg_succ_of_nat_of_lt Int.ofNat_add_negSucc_of_lt
-#align int.neg_add_neg Int.negSucc_add_negSucc
-
-/-! ### toNat -/
-
-#align int.to_nat_eq_max Int.toNat_eq_max
-#align int.to_nat_zero Int.toNat_zero
-#align int.to_nat_one Int.toNat_one
-#align int.to_nat_of_nonneg Int.toNat_of_nonneg
-
-@[simp] theorem toNat_coe_nat (n : ℕ) : toNat ↑n = n := rfl
-#align int.to_nat_coe_nat Int.toNat_coe_nat
-
-@[simp] theorem toNat_coe_nat_add_one {n : ℕ} : ((n : ℤ) + 1).toNat = n + 1 := rfl
-#align int.to_nat_coe_nat_add_one Int.toNat_coe_nat_add_one
-
-#align int.le_to_nat Int.self_le_toNat
-#align int.le_to_nat_iff Int.le_toNat
-#align int.to_nat_add Int.toNat_add
-#align int.to_nat_add_nat Int.toNat_add_nat
-#align int.pred_to_nat Int.pred_toNat
-#align int.to_nat_sub_to_nat_neg Int.toNat_sub_toNat_neg
-#align int.to_nat_add_to_nat_neg_eq_nat_abs Int.toNat_add_toNat_neg_eq_natAbs
-#align int.mem_to_nat' Int.mem_toNat'
-#align int.to_nat_neg_nat Int.toNat_neg_nat
chore: Move Commute results earlier (#9440)

These lemmas aren't really proved any faster using units, and I will soon need them not to be proved using units.

Part of #9411

Diff
@@ -88,11 +88,6 @@ lemma natAbs_cast (n : ℕ) : natAbs ↑n = n := rfl
 @[norm_cast]
 protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m - ↑n := ofNat_sub
 
-@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
-theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n :=
-  zpow_ofNat ..
-#align coe_nat_zsmul coe_nat_zsmul
-
 /-! ### Extra instances to short-circuit type class resolution
 
 These also prevent non-computable instances like `Int.normedCommRing` being used to construct
chore: bump std to 604b407, catching up to leanprover/std4#361 (#8959)

Co-authored-by: Tobias Grosser <tobias@grosser.es> Co-authored-by: James <jamesgallicchio@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Siddharth Bhat <siddu.druid@gmail.com>

Diff
@@ -140,9 +140,6 @@ theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
   rfl
 #align int.sign_coe_add_one Int.sign_coe_add_one
 
-@[simp]
-theorem sign_negSucc (n : ℕ) : Int.sign -[n+1] = -1 :=
-  rfl
 #align int.sign_neg_succ_of_nat Int.sign_negSucc
 
 /-! ### succ and pred -/
chore: further refactors of prerequisites of norm_num (#7097)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -63,6 +63,17 @@ instance instCommRingInt : CommRing ℤ where
 
 @[simp, norm_cast] lemma cast_id : Int.cast n = n := rfl
 
+@[simp, norm_cast]
+theorem cast_mul [NonAssocRing α] : ∀ m n, ((m * n : ℤ) : α) = m * n := fun m => by
+  obtain ⟨m, rfl | rfl⟩ := Int.eq_nat_or_neg m
+  · induction m with
+    | zero => simp
+    | succ m ih => simp_all [add_mul]
+  · induction m with
+    | zero => simp
+    | succ m ih => simp_all [add_mul]
+#align int.cast_mul Int.cast_mulₓ -- dubious translation, type involves HasLiftT
+
 @[simp] lemma ofNat_eq_cast : Int.ofNat n = n := rfl
 
 lemma cast_Nat_cast [AddGroupWithOne R] : (Int.cast (Nat.cast n) : R) = Nat.cast n :=
feat: split Logic.Nontrivial (#6959)

This continues reducing the import requirements for the basic algebraic hierarchy.

In combination with #6954 #6955 #6956 #6957, this reduces the imports for Mathlib.Algebra.Field.Defs from

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -7,7 +7,6 @@ import Mathlib.Init.Data.Int.Order
 import Mathlib.Data.Int.Cast.Basic
 import Mathlib.Algebra.Ring.Basic
 import Mathlib.Order.Monotone.Basic
-import Mathlib.Logic.Nontrivial
 
 #align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
 
fix: disable autoImplicit globally (#6528)

Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.

The intent of this PR is to make autoImplicit opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true in the few files that rely on it.

That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.

I claim that many of the uses of autoImplicit in these files are accidental; situations such as:

  • Assuming variables are in scope, but pasting the lemma in the wrong section
  • Pasting in a lemma from a scratch file without checking to see if the variable names are consistent with the rest of the file
  • Making a copy-paste error between lemmas and forgetting to add an explicit arguments.

Having set_option autoImplicit false as the default prevents these types of mistake being made in the 90% of files where autoImplicits are not used at all, and causes them to be caught by CI during review.

I think there were various points during the port where we encouraged porters to delete the universes u v lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.

A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18 as the no:dontcare:yes vote ratio.

While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true has been placed locally within a section, rather than at the top of the file.

Diff
@@ -19,6 +19,8 @@ This file contains:
 * some basic lemmas about integers
 -/
 
+set_option autoImplicit true
+
 open Nat
 
 namespace Int
chore: ensure all instances referred to directly have explicit names (#6423)

Per https://github.com/leanprover/lean4/issues/2343, we are going to need to change the automatic generation of instance names, as they become too long.

This PR ensures that everywhere in Mathlib that refers to an instance by name, that name is given explicitly, rather than being automatically generated.

There are four exceptions, which are now commented, with links to https://github.com/leanprover/lean4/issues/2343.

This was implemented by running Mathlib against a modified Lean that appended _ᾰ to all automatically generated names, and fixing everything.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -23,9 +23,9 @@ open Nat
 
 namespace Int
 
-instance : Nontrivial ℤ := ⟨⟨0, 1, Int.zero_ne_one⟩⟩
+instance instNontrivialInt : Nontrivial ℤ := ⟨⟨0, 1, Int.zero_ne_one⟩⟩
 
-instance : CommRing ℤ where
+instance instCommRingInt : CommRing ℤ where
   zero_mul := Int.zero_mul
   mul_zero := Int.mul_zero
   mul_comm := Int.mul_comm
@@ -98,7 +98,7 @@ instance : AddCommSemigroup ℤ := by infer_instance
 instance : AddSemigroup ℤ     := by infer_instance
 instance : CommSemiring ℤ     := by infer_instance
 instance : Semiring ℤ         := by infer_instance
-instance : Ring ℤ             := by infer_instance
+instance instRingInt : Ring ℤ             := by infer_instance
 instance : Distrib ℤ          := by infer_instance
 
 #align int.neg_succ_not_nonneg Int.negSucc_not_nonneg
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
-
-! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 00d163e35035c3577c1c79fa53b68de17781ffc1
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Init.Data.Int.Order
 import Mathlib.Data.Int.Cast.Basic
@@ -14,6 +9,8 @@ import Mathlib.Algebra.Ring.Basic
 import Mathlib.Order.Monotone.Basic
 import Mathlib.Logic.Nontrivial
 
+#align_import data.int.basic from "leanprover-community/mathlib"@"00d163e35035c3577c1c79fa53b68de17781ffc1"
+
 /-!
 # Basic operations on the integers
 
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -81,7 +81,7 @@ protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m
 
 @[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
 theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n :=
-zpow_ofNat ..
+  zpow_ofNat ..
 #align coe_nat_zsmul coe_nat_zsmul
 
 /-! ### Extra instances to short-circuit type class resolution
feat: add Mathlib.Tactic.Common, and import (#4056)

This makes a mathlib4 version of mathlib3's tactic.basic, now called Mathlib.Tactic.Common, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.

This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -8,7 +8,6 @@ Authors: Jeremy Avigad
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathlib.Tactic.Convert
 import Mathlib.Init.Data.Int.Order
 import Mathlib.Data.Int.Cast.Basic
 import Mathlib.Algebra.Ring.Basic
feat: port RingTheory.ZMod (#3257)

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 728baa2f54e6062c5879a3e397ac6bac323e506f
+! leanprover-community/mathlib commit 00d163e35035c3577c1c79fa53b68de17781ffc1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -198,6 +198,9 @@ theorem succ_neg_nat_succ (n : ℕ) : succ (-Nat.succ n) = -n := succ_neg_succ n
 
 /-! ### nat abs -/
 
+theorem natAbs_surjective : natAbs.Surjective := fun n => ⟨n, natAbs_ofNat n⟩
+#align int.nat_abs_surjective Int.natAbs_surjective
+
 #align int.nat_abs_add_le Int.natAbs_add_le
 #align int.nat_abs_sub_le Int.natAbs_sub_le
 #align int.nat_abs_neg_of_nat Int.natAbs_negOfNat
feat: port IMO 2006 Q5 helper results (#3136)

We don't port the IMO proof itself since it seems there's no archive in Mathlib4.

Mathlib 3: https://github.com/leanprover-community/mathlib/pull/15613

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit 728baa2f54e6062c5879a3e397ac6bac323e506f
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -127,6 +127,16 @@ theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := ofNat_le.2 (Nat.zero_le _)
 #align int.neg_of_nat_ne_zero Int.negSucc_ne_zero
 #align int.zero_ne_neg_of_nat Int.zero_ne_negSucc
 
+@[simp]
+theorem sign_coe_add_one (n : ℕ) : Int.sign (n + 1) = 1 :=
+  rfl
+#align int.sign_coe_add_one Int.sign_coe_add_one
+
+@[simp]
+theorem sign_negSucc (n : ℕ) : Int.sign -[n+1] = -1 :=
+  rfl
+#align int.sign_neg_succ_of_nat Int.sign_negSucc
+
 /-! ### succ and pred -/
 
 /-- Immediate successor of an integer: `succ n = n + 1` -/
chore: forward-port leanprover-community/mathlib#17483 (#2884)

This forward ports the changes introduced by leanprover-community/mathlib#17483

No change is needed to Mathlib.Data.EReal as the proofs have been golfed in a different way.

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -153,7 +153,7 @@ theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a := by rw [neg_succ, succ_p
 #align int.succ_neg_succ Int.succ_neg_succ
 
 theorem neg_pred (a : ℤ) : -pred a = succ (-a) := by
-  rw [eq_neg_of_eq_neg (neg_succ (-a)).symm, neg_neg]
+  rw [neg_eq_iff_eq_neg.mp (neg_succ (-a)), neg_neg]
 #align int.neg_pred Int.neg_pred
 
 theorem pred_neg_pred (a : ℤ) : pred (-pred a) = -a := by rw [neg_pred, pred_succ]
feat: to_additive raises linter errors; nested to_additive (#1819)
  • Turn info messages of to_additive into linter errors
  • Allow @[to_additive (attr := to_additive)] to additivize the generated lemma. This is useful for Pow -> SMul -> VAdd lemmas. We can write e.g. @[to_additive (attr := to_additive, simp)] to add the simp attribute to all 3 generated lemmas, and we can provide other options to each to_additive call separately (specifying a name / reorder).
  • The previous point was needed to cleanly get rid of some linter warnings. It also required some additional changes (addToAdditiveAttr now returns a value, turn a few (meta) definitions into mutual partial def, reorder some definitions, generalize additivizeLemmas to lists of more than 2 elements) that should have no visible effects for the user.
Diff
@@ -80,12 +80,9 @@ lemma natAbs_cast (n : ℕ) : natAbs ↑n = n := rfl
 @[norm_cast]
 protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m - ↑n := ofNat_sub
 
--- TODO restore @[to_additive coe_nat_zsmul]
-@[simp, norm_cast]
-theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n := zpow_ofNat ..
-@[simp]
-theorem _root_.coe_nat_zsmul [SubNegMonoid G] (a : G) (n : ℕ) : (n : ℤ) • a = n • a := ofNat_zsmul ..
-attribute [to_additive coe_nat_zsmul] zpow_coe_nat
+@[to_additive (attr := simp, norm_cast) coe_nat_zsmul]
+theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n :=
+zpow_ofNat ..
 #align coe_nat_zsmul coe_nat_zsmul
 
 /-! ### Extra instances to short-circuit type class resolution
chore: resync ported files (#2135)

This PR resyncs the first 28 entries of https://leanprover-community.github.io/mathlib-port-status/out-of-sync.html after sorting by diff size.

  • resync Mathlib/Data/Bool/Count
  • resync Mathlib/Order/Max
  • resync Mathlib/Algebra/EuclideanDomain/Instances
  • resync Mathlib/Data/List/Duplicate
  • resync Mathlib/Data/Multiset/Nodup
  • resync Mathlib/Data/Set/Pointwise/ListOfFn
  • resync Mathlib/Dynamics/FixedPoints/Basic
  • resync Mathlib/Order/OmegaCompletePartialOrder
  • resync Mathlib/Order/PropInstances
  • resync Mathlib/Topology/LocallyFinite
  • resync Mathlib/Data/Bool/Set
  • resync Mathlib/Data/Fintype/Card
  • resync Mathlib/Data/Multiset/Bind
  • resync Mathlib/Data/Rat/Floor
  • resync Mathlib/Algebra/Order/Floor
  • resync Mathlib/Data/Int/Basic
  • resync Mathlib/Data/Int/Dvd/Basic
  • resync Mathlib/Data/List/Sort
  • resync Mathlib/Data/Nat/GCD/Basic
  • resync Mathlib/Data/Set/Enumerate
  • resync Mathlib/Data/Set/Intervals/OrdConnectedComponent
  • resync Mathlib/GroupTheory/Subsemigroup/Basic
  • resync Mathlib/Topology/Connected
  • resync Mathlib/Topology/NhdsSet
  • resync Mathlib/Algebra/BigOperators/Multiset/Lemmas
  • resync Mathlib/Algebra/CharZero/Infinite
  • resync Mathlib/Data/Multiset/Range
  • resync Mathlib/Data/Set/Pointwise/Finite
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit 2258b40dacd2942571c8ce136215350c702dc78f
+! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
chore: add missing #align statements (#1902)

This PR is the result of a slight variant on the following "algorithm"

  • take all mathlib 3 names, remove _ and make all uppercase letters into lowercase
  • take all mathlib 4 names, remove _ and make all uppercase letters into lowercase
  • look for matches, and create pairs (original_lean3_name, OriginalLean4Name)
  • for pairs that do not have an align statement:
    • use Lean 4 to lookup the file + position of the Lean 4 name
    • add an #align statement just before the next empty line
  • manually fix some tiny mistakes (e.g., empty lines in proofs might cause the #align statement to have been inserted too early)
Diff
@@ -86,6 +86,7 @@ theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n
 @[simp]
 theorem _root_.coe_nat_zsmul [SubNegMonoid G] (a : G) (n : ℕ) : (n : ℤ) • a = n • a := ofNat_zsmul ..
 attribute [to_additive coe_nat_zsmul] zpow_coe_nat
+#align coe_nat_zsmul coe_nat_zsmul
 
 /-! ### Extra instances to short-circuit type class resolution
 
@@ -124,6 +125,7 @@ theorem coe_nat_strictMono : StrictMono (· : ℕ → ℤ) := fun _ _ ↦ Int.of
 #align int.coe_nat_strict_mono Int.coe_nat_strictMono
 
 theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := ofNat_le.2 (Nat.zero_le _)
+#align int.coe_nat_nonneg Int.coe_nat_nonneg
 
 #align int.neg_of_nat_ne_zero Int.negSucc_ne_zero
 #align int.zero_ne_neg_of_nat Int.zero_ne_negSucc
@@ -132,33 +134,46 @@ theorem coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := ofNat_le.2 (Nat.zero_le _)
 
 /-- Immediate successor of an integer: `succ n = n + 1` -/
 def succ (a : ℤ) := a + 1
+#align int.succ Int.succ
 
 /-- Immediate predecessor of an integer: `pred n = n - 1` -/
 def pred (a : ℤ) := a - 1
+#align int.pred Int.pred
 
 theorem nat_succ_eq_int_succ (n : ℕ) : (Nat.succ n : ℤ) = Int.succ n := rfl
+#align int.nat_succ_eq_int_succ Int.nat_succ_eq_int_succ
 
 theorem pred_succ (a : ℤ) : pred (succ a) = a := add_sub_cancel _ _
+#align int.pred_succ Int.pred_succ
 
 theorem succ_pred (a : ℤ) : succ (pred a) = a := sub_add_cancel _ _
+#align int.succ_pred Int.succ_pred
 
 theorem neg_succ (a : ℤ) : -succ a = pred (-a) := neg_add _ _
+#align int.neg_succ Int.neg_succ
 
 theorem succ_neg_succ (a : ℤ) : succ (-succ a) = -a := by rw [neg_succ, succ_pred]
+#align int.succ_neg_succ Int.succ_neg_succ
 
 theorem neg_pred (a : ℤ) : -pred a = succ (-a) := by
   rw [eq_neg_of_eq_neg (neg_succ (-a)).symm, neg_neg]
+#align int.neg_pred Int.neg_pred
 
 theorem pred_neg_pred (a : ℤ) : pred (-pred a) = -a := by rw [neg_pred, pred_succ]
+#align int.pred_neg_pred Int.pred_neg_pred
 
 theorem pred_nat_succ (n : ℕ) : pred (Nat.succ n) = n := pred_succ n
+#align int.pred_nat_succ Int.pred_nat_succ
 
 theorem neg_nat_succ (n : ℕ) : -(Nat.succ n : ℤ) = pred (-n) := neg_succ n
+#align int.neg_nat_succ Int.neg_nat_succ
 
 theorem succ_neg_nat_succ (n : ℕ) : succ (-Nat.succ n) = -n := succ_neg_succ n
+#align int.succ_neg_nat_succ Int.succ_neg_nat_succ
 
 @[norm_cast] theorem coe_pred_of_pos {n : ℕ} (h : 0 < n) : ((n - 1 : ℕ) : ℤ) = (n : ℤ) - 1 := by
   cases n; cases h; simp
+#align int.coe_pred_of_pos Int.coe_pred_of_pos
 
 @[elab_as_elim] protected theorem induction_on {p : ℤ → Prop} (i : ℤ)
     (hz : p 0) (hp : ∀ i : ℕ, p i → p (i + 1)) (hn : ∀ i : ℕ, p (-i) → p (-i - 1)) : p i := by
@@ -172,6 +187,7 @@ theorem succ_neg_nat_succ (n : ℕ) : succ (-Nat.succ n) = -n := succ_neg_succ n
     intro n; induction n with
     | zero => simp [hz, Nat.cast_zero]
     | succ n ih => convert hn _ ih using 1; simp [sub_eq_neg_add]
+#align int.induction_on Int.induction_on
 
 /-! ### nat abs -/
 
feat: port Dynamics.PeriodicPts (#1887)
Diff
@@ -236,7 +236,7 @@ theorem ediv_of_neg_of_pos {a b : ℤ} (Ha : a < 0) (Hb : 0 < b) : ediv a b = -(
 #align int.mod_zero Int.mod_zeroₓ -- int div alignment
 #align int.mod_one Int.mod_oneₓ -- int div alignment
 #align int.mod_eq_of_lt Int.emod_eq_of_lt -- int div alignment
-#align int.mod_add_div Int.mod_add_divₓ -- int div alignment
+#align int.mod_add_div Int.emod_add_ediv -- int div alignment
 #align int.div_add_mod Int.div_add_modₓ -- int div alignment
 #align int.mod_add_div' Int.mod_add_div'ₓ -- int div alignment
 #align int.div_add_mod' Int.div_add_mod'ₓ -- int div alignment
chore: fix most phantom #aligns (#1794)
Diff
@@ -281,4 +281,4 @@ theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 := sig
 #align int.to_nat_sub_to_nat_neg Int.toNat_sub_toNat_neg
 #align int.to_nat_add_to_nat_neg_eq_nat_abs Int.toNat_add_toNat_neg_eq_natAbs
 #align int.mem_to_nat' Int.mem_toNat'
-#align int.toNat_neg_nat Int.toNat_neg_nat
+#align int.to_nat_neg_nat Int.toNat_neg_nat
feat: port Data.Finset.Image (#1586)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -235,7 +235,7 @@ theorem ediv_of_neg_of_pos {a b : ℤ} (Ha : a < 0) (Hb : 0 < b) : ediv a b = -(
 #align int.zero_mod Int.zero_modₓ -- int div alignment
 #align int.mod_zero Int.mod_zeroₓ -- int div alignment
 #align int.mod_one Int.mod_oneₓ -- int div alignment
-#align int.mod_eq_of_lt Int.mod_eq_of_ltₓ -- int div alignment
+#align int.mod_eq_of_lt Int.emod_eq_of_lt -- int div alignment
 #align int.mod_add_div Int.mod_add_divₓ -- int div alignment
 #align int.div_add_mod Int.div_add_modₓ -- int div alignment
 #align int.mod_add_div' Int.mod_add_div'ₓ -- int div alignment
chore: fix more casing errors per naming scheme (#1232)

I've avoided anything under Tactic or test.

In correcting the names, I found Option.isNone_iff_eq_none duplicated between Std and Mathlib, so the Mathlib one has been removed.

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -260,7 +260,7 @@ theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 := sig
 #align int.of_nat_add_neg_succ_of_nat_of_lt Int.ofNat_add_negSucc_of_lt
 #align int.neg_add_neg Int.negSucc_add_negSucc
 
-/-! ### to_nat -/
+/-! ### toNat -/
 
 #align int.to_nat_eq_max Int.toNat_eq_max
 #align int.to_nat_zero Int.toNat_zero
chore: update SHA in porting header (#1306)

These files correspond to files flagged "The following files have been modified since the commit at which they were verified." by port_status.py but are in sync with mathlib3, so we can update the hash.

I only updated the easy ones, the others need a closer inspection.

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
 
 ! This file was ported from Lean 3 source module data.int.basic
-! leanprover-community/mathlib commit a148d797a1094ab554ad4183a4ad6f130358ef64
+! leanprover-community/mathlib commit 2258b40dacd2942571c8ce136215350c702dc78f
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
fix Data.Int.Basic: fix zsmul on (#1217)

This way two instances for m • n, m n : ℤ, are defeq. Also use defeq to golf some proofs.

Diff
@@ -48,10 +48,14 @@ instance : CommRing ℤ where
   add_left_neg := Int.add_left_neg
   nsmul := (·*·)
   nsmul_zero := Int.zero_mul
-  nsmul_succ n x := by
-    show ofNat (Nat.succ n) * x = x + ofNat n * x
-    simp only [ofNat_eq_coe]
-    rw [Int.ofNat_succ, Int.add_mul, Int.add_comm, Int.one_mul]
+  nsmul_succ n x :=
+    show (n + 1 : ℤ) * x = x + n * x
+    by rw [Int.add_mul, Int.add_comm, Int.one_mul]
+  zsmul := (·*·)
+  zsmul_zero' := Int.zero_mul
+  zsmul_succ' m n := by
+    simp only [ofNat_eq_coe, ofNat_succ, Int.add_mul, Int.add_comm, Int.one_mul]
+  zsmul_neg' m n := by simp only [negSucc_coe, ofNat_succ, Int.neg_mul]
   sub_eq_add_neg _ _ := Int.sub_eq_add_neg
   natCast := (·)
   natCast_zero := rfl
chore: tidy after data.int.units port (#1199)

Co-authored-by: Reid Barton <rwbarton@gmail.com>

Diff
@@ -278,69 +278,3 @@ theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 := sig
 #align int.to_nat_add_to_nat_neg_eq_nat_abs Int.toNat_add_toNat_neg_eq_natAbs
 #align int.mem_to_nat' Int.mem_toNat'
 #align int.toNat_neg_nat Int.toNat_neg_nat
-
-/- TODO
-/-! ### units -/
-
-@[simp]
-theorem units_nat_abs (u : ℤˣ) : natAbs u = 1 :=
-  Units.ext_iff.1 <|
-    Nat.units_eq_one
-      ⟨natAbs u, natAbs ↑u⁻¹, by rw [← nat_abs_mul, Units.mul_inv] <;> rfl, by
-        rw [← nat_abs_mul, Units.inv_mul] <;> rfl⟩
-#align int.units_nat_abs Int.units_nat_abs
-
-theorem units_eq_one_or (u : ℤˣ) : u = 1 ∨ u = -1 := by simpa only [Units.ext_iff, units_nat_abs] using nat_abs_eq u
-#align int.units_eq_one_or Int.units_eq_one_or
-
-theorem is_unit_eq_one_or {a : ℤ} : IsUnit a → a = 1 ∨ a = -1
-  | ⟨x, hx⟩ => hx ▸ (units_eq_one_or _).imp (congr_arg coe) (congr_arg coe)
-#align int.is_unit_eq_one_or Int.is_unit_eq_one_or
-
-theorem is_unit_iff {a : ℤ} : IsUnit a ↔ a = 1 ∨ a = -1 := by
-  refine' ⟨fun h ↦ is_unit_eq_one_or h, fun h ↦ _⟩
-  rcases h with (rfl | rfl)
-  · exact is_unit_one
-
-  · exact is_unit_one.neg
-
-#align int.is_unit_iff Int.is_unit_iff
-
-theorem is_unit_eq_or_eq_neg {a b : ℤ} (ha : IsUnit a) (hb : IsUnit b) : a = b ∨ a = -b := by
-  rcases is_unit_eq_one_or hb with (rfl | rfl)
-  · exact is_unit_eq_one_or ha
-
-  · rwa [or_comm', neg_neg, ← is_unit_iff]
-
-#align int.is_unit_eq_or_eq_neg Int.is_unit_eq_or_eq_neg
-
-theorem eq_one_or_neg_one_of_mul_eq_one {z w : ℤ} (h : z * w = 1) : z = 1 ∨ z = -1 :=
-  is_unit_iff.mp (is_unit_of_mul_eq_one z w h)
-#align int.eq_one_or_neg_one_of_mul_eq_one Int.eq_one_or_neg_one_of_mul_eq_one
-
-theorem eq_one_or_neg_one_of_mul_eq_one' {z w : ℤ} (h : z * w = 1) : z = 1 ∧ w = 1 ∨ z = -1 ∧ w = -1 := by
-  have h' : w * z = 1 := mul_comm z w ▸ h
-  rcases eq_one_or_neg_one_of_mul_eq_one h with (rfl | rfl) <;>
-    rcases eq_one_or_neg_one_of_mul_eq_one h' with (rfl | rfl) <;> tauto
-#align int.eq_one_or_neg_one_of_mul_eq_one' Int.eq_one_or_neg_one_of_mul_eq_one'
-
-theorem is_unit_iff_nat_abs_eq {n : ℤ} : IsUnit n ↔ n.natAbs = 1 := by simp [nat_abs_eq_iff, is_unit_iff, Nat.cast_zero]
-#align int.is_unit_iff_nat_abs_eq Int.is_unit_iff_nat_abs_eq
-
-alias is_unit_iff_nat_abs_eq ↔ is_unit.nat_abs_eq _
-
-@[norm_cast]
-theorem of_nat_is_unit {n : ℕ} : IsUnit (n : ℤ) ↔ IsUnit n := by
-  rw [Nat.is_unit_iff, is_unit_iff_nat_abs_eq, nat_abs_of_nat]
-#align int.of_nat_is_unit Int.of_nat_is_unit
-
-theorem is_unit_mul_self {a : ℤ} (ha : IsUnit a) : a * a = 1 :=
-  (is_unit_eq_one_or ha).elim (fun h ↦ h.symm ▸ rfl) fun h ↦ h.symm ▸ rfl
-#align int.is_unit_mul_self Int.is_unit_mul_self
-
-theorem is_unit_add_is_unit_eq_is_unit_add_is_unit {a b c d : ℤ} (ha : IsUnit a) (hb : IsUnit b) (hc : IsUnit c)
-    (hd : IsUnit d) : a + b = c + d ↔ a = c ∧ b = d ∨ a = d ∧ b = c := by
-  rw [is_unit_iff] at ha hb hc hd
-  cases ha <;> cases hb <;> cases hc <;> cases hd <;> subst ha <;> subst hb <;> subst hc <;> subst hd <;> tidy
-#align int.is_unit_add_is_unit_eq_is_unit_add_is_unit Int.is_unit_add_is_unit_eq_is_unit_add_is_unit
--/
chore: bump to 2022-12-23 (#1191)
Diff
@@ -275,7 +275,7 @@ theorem sign_coe_nat_of_nonzero {n : ℕ} (hn : n ≠ 0) : Int.sign n = 1 := sig
 #align int.to_nat_add_nat Int.toNat_add_nat
 #align int.pred_to_nat Int.pred_toNat
 #align int.to_nat_sub_to_nat_neg Int.toNat_sub_toNat_neg
-#align int.to_nat_add_to_nat_neg_eq_nat_abs Int.toNat_add_toNat_neg_eq_nat_abs
+#align int.to_nat_add_to_nat_neg_eq_nat_abs Int.toNat_add_toNat_neg_eq_natAbs
 #align int.mem_to_nat' Int.mem_toNat'
 #align int.toNat_neg_nat Int.toNat_neg_nat
 
chore: fix casing per naming scheme (#1183)

Fix a lot of wrong casing mostly in the docstrings but also sometimes in def/theorem names. E.g. fin 2 --> Fin 2, add_monoid_hom --> AddMonoidHom

Remove \n from to_additive docstrings that were inserted by mathport.

Move files and directories with Gcd and Smul to GCD and SMul

Diff
@@ -19,7 +19,7 @@ import Mathlib.Logic.Nontrivial
 # Basic operations on the integers
 
 This file contains:
-* instances on `ℤ`. The stronger one is `int.linear_ordered_comm_ring`.
+* instances on `ℤ`. The stronger one is `Int.linearOrderedCommRing`.
 * some basic lemmas about integers
 -/
 
@@ -85,7 +85,7 @@ attribute [to_additive coe_nat_zsmul] zpow_coe_nat
 
 /-! ### Extra instances to short-circuit type class resolution
 
-These also prevent non-computable instances like `int.normed_comm_ring` being used to construct
+These also prevent non-computable instances like `Int.normedCommRing` being used to construct
 these instances non-computably.
 -/
 instance : AddCommMonoid ℤ    := by infer_instance
feat port: GroupTheory.GroupAction.Group (#1146)
Diff
@@ -77,11 +77,11 @@ lemma natAbs_cast (n : ℕ) : natAbs ↑n = n := rfl
 protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m - ↑n := ofNat_sub
 
 -- TODO restore @[to_additive coe_nat_zsmul]
-@[norm_cast]
+@[simp, norm_cast]
 theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n := zpow_ofNat ..
 @[simp]
 theorem _root_.coe_nat_zsmul [SubNegMonoid G] (a : G) (n : ℕ) : (n : ℤ) • a = n • a := ofNat_zsmul ..
-attribute [to_additive _root_.coe_nat_zsmul] _root_.zpow_coe_nat
+attribute [to_additive coe_nat_zsmul] zpow_coe_nat
 
 /-! ### Extra instances to short-circuit type class resolution
 
feat port Algebra.GroupPower.Lemmas (#1055)

aba57d4d

Co-authored-by: Siddhartha Gadgil <siddhartha.gadgil@gmail.com>

Diff
@@ -79,6 +79,7 @@ protected lemma coe_nat_sub {n m : ℕ} : n ≤ m → (↑(m - n) : ℤ) = ↑m
 -- TODO restore @[to_additive coe_nat_zsmul]
 @[norm_cast]
 theorem _root_.zpow_coe_nat [DivInvMonoid G] (a : G) (n : ℕ) : a ^ (Nat.cast n : ℤ) = a ^ n := zpow_ofNat ..
+@[simp]
 theorem _root_.coe_nat_zsmul [SubNegMonoid G] (a : G) (n : ℕ) : (n : ℤ) • a = n • a := ofNat_zsmul ..
 attribute [to_additive _root_.coe_nat_zsmul] _root_.zpow_coe_nat
 
chore: add source headers to ported theory files (#1094)

The script used to do this is included. The yaml file was obtained from https://raw.githubusercontent.com/wiki/leanprover-community/mathlib/mathlib4-port-status.md

Diff
@@ -2,6 +2,11 @@
 Copyright (c) 2016 Jeremy Avigad. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Jeremy Avigad
+
+! This file was ported from Lean 3 source module data.int.basic
+! leanprover-community/mathlib commit a148d797a1094ab554ad4183a4ad6f130358ef64
+! Please do not edit these lines, except to modify the commit id
+! if you have ported upstream changes.
 -/
 import Mathlib.Tactic.Convert
 import Mathlib.Init.Data.Int.Order

Dependencies 30

31 files ported (100.0%)
13493 lines ported (100.0%)

All dependencies are ported!