data.nat.powMathlib.Data.Nat.Pow

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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

feat(ring_theory/polynomial/cyclotomic/eval): golf, add lemmas (#18022)
  • Add nat.le_self_pow, polynomial.sub_one_pow_totient_le_cyclotomic_eval, polynomial.cyclotomic_eval_le_add_one_pow_totient, polynomial.sub_one_pow_totient_lt_nat_abs_cyclotomic_eval, zmod.order_of_units_dvd_card_sub_one, and zmod.order_of_dvd_card_sub_one.
  • Rename polynomial.cyclotomic_eval_lt_sub_one_pow_totient to polynomial.cyclotomic_eval_lt_add_one_pow_totient.
  • Replace nat.exists_prime_ge_modeq_one with nat.exists_prime_gt_modeq_one.
  • Assume ≠ 0 instead of 0 < in nat.exists_prime_ge_modeq_one etc.
  • Golf some proofs.

Mathlib 4 version: leanprover-community/mathlib4#1273

Diff
@@ -35,6 +35,10 @@ pow_lt_pow H h
 lemma pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p^n < p^(n+1) :=
 pow_lt_pow_of_lt_right h n.lt_succ_self
 
+lemma le_self_pow {n : ℕ} (hn : n ≠ 0) : ∀ m : ℕ, m ≤ m ^ n
+| 0 := zero_le _
+| (m + 1) := _root_.le_self_pow dec_trivial hn
+
 lemma lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
 | 0 := by simp [zero_lt_one]
 | (n+1) := calc

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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
@@ -138,12 +138,10 @@ theorem one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) :=
 #align nat.one_lt_two_pow' Nat.one_lt_two_pow'
 -/
 
-/- warning: nat.pow_right_strict_mono clashes with pow_strict_mono_right -> pow_right_strictMono
-Case conversion may be inaccurate. Consider using '#align nat.pow_right_strict_mono pow_right_strictMonoₓ'. -/
-#print pow_right_strictMono /-
+#print Nat.pow_right_strictMono /-
 theorem pow_right_strictMono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ => x ^ n := fun _ _ =>
   pow_lt_pow_right k
-#align nat.pow_right_strict_mono pow_right_strictMono
+#align nat.pow_right_strict_mono Nat.pow_right_strictMono
 -/
 
 #print Nat.pow_le_iff_le_right /-
@@ -152,12 +150,10 @@ theorem pow_le_iff_le_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m ≤ x ^ n ↔ m
 #align nat.pow_le_iff_le_right Nat.pow_le_iff_le_right
 -/
 
-/- warning: nat.pow_lt_iff_lt_right clashes with pow_lt_pow_iff_ -> pow_lt_pow_iff_right
-Case conversion may be inaccurate. Consider using '#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_rightₓ'. -/
-#print pow_lt_pow_iff_right /-
+#print Nat.pow_lt_pow_iff_right /-
 theorem pow_lt_pow_iff_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m < x ^ n ↔ m < n :=
   StrictMono.lt_iff_lt (pow_right_strictMono k)
-#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_right
+#align nat.pow_lt_iff_lt_right Nat.pow_lt_pow_iff_right
 -/
 
 #print Nat.pow_right_injective /-
@@ -175,7 +171,7 @@ theorem pow_left_strictMono {m : ℕ} (k : 1 ≤ m) : StrictMono fun x : ℕ =>
 #print Nat.mul_lt_mul_pow_succ /-
 theorem mul_lt_mul_pow_succ {n a q : ℕ} (a0 : 0 < a) (q1 : 1 < q) : n * q < a * q ^ (n + 1) :=
   by
-  rw [pow_succ', ← mul_assoc, mul_lt_mul_right (zero_lt_one.trans q1)]
+  rw [pow_succ, ← mul_assoc, mul_lt_mul_right (zero_lt_one.trans q1)]
   exact lt_mul_of_one_le_of_lt (nat.succ_le_iff.mpr a0) (Nat.lt_pow_self q1 n)
 #align nat.mul_lt_mul_pow_succ Nat.mul_lt_mul_pow_succ
 -/
@@ -225,7 +221,7 @@ alias pow_two_sub_pow_two := sq_sub_sq
 theorem pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n :=
   by
   induction' b with b ih
-  rfl; simp [pow_succ, Nat.mul_mod, ih]
+  rfl; simp [pow_succ', Nat.mul_mod, ih]
 #align nat.pow_mod Nat.pow_mod
 -/
 
@@ -233,7 +229,7 @@ theorem pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n :=
 theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w) + m % b :=
   by
   by_cases b_h : b = 0
-  · simp [b_h, pow_succ]
+  · simp [b_h, pow_succ']
   have b_pos := Nat.pos_of_ne_zero b_h
   apply Nat.strong_induction_on m
   clear m
@@ -242,7 +238,7 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
   -- base case: p < b^succ w
   · have h₂ : p / b < b ^ w := by
       rw [div_lt_iff_lt_mul b_pos]
-      simpa [pow_succ'] using h₁
+      simpa [pow_succ] using h₁
     rw [mod_eq_of_lt h₁, mod_eq_of_lt h₂]
     simp [div_add_mod]
   -- step: p ≥ b^succ w
@@ -251,8 +247,8 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
     -- Apply induction
     rw [mod_eq_sub_mod h₁, IH _ h₂]
     -- Normalize goal and h1
-    simp only [pow_succ]
-    simp only [GE.ge, pow_succ] at h₁
+    simp only [pow_succ']
+    simp only [GE.ge, pow_succ'] at h₁
     -- Pull subtraction outside mod and div
     rw [sub_mul_mod _ _ _ h₁, sub_mul_div _ _ _ h₁]
     -- Cancel subtraction inside mod b^w
@@ -293,7 +289,7 @@ theorem pow_dvd_pow_iff_le_right' {b k l : ℕ} : (b + 2) ^ k ∣ (b + 2) ^ l 
 #print Nat.not_pos_pow_dvd /-
 theorem not_pos_pow_dvd : ∀ {p k : ℕ} (hp : 1 < p) (hk : 1 < k), ¬p ^ k ∣ p
   | succ p, succ k, hp, hk, h =>
-    have : succ p * succ p ^ k ∣ succ p * 1 := by simpa [pow_succ] using h
+    have : succ p * succ p ^ k ∣ succ p * 1 := by simpa [pow_succ'] using h
     have : succ p ^ k ∣ 1 := dvd_of_mul_dvd_mul_left (succ_pos _) this
     have he : succ p ^ k = 1 := eq_one_of_dvd_one this
     have : k < succ p ^ k := lt_pow_self hp k
Diff
@@ -252,7 +252,7 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
     rw [mod_eq_sub_mod h₁, IH _ h₂]
     -- Normalize goal and h1
     simp only [pow_succ]
-    simp only [GE.ge, pow_succ] at h₁ 
+    simp only [GE.ge, pow_succ] at h₁
     -- Pull subtraction outside mod and div
     rw [sub_mul_mod _ _ _ h₁, sub_mul_div _ _ _ h₁]
     -- Cancel subtraction inside mod b^w
@@ -297,9 +297,9 @@ theorem not_pos_pow_dvd : ∀ {p k : ℕ} (hp : 1 < p) (hk : 1 < k), ¬p ^ k ∣
     have : succ p ^ k ∣ 1 := dvd_of_mul_dvd_mul_left (succ_pos _) this
     have he : succ p ^ k = 1 := eq_one_of_dvd_one this
     have : k < succ p ^ k := lt_pow_self hp k
-    have : k < 1 := by rwa [he] at this 
+    have : k < 1 := by rwa [he] at this
     have : k = 0 := Nat.eq_zero_of_le_zero <| le_of_lt_succ this
-    have : 1 < 1 := by rwa [this] at hk 
+    have : 1 < 1 := by rwa [this] at hk
     absurd this (by decide)
 #align nat.not_pos_pow_dvd Nat.not_pos_pow_dvd
 -/
Diff
@@ -146,9 +146,11 @@ theorem pow_right_strictMono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ =>
 #align nat.pow_right_strict_mono pow_right_strictMono
 -/
 
+#print Nat.pow_le_iff_le_right /-
 theorem pow_le_iff_le_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m ≤ x ^ n ↔ m ≤ n :=
   StrictMono.le_iff_le (pow_right_strictMono k)
 #align nat.pow_le_iff_le_right Nat.pow_le_iff_le_right
+-/
 
 /- warning: nat.pow_lt_iff_lt_right clashes with pow_lt_pow_iff_ -> pow_lt_pow_iff_right
 Case conversion may be inaccurate. Consider using '#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_rightₓ'. -/
Diff
@@ -21,36 +21,38 @@ namespace Nat
 /-! ### `pow` -/
 
 
-#print Nat.pow_le_pow_of_le_left /-
+#print Nat.pow_le_pow_left /-
 -- This is redundant with `pow_le_pow_of_le_left'`,
 -- We leave a version in the `nat` namespace as well.
 -- (The global `pow_le_pow_of_le_left` needs an extra hypothesis `0 ≤ x`.)
-protected theorem pow_le_pow_of_le_left {x y : ℕ} (H : x ≤ y) : ∀ i : ℕ, x ^ i ≤ y ^ i :=
-  pow_le_pow_of_le_left' H
-#align nat.pow_le_pow_of_le_left Nat.pow_le_pow_of_le_left
+protected theorem pow_le_pow_left {x y : ℕ} (H : x ≤ y) : ∀ i : ℕ, x ^ i ≤ y ^ i :=
+  pow_le_pow_left' H
+#align nat.pow_le_pow_of_le_left Nat.pow_le_pow_left
 -/
 
-#print Nat.pow_le_pow_of_le_right /-
-theorem pow_le_pow_of_le_right {x : ℕ} (H : 0 < x) {i j : ℕ} (h : i ≤ j) : x ^ i ≤ x ^ j :=
-  pow_le_pow' H h
-#align nat.pow_le_pow_of_le_right Nat.pow_le_pow_of_le_right
+#print Nat.pow_le_pow_right /-
+theorem pow_le_pow_right {x : ℕ} (H : 0 < x) {i j : ℕ} (h : i ≤ j) : x ^ i ≤ x ^ j :=
+  pow_le_pow_right' H h
+#align nat.pow_le_pow_of_le_right Nat.pow_le_pow_right
 -/
 
-#print Nat.pow_lt_pow_of_lt_left /-
-theorem pow_lt_pow_of_lt_left {x y : ℕ} (H : x < y) {i} (h : 0 < i) : x ^ i < y ^ i :=
-  pow_lt_pow_of_lt_left H (zero_le _) h
-#align nat.pow_lt_pow_of_lt_left Nat.pow_lt_pow_of_lt_left
+#print Nat.pow_lt_pow_left /-
+theorem pow_lt_pow_left {x y : ℕ} (H : x < y) {i} (h : 0 < i) : x ^ i < y ^ i :=
+  pow_lt_pow_left H (zero_le _) h
+#align nat.pow_lt_pow_of_lt_left Nat.pow_lt_pow_left
 -/
 
-#print Nat.pow_lt_pow_of_lt_right /-
-theorem pow_lt_pow_of_lt_right {x : ℕ} (H : 1 < x) {i j : ℕ} (h : i < j) : x ^ i < x ^ j :=
+/- warning: nat.pow_lt_pow_of_lt_right clashes with pow_lt_pow_right -> pow_lt_pow_right
+Case conversion may be inaccurate. Consider using '#align nat.pow_lt_pow_of_lt_right pow_lt_pow_rightₓ'. -/
+#print pow_lt_pow_right /-
+theorem pow_lt_pow_right {x : ℕ} (H : 1 < x) {i j : ℕ} (h : i < j) : x ^ i < x ^ j :=
   pow_lt_pow H h
-#align nat.pow_lt_pow_of_lt_right Nat.pow_lt_pow_of_lt_right
+#align nat.pow_lt_pow_of_lt_right pow_lt_pow_right
 -/
 
 #print Nat.pow_lt_pow_succ /-
 theorem pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p ^ n < p ^ (n + 1) :=
-  pow_lt_pow_of_lt_right h n.lt_succ_self
+  pow_lt_pow_right h n.lt_succ_self
 #align nat.pow_lt_pow_succ Nat.pow_lt_pow_succ
 -/
 
@@ -79,7 +81,7 @@ theorem lt_two_pow (n : ℕ) : n < 2 ^ n :=
 
 #print Nat.one_le_pow /-
 theorem one_le_pow (n m : ℕ) (h : 0 < m) : 1 ≤ m ^ n := by rw [← one_pow n];
-  exact Nat.pow_le_pow_of_le_left h n
+  exact Nat.pow_le_pow_left h n
 #align nat.one_le_pow Nat.one_le_pow
 -/
 
@@ -97,7 +99,7 @@ theorem one_le_two_pow (n : ℕ) : 1 ≤ 2 ^ n :=
 
 #print Nat.one_lt_pow /-
 theorem one_lt_pow (n m : ℕ) (h₀ : 0 < n) (h₁ : 1 < m) : 1 < m ^ n := by rw [← one_pow n];
-  exact pow_lt_pow_of_lt_left h₁ h₀
+  exact pow_lt_pow_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 -/
 
@@ -136,22 +138,24 @@ theorem one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) :=
 #align nat.one_lt_two_pow' Nat.one_lt_two_pow'
 -/
 
-#print Nat.pow_right_strictMono /-
+/- warning: nat.pow_right_strict_mono clashes with pow_strict_mono_right -> pow_right_strictMono
+Case conversion may be inaccurate. Consider using '#align nat.pow_right_strict_mono pow_right_strictMonoₓ'. -/
+#print pow_right_strictMono /-
 theorem pow_right_strictMono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ => x ^ n := fun _ _ =>
-  pow_lt_pow_of_lt_right k
-#align nat.pow_right_strict_mono Nat.pow_right_strictMono
+  pow_lt_pow_right k
+#align nat.pow_right_strict_mono pow_right_strictMono
 -/
 
-#print Nat.pow_le_iff_le_right /-
 theorem pow_le_iff_le_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m ≤ x ^ n ↔ m ≤ n :=
   StrictMono.le_iff_le (pow_right_strictMono k)
 #align nat.pow_le_iff_le_right Nat.pow_le_iff_le_right
--/
 
-#print Nat.pow_lt_iff_lt_right /-
-theorem pow_lt_iff_lt_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m < x ^ n ↔ m < n :=
+/- warning: nat.pow_lt_iff_lt_right clashes with pow_lt_pow_iff_ -> pow_lt_pow_iff_right
+Case conversion may be inaccurate. Consider using '#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_rightₓ'. -/
+#print pow_lt_pow_iff_right /-
+theorem pow_lt_pow_iff_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m < x ^ n ↔ m < n :=
   StrictMono.lt_iff_lt (pow_right_strictMono k)
-#align nat.pow_lt_iff_lt_right Nat.pow_lt_iff_lt_right
+#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_right
 -/
 
 #print Nat.pow_right_injective /-
@@ -162,7 +166,7 @@ theorem pow_right_injective {x : ℕ} (k : 2 ≤ x) : Function.Injective fun n :
 
 #print Nat.pow_left_strictMono /-
 theorem pow_left_strictMono {m : ℕ} (k : 1 ≤ m) : StrictMono fun x : ℕ => x ^ m := fun _ _ h =>
-  pow_lt_pow_of_lt_left h k
+  pow_lt_pow_left h k
 #align nat.pow_left_strict_mono Nat.pow_left_strictMono
 -/
 
@@ -185,16 +189,16 @@ theorem StrictMono.nat_pow {n : ℕ} (hn : 1 ≤ n) {f : ℕ → ℕ} (hf : Stri
 
 namespace Nat
 
-#print Nat.pow_le_iff_le_left /-
-theorem pow_le_iff_le_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m ≤ y ^ m ↔ x ≤ y :=
+#print Nat.pow_le_pow_iff_left /-
+theorem pow_le_pow_iff_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m ≤ y ^ m ↔ x ≤ y :=
   StrictMono.le_iff_le (pow_left_strictMono k)
-#align nat.pow_le_iff_le_left Nat.pow_le_iff_le_left
+#align nat.pow_le_iff_le_left Nat.pow_le_pow_iff_left
 -/
 
-#print Nat.pow_lt_iff_lt_left /-
-theorem pow_lt_iff_lt_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m < y ^ m ↔ x < y :=
+#print Nat.pow_lt_pow_iff_left /-
+theorem pow_lt_pow_iff_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m < y ^ m ↔ x < y :=
   StrictMono.lt_iff_lt (pow_left_strictMono k)
-#align nat.pow_lt_iff_lt_left Nat.pow_lt_iff_lt_left
+#align nat.pow_lt_iff_lt_left Nat.pow_lt_pow_iff_left
 -/
 
 #print Nat.pow_left_injective /-
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2014 Floris van Doorn (c) 2016 Microsoft Corporation. All rights r
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad, Mario Carneiro
 -/
-import Mathbin.Algebra.GroupPower.Order
+import Algebra.GroupPower.Order
 
 #align_import data.nat.pow from "leanprover-community/mathlib"@"55d224c38461be1e8e4363247dd110137c24a4ff"
 
Diff
@@ -209,7 +209,7 @@ theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by rw [sq,
 #align nat.sq_sub_sq Nat.sq_sub_sq
 -/
 
-alias sq_sub_sq ← pow_two_sub_pow_two
+alias pow_two_sub_pow_two := sq_sub_sq
 #align nat.pow_two_sub_pow_two Nat.pow_two_sub_pow_two
 
 /-! ### `pow` and `mod` / `dvd` -/
Diff
@@ -266,7 +266,7 @@ theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ} (w : 0 < x), x ^
     · intro a; cases' x with x
       · simp only [one_pow]
       · have le := (pow_le_iff_le_right (Nat.le_add_left _ _)).mp a
-        use (x + 2) ^ (l - k)
+        use(x + 2) ^ (l - k)
         rw [← pow_add, add_comm k, tsub_add_cancel_of_le le]
 #align nat.pow_dvd_pow_iff_pow_le_pow Nat.pow_dvd_pow_iff_pow_le_pow
 -/
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2014 Floris van Doorn (c) 2016 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.pow
-! leanprover-community/mathlib commit 55d224c38461be1e8e4363247dd110137c24a4ff
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.GroupPower.Order
 
+#align_import data.nat.pow from "leanprover-community/mathlib"@"55d224c38461be1e8e4363247dd110137c24a4ff"
+
 /-! # `nat.pow`
 
 > THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
Diff
@@ -71,7 +71,6 @@ theorem lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
     calc
       n + 1 < p ^ n + 1 := Nat.add_lt_add_right (lt_pow_self _) _
       _ ≤ p ^ (n + 1) := pow_lt_pow_succ h _
-      
 #align nat.lt_pow_self Nat.lt_pow_self
 -/
 
Diff
@@ -250,7 +250,7 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
     rw [mod_eq_sub_mod h₁, IH _ h₂]
     -- Normalize goal and h1
     simp only [pow_succ]
-    simp only [GE.ge, pow_succ] at h₁
+    simp only [GE.ge, pow_succ] at h₁ 
     -- Pull subtraction outside mod and div
     rw [sub_mul_mod _ _ _ h₁, sub_mul_div _ _ _ h₁]
     -- Cancel subtraction inside mod b^w
@@ -295,9 +295,9 @@ theorem not_pos_pow_dvd : ∀ {p k : ℕ} (hp : 1 < p) (hk : 1 < k), ¬p ^ k ∣
     have : succ p ^ k ∣ 1 := dvd_of_mul_dvd_mul_left (succ_pos _) this
     have he : succ p ^ k = 1 := eq_one_of_dvd_one this
     have : k < succ p ^ k := lt_pow_self hp k
-    have : k < 1 := by rwa [he] at this
+    have : k < 1 := by rwa [he] at this 
     have : k = 0 := Nat.eq_zero_of_le_zero <| le_of_lt_succ this
-    have : 1 < 1 := by rwa [this] at hk
+    have : 1 < 1 := by rwa [this] at hk 
     absurd this (by decide)
 #align nat.not_pos_pow_dvd Nat.not_pos_pow_dvd
 -/
Diff
@@ -82,9 +82,7 @@ theorem lt_two_pow (n : ℕ) : n < 2 ^ n :=
 -/
 
 #print Nat.one_le_pow /-
-theorem one_le_pow (n m : ℕ) (h : 0 < m) : 1 ≤ m ^ n :=
-  by
-  rw [← one_pow n]
+theorem one_le_pow (n m : ℕ) (h : 0 < m) : 1 ≤ m ^ n := by rw [← one_pow n];
   exact Nat.pow_le_pow_of_le_left h n
 #align nat.one_le_pow Nat.one_le_pow
 -/
@@ -102,9 +100,7 @@ theorem one_le_two_pow (n : ℕ) : 1 ≤ 2 ^ n :=
 -/
 
 #print Nat.one_lt_pow /-
-theorem one_lt_pow (n m : ℕ) (h₀ : 0 < n) (h₁ : 1 < m) : 1 < m ^ n :=
-  by
-  rw [← one_pow n]
+theorem one_lt_pow (n m : ℕ) (h₀ : 0 < n) (h₁ : 1 < m) : 1 < m ^ n := by rw [← one_pow n];
   exact pow_lt_pow_of_lt_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 -/
@@ -212,9 +208,7 @@ theorem pow_left_injective {m : ℕ} (k : 1 ≤ m) : Function.Injective fun x :
 -/
 
 #print Nat.sq_sub_sq /-
-theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) :=
-  by
-  rw [sq, sq]
+theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by rw [sq, sq];
   exact Nat.mul_self_sub_mul_self_eq a b
 #align nat.sq_sub_sq Nat.sq_sub_sq
 -/
@@ -272,10 +266,8 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
 theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ} (w : 0 < x), x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l
   | x + 1, w => by
     constructor
-    · intro a
-      exact le_of_dvd (pow_pos (succ_pos x) l) a
-    · intro a
-      cases' x with x
+    · intro a; exact le_of_dvd (pow_pos (succ_pos x) l) a
+    · intro a; cases' x with x
       · simp only [one_pow]
       · have le := (pow_le_iff_le_right (Nat.le_add_left _ _)).mp a
         use (x + 2) ^ (l - k)

Changes in mathlib4

mathlib3
mathlib4
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -67,7 +67,7 @@ theorem one_lt_pow (n m : ℕ) (h₀ : n ≠ 0) (h₁ : 1 < m) : 1 < m ^ n := by
   exact Nat.pow_lt_pow_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 
-theorem two_pow_succ (n : ℕ) : 2^(n + 1) = 2^n + 2^n := by simp [pow_succ, mul_two]
+theorem two_pow_succ (n : ℕ) : 2^(n + 1) = 2^n + 2^n := by simp [Nat.pow_succ, mul_two]
 
 theorem one_lt_pow' (n m : ℕ) : 1 < (m + 2) ^ (n + 1) :=
   one_lt_pow (n + 1) (m + 2) n.succ_ne_zero (Nat.lt_of_sub_eq_succ rfl)
@@ -98,7 +98,7 @@ protected theorem pow_left_strictMono (hn : n ≠ 0) : StrictMono (. ^ n : ℕ 
 #align nat.pow_left_strict_mono Nat.pow_left_strictMono
 
 theorem mul_lt_mul_pow_succ {n a q : ℕ} (a0 : 0 < a) (q1 : 1 < q) : n * q < a * q ^ (n + 1) := by
-  rw [pow_succ, ← mul_assoc, mul_lt_mul_right (zero_lt_one.trans q1)]
+  rw [Nat.pow_succ, ← mul_assoc, mul_lt_mul_right (zero_lt_one.trans q1)]
   exact lt_mul_of_one_le_of_lt (Nat.succ_le_iff.mpr a0) (Nat.lt_pow_self q1 n)
 #align nat.mul_lt_mul_pow_succ Nat.mul_lt_mul_pow_succ
 
@@ -135,37 +135,7 @@ theorem pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n := by
   rfl; simp [pow_succ, Nat.mul_mod, ih]
 #align nat.pow_mod Nat.pow_mod
 
-theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w) + m % b := by
-  by_cases b_h : b = 0
-  · simp [b_h, pow_succ]
-  have b_pos := Nat.pos_of_ne_zero b_h
-  induction m using Nat.strong_induction_on with
-    | h p IH =>
-      cases' lt_or_ge p (b ^ succ w) with h₁ h₁
-      · -- base case: p < b^succ w
-        have h₂ : p / b < b ^ w := by
-          rw [div_lt_iff_lt_mul b_pos]
-          simpa [pow_succ] using h₁
-        rw [mod_eq_of_lt h₁, mod_eq_of_lt h₂]
-        simp [div_add_mod]
-      · -- step: p ≥ b^succ w
-        -- Generate condition for induction hypothesis
-        have h₂ : p - b ^ succ w < p :=
-          tsub_lt_self ((pow_pos b_pos _).trans_le h₁) (pow_pos b_pos _)
-        -- Apply induction
-        rw [mod_eq_sub_mod h₁, IH _ h₂]
-        -- Normalize goal and h1
-        simp only [pow_succ']
-        simp only [GE.ge, pow_succ'] at h₁
-        -- Pull subtraction outside mod and div
-        rw [sub_mul_mod h₁, sub_mul_div _ _ _ h₁]
-        -- Cancel subtraction inside mod b^w
-        have p_b_ge : b ^ w ≤ p / b := by
-          rw [le_div_iff_mul_le b_pos, mul_comm]
-          exact h₁
-        rw [Eq.symm (mod_eq_sub_mod p_b_ge)]
 #align nat.mod_pow_succ Nat.mod_pow_succ
-
 #align nat.pow_dvd_pow_iff_pow_le_pow Nat.pow_dvd_pow_iff_pow_le_pow
 #align nat.pow_dvd_pow_iff_le_right Nat.pow_dvd_pow_iff_le_right
 #align nat.pow_dvd_pow_iff_le_right' Nat.pow_dvd_pow_iff_le_right'
chore: bump Std (#10514)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Tobias Grosser <tobias@grosser.es>

Diff
@@ -182,16 +182,8 @@ theorem not_pos_pow_dvd : ∀ {p k : ℕ} (_ : 1 < p) (_ : 1 < k), ¬p ^ k ∣ p
     absurd this (by decide)
 #align nat.not_pos_pow_dvd Nat.not_pos_pow_dvd
 
-theorem pow_dvd_of_le_of_pow_dvd {p m n k : ℕ} (hmn : m ≤ n) (hdiv : p ^ n ∣ k) : p ^ m ∣ k :=
-  (pow_dvd_pow _ hmn).trans hdiv
 #align nat.pow_dvd_of_le_of_pow_dvd Nat.pow_dvd_of_le_of_pow_dvd
-
-theorem dvd_of_pow_dvd {p k m : ℕ} (hk : 1 ≤ k) (hpk : p ^ k ∣ m) : p ∣ m := by
-  rw [← pow_one p]; exact pow_dvd_of_le_of_pow_dvd hk hpk
 #align nat.dvd_of_pow_dvd Nat.dvd_of_pow_dvd
-
-theorem pow_div {x m n : ℕ} (h : n ≤ m) (hx : 0 < x) : x ^ m / x ^ n = x ^ (m - n) := by
-  rw [Nat.div_eq_iff_eq_mul_left (pow_pos hx n) (pow_dvd_pow _ h), pow_sub_mul_pow _ h]
 #align nat.pow_div Nat.pow_div
 
 theorem lt_of_pow_dvd_right {p i n : ℕ} (hn : n ≠ 0) (hp : 2 ≤ p) (h : p ^ i ∣ n) : i < n := by
chore: bump Std (#10482)

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

Diff
@@ -24,8 +24,6 @@ variable {m n x y : ℕ}
 
 -- The global `pow_le_pow_left` needs an extra hypothesis `0 ≤ x`.
 
-protected alias pow_le_pow_left := pow_le_pow_of_le_left
-protected alias pow_le_pow_right := pow_le_pow_of_le_right
 #align nat.pow_le_pow_of_le_left Nat.pow_le_pow_left
 #align nat.pow_le_pow_of_le_right Nat.pow_le_pow_right
 
@@ -34,9 +32,6 @@ protected theorem pow_lt_pow_left (h : x < y) (hn : n ≠ 0) : x ^ n < y ^ n :=
 #align nat.pow_lt_pow_of_lt_left Nat.pow_lt_pow_left
 
 #align nat.pow_lt_pow_of_lt_right pow_lt_pow_right
-
-theorem pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p ^ n < p ^ (n + 1) :=
-  pow_lt_pow_right h n.lt_succ_self
 #align nat.pow_lt_pow_succ Nat.pow_lt_pow_succ
 
 theorem le_self_pow {n : ℕ} (hn : n ≠ 0) : ∀ m : ℕ, m ≤ m ^ n
@@ -49,7 +44,7 @@ theorem lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
   | n + 1 =>
     calc
       n + 1 < p ^ n + 1 := Nat.add_lt_add_right (lt_pow_self h _) _
-      _ ≤ p ^ (n + 1) := pow_lt_pow_succ h _
+      _ ≤ p ^ (n + 1) := Nat.pow_lt_pow_succ h
 #align nat.lt_pow_self Nat.lt_pow_self
 
 theorem lt_two_pow (n : ℕ) : n < 2 ^ n :=
@@ -171,26 +166,8 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
         rw [Eq.symm (mod_eq_sub_mod p_b_ge)]
 #align nat.mod_pow_succ Nat.mod_pow_succ
 
-theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ}, 0 < x → (x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l)
-  | x + 1, w => by
-    constructor
-    · intro a
-      exact le_of_dvd (pow_pos (succ_pos x) l) a
-    · intro a
-      cases' x with x
-      · simp
-      · have le := (pow_le_pow_iff_right <| by simp).mp a
-        use (x + 2) ^ (l - k)
-        rw [← pow_add, add_comm k, tsub_add_cancel_of_le le]
 #align nat.pow_dvd_pow_iff_pow_le_pow Nat.pow_dvd_pow_iff_pow_le_pow
-
-/-- If `1 < x`, then `x^k` divides `x^l` if and only if `k` is at most `l`. -/
-theorem pow_dvd_pow_iff_le_right {x k l : ℕ} (w : 1 < x) : x ^ k ∣ x ^ l ↔ k ≤ l := by
-  rw [pow_dvd_pow_iff_pow_le_pow (lt_of_succ_lt w), pow_le_pow_iff_right w]
 #align nat.pow_dvd_pow_iff_le_right Nat.pow_dvd_pow_iff_le_right
-
-theorem pow_dvd_pow_iff_le_right' {b k l : ℕ} : (b + 2) ^ k ∣ (b + 2) ^ l ↔ k ≤ l :=
-  pow_dvd_pow_iff_le_right (Nat.lt_of_sub_eq_succ rfl)
 #align nat.pow_dvd_pow_iff_le_right' Nat.pow_dvd_pow_iff_le_right'
 
 theorem not_pos_pow_dvd : ∀ {p k : ℕ} (_ : 1 < p) (_ : 1 < k), ¬p ^ k ∣ p
chore: bump Std (#10455)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Alex Keizer <alex@keizer.dev> Co-authored-by: Tobias Grosser <tobias@grosser.es>

Diff
@@ -65,8 +65,6 @@ theorem one_le_pow' (n m : ℕ) : 1 ≤ (m + 1) ^ n :=
   one_le_pow n (m + 1) (succ_pos m)
 #align nat.one_le_pow' Nat.one_le_pow'
 
-theorem one_le_two_pow (n : ℕ) : 1 ≤ 2 ^ n :=
-  one_le_pow n 2 (by decide)
 #align nat.one_le_two_pow Nat.one_le_two_pow
 
 theorem one_lt_pow (n m : ℕ) (h₀ : n ≠ 0) (h₁ : 1 < m) : 1 < m ^ n := by
@@ -85,7 +83,6 @@ theorem one_lt_pow_iff {k n : ℕ} (h : k ≠ 0) : 1 < n ^ k ↔ 1 < n :=
   one_lt_pow_iff_of_nonneg (zero_le _) h
 #align nat.one_lt_pow_iff Nat.one_lt_pow_iff
 
-theorem one_lt_two_pow (n : ℕ) (h₀ : n ≠ 0) : 1 < 2 ^ n := one_lt_pow n 2 h₀ (by decide)
 #align nat.one_lt_two_pow Nat.one_lt_two_pow
 
 theorem one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) :=
chore: bump dependencies (#10446)

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

Diff
@@ -74,8 +74,6 @@ theorem one_lt_pow (n m : ℕ) (h₀ : n ≠ 0) (h₁ : 1 < m) : 1 < m ^ n := by
   exact Nat.pow_lt_pow_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 
-theorem two_pow_pos (n : ℕ) : 0 < 2^n := Nat.pos_pow_of_pos _ (by decide)
-
 theorem two_pow_succ (n : ℕ) : 2^(n + 1) = 2^n + 2^n := by simp [pow_succ, mul_two]
 
 theorem one_lt_pow' (n m : ℕ) : 1 < (m + 2) ^ (n + 1) :=
refactor: Delete Algebra.GroupPower.Lemmas (#9411)

Algebra.GroupPower.Lemmas used to be a big bag of lemmas that made it there on the criterion that they needed "more imports". This was completely untrue, as all lemmas could be moved to earlier files in PRs:

There are several reasons for this:

  • Necessary lemmas have been moved to earlier files since lemmas were dumped in Algebra.GroupPower.Lemmas
  • In the Lean 3 → Lean 4 transition, Std acquired basic Int and Nat lemmas which let us shortcircuit the part of the algebraic order hierarchy on which the corresponding general lemmas rest
  • Some proofs were overpowered
  • Some earlier files were tangled and I have untangled them

This PR finishes the job by moving the last few lemmas out of Algebra.GroupPower.Lemmas, which is therefore deleted.

Diff
@@ -241,3 +241,5 @@ Those lemmas have been deprecated on 2023-12-23.
 @[deprecated] protected alias Nat.pow_right_strictMono := pow_right_strictMono
 @[deprecated] alias Nat.pow_le_iff_le_right := pow_le_pow_iff_right
 @[deprecated] alias Nat.pow_lt_iff_lt_right := pow_lt_pow_iff_right
+
+assert_not_exists Set.range
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -184,7 +184,7 @@ theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ}, 0 < x → (x ^ k
     · intro a
       cases' x with x
       · simp
-      · have le := (pow_le_pow_iff_right $ by simp).mp a
+      · have le := (pow_le_pow_iff_right <| by simp).mp a
         use (x + 2) ^ (l - k)
         rw [← pow_add, add_comm k, tsub_add_cancel_of_le le]
 #align nat.pow_dvd_pow_iff_pow_le_pow Nat.pow_dvd_pow_iff_pow_le_pow
chore: Deprecate pow monotonicity lemmas (#9235)

Add deprecated aliases for all the lemmas removed in #9095 and fix a few renames that were botched.

Diff
@@ -228,3 +228,16 @@ theorem lt_of_pow_dvd_right {p i n : ℕ} (hn : n ≠ 0) (hp : 2 ≤ p) (h : p ^
 #align nat.lt_of_pow_dvd_right Nat.lt_of_pow_dvd_right
 
 end Nat
+
+/-!
+### Deprecated lemmas
+
+Those lemmas have been deprecated on 2023-12-23.
+-/
+
+@[deprecated] alias Nat.pow_lt_pow_of_lt_left := Nat.pow_lt_pow_left
+@[deprecated] alias Nat.pow_le_iff_le_left := Nat.pow_le_pow_iff_left
+@[deprecated] alias Nat.pow_lt_pow_of_lt_right := pow_lt_pow_right
+@[deprecated] protected alias Nat.pow_right_strictMono := pow_right_strictMono
+@[deprecated] alias Nat.pow_le_iff_le_right := pow_le_pow_iff_right
+@[deprecated] alias Nat.pow_lt_iff_lt_right := pow_lt_pow_iff_right
chore(*): use ∃ x ∈ s, _ instead of ∃ (x) (_ : x ∈ s), _ (#9215)

Follow-up #9184

Diff
@@ -176,7 +176,7 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
         rw [Eq.symm (mod_eq_sub_mod p_b_ge)]
 #align nat.mod_pow_succ Nat.mod_pow_succ
 
-theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ} (_ : 0 < x), x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l
+theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ}, 0 < x → (x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l)
   | x + 1, w => by
     constructor
     · intro a
chore: Rename pow monotonicity lemmas (#9095)

The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.

Renames

Algebra.GroupPower.Order

  • pow_monopow_right_mono
  • pow_le_powpow_le_pow_right
  • pow_le_pow_of_le_leftpow_le_pow_left
  • pow_lt_pow_of_lt_leftpow_lt_pow_left
  • strictMonoOn_powpow_left_strictMonoOn
  • pow_strictMono_rightpow_right_strictMono
  • pow_lt_powpow_lt_pow_right
  • pow_lt_pow_iffpow_lt_pow_iff_right
  • pow_le_pow_iffpow_le_pow_iff_right
  • self_lt_powlt_self_pow
  • strictAnti_powpow_right_strictAnti
  • pow_lt_pow_iff_of_lt_onepow_lt_pow_iff_right_of_lt_one
  • pow_lt_pow_of_lt_onepow_lt_pow_right_of_lt_one
  • lt_of_pow_lt_powlt_of_pow_lt_pow_left
  • le_of_pow_le_powle_of_pow_le_pow_left
  • pow_lt_pow₀pow_lt_pow_right₀

Algebra.GroupPower.CovariantClass

  • pow_le_pow_of_le_left'pow_le_pow_left'
  • nsmul_le_nsmul_of_le_rightnsmul_le_nsmul_right
  • pow_lt_pow'pow_lt_pow_right'
  • nsmul_lt_nsmulnsmul_lt_nsmul_left
  • pow_strictMono_leftpow_right_strictMono'
  • nsmul_strictMono_rightnsmul_left_strictMono
  • StrictMono.pow_right'StrictMono.pow_const
  • StrictMono.nsmul_leftStrictMono.const_nsmul
  • pow_strictMono_right'pow_left_strictMono
  • nsmul_strictMono_leftnsmul_right_strictMono
  • Monotone.pow_rightMonotone.pow_const
  • Monotone.nsmul_leftMonotone.const_nsmul
  • lt_of_pow_lt_pow'lt_of_pow_lt_pow_left'
  • lt_of_nsmul_lt_nsmullt_of_nsmul_lt_nsmul_right
  • pow_le_pow'pow_le_pow_right'
  • nsmul_le_nsmulnsmul_le_nsmul_left
  • pow_le_pow_of_le_one'pow_le_pow_right_of_le_one'
  • nsmul_le_nsmul_of_nonposnsmul_le_nsmul_left_of_nonpos
  • le_of_pow_le_pow'le_of_pow_le_pow_left'
  • le_of_nsmul_le_nsmul'le_of_nsmul_le_nsmul_right'
  • pow_le_pow_iff'pow_le_pow_iff_right'
  • nsmul_le_nsmul_iffnsmul_le_nsmul_iff_left
  • pow_lt_pow_iff'pow_lt_pow_iff_right'
  • nsmul_lt_nsmul_iffnsmul_lt_nsmul_iff_left

Data.Nat.Pow

  • Nat.pow_lt_pow_of_lt_leftNat.pow_lt_pow_left
  • Nat.pow_le_iff_le_leftNat.pow_le_pow_iff_left
  • Nat.pow_lt_iff_lt_leftNat.pow_lt_pow_iff_left

Lemmas added

  • pow_le_pow_iff_left
  • pow_lt_pow_iff_left
  • pow_right_injective
  • pow_right_inj
  • Nat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.
  • Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.

Lemmas removed

  • self_le_pow was a duplicate of le_self_pow.
  • Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.
  • Nat.pow_right_strictMono is defeq to pow_right_strictMono.
  • Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.
  • Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.

Other changes

  • A bunch of proofs have been golfed.
  • Some lemma assumptions have been turned from 0 < n or 1 ≤ n to n ≠ 0.
  • A few Nat lemmas have been protected.
  • One docstring has been fixed.
Diff
@@ -14,26 +14,29 @@ Results on the power operation on natural numbers.
 
 
 namespace Nat
+variable {m n x y : ℕ}
 
 /-! ### `pow` -/
 
 -- Porting note: the next two lemmas have moved into `Std`.
+-- TODO: Rename `Nat.pow_le_pow_of_le_left` to `Nat.pow_le_pow_left`, protect it, remove the alias
+-- TODO: Rename `Nat.pow_le_pow_of_le_right` to `Nat.pow_le_pow_right`, protect it, remove the alias
 
--- The global `pow_le_pow_of_le_left` needs an extra hypothesis `0 ≤ x`.
-#align nat.pow_le_pow_of_le_left Nat.pow_le_pow_of_le_left
-#align nat.pow_le_pow_of_le_right Nat.pow_le_pow_of_le_right
+-- The global `pow_le_pow_left` needs an extra hypothesis `0 ≤ x`.
 
+protected alias pow_le_pow_left := pow_le_pow_of_le_left
+protected alias pow_le_pow_right := pow_le_pow_of_le_right
+#align nat.pow_le_pow_of_le_left Nat.pow_le_pow_left
+#align nat.pow_le_pow_of_le_right Nat.pow_le_pow_right
 
-theorem pow_lt_pow_of_lt_left {x y : ℕ} (H : x < y) {i} (h : 0 < i) : x ^ i < y ^ i :=
-  _root_.pow_lt_pow_of_lt_left H (zero_le _) h
-#align nat.pow_lt_pow_of_lt_left Nat.pow_lt_pow_of_lt_left
+protected theorem pow_lt_pow_left (h : x < y) (hn : n ≠ 0) : x ^ n < y ^ n :=
+  pow_lt_pow_left h (zero_le _) hn
+#align nat.pow_lt_pow_of_lt_left Nat.pow_lt_pow_left
 
-theorem pow_lt_pow_of_lt_right {x : ℕ} (H : 1 < x) {i j : ℕ} (h : i < j) : x ^ i < x ^ j :=
-  pow_lt_pow H h
-#align nat.pow_lt_pow_of_lt_right Nat.pow_lt_pow_of_lt_right
+#align nat.pow_lt_pow_of_lt_right pow_lt_pow_right
 
 theorem pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p ^ n < p ^ (n + 1) :=
-  pow_lt_pow_of_lt_right h n.lt_succ_self
+  pow_lt_pow_right h n.lt_succ_self
 #align nat.pow_lt_pow_succ Nat.pow_lt_pow_succ
 
 theorem le_self_pow {n : ℕ} (hn : n ≠ 0) : ∀ m : ℕ, m ≤ m ^ n
@@ -66,9 +69,9 @@ theorem one_le_two_pow (n : ℕ) : 1 ≤ 2 ^ n :=
   one_le_pow n 2 (by decide)
 #align nat.one_le_two_pow Nat.one_le_two_pow
 
-theorem one_lt_pow (n m : ℕ) (h₀ : 0 < n) (h₁ : 1 < m) : 1 < m ^ n := by
+theorem one_lt_pow (n m : ℕ) (h₀ : n ≠ 0) (h₁ : 1 < m) : 1 < m ^ n := by
   rw [← one_pow n]
-  exact pow_lt_pow_of_lt_left h₁ h₀
+  exact Nat.pow_lt_pow_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 
 theorem two_pow_pos (n : ℕ) : 0 < 2^n := Nat.pos_pow_of_pos _ (by decide)
@@ -76,50 +79,32 @@ theorem two_pow_pos (n : ℕ) : 0 < 2^n := Nat.pos_pow_of_pos _ (by decide)
 theorem two_pow_succ (n : ℕ) : 2^(n + 1) = 2^n + 2^n := by simp [pow_succ, mul_two]
 
 theorem one_lt_pow' (n m : ℕ) : 1 < (m + 2) ^ (n + 1) :=
-  one_lt_pow (n + 1) (m + 2) (succ_pos n) (Nat.lt_of_sub_eq_succ rfl)
+  one_lt_pow (n + 1) (m + 2) n.succ_ne_zero (Nat.lt_of_sub_eq_succ rfl)
 #align nat.one_lt_pow' Nat.one_lt_pow'
 
 @[simp]
-theorem one_lt_pow_iff {k n : ℕ} (h : 0 ≠ k) : 1 < n ^ k ↔ 1 < n := by
-  rcases n with (rfl | n)
-  · cases k <;> simp [zero_pow_eq]
-  rcases n with (rfl | n)
-  · rw [← Nat.one_eq_succ_zero, one_pow]
-  refine' ⟨fun _ => one_lt_succ_succ n, fun _ => _⟩
-  induction' k with k hk
-  · exact absurd rfl h
-  rcases k with (rfl | k)
-  · simp [← Nat.one_eq_succ_zero]
-  rw [pow_succ']
-  exact one_lt_mul (one_lt_succ_succ _).le (hk (succ_ne_zero k).symm)
+theorem one_lt_pow_iff {k n : ℕ} (h : k ≠ 0) : 1 < n ^ k ↔ 1 < n :=
+  one_lt_pow_iff_of_nonneg (zero_le _) h
 #align nat.one_lt_pow_iff Nat.one_lt_pow_iff
 
-theorem one_lt_two_pow (n : ℕ) (h₀ : 0 < n) : 1 < 2 ^ n :=
-  one_lt_pow n 2 h₀ (by decide)
+theorem one_lt_two_pow (n : ℕ) (h₀ : n ≠ 0) : 1 < 2 ^ n := one_lt_pow n 2 h₀ (by decide)
 #align nat.one_lt_two_pow Nat.one_lt_two_pow
 
 theorem one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) :=
-  one_lt_pow (n + 1) 2 (succ_pos n) (by decide)
+  one_lt_pow (n + 1) 2 n.succ_ne_zero (by decide)
 #align nat.one_lt_two_pow' Nat.one_lt_two_pow'
 
-theorem pow_right_strictMono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ => x ^ n := fun _ _ =>
-  pow_lt_pow_of_lt_right k
-#align nat.pow_right_strict_mono Nat.pow_right_strictMono
+#align nat.pow_right_strict_mono pow_right_strictMono
+#align nat.pow_le_iff_lt_right pow_le_pow_iff_right
+#align nat.pow_lt_iff_lt_right pow_lt_pow_iff_right
 
-theorem pow_le_iff_le_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m ≤ x ^ n ↔ m ≤ n :=
-  StrictMono.le_iff_le (pow_right_strictMono k)
-#align nat.pow_le_iff_le_right Nat.pow_le_iff_le_right
-
-theorem pow_lt_iff_lt_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m < x ^ n ↔ m < n :=
-  StrictMono.lt_iff_lt (pow_right_strictMono k)
-#align nat.pow_lt_iff_lt_right Nat.pow_lt_iff_lt_right
-
-theorem pow_right_injective {x : ℕ} (k : 2 ≤ x) : Function.Injective fun n : ℕ => x ^ n :=
-  StrictMono.injective (pow_right_strictMono k)
+protected lemma pow_right_injective (hx : 2 ≤ x) : Function.Injective (x ^ ·) :=
+  StrictMono.injective (pow_right_strictMono hx)
 #align nat.pow_right_injective Nat.pow_right_injective
 
-theorem pow_left_strictMono {m : ℕ} (k : 1 ≤ m) : StrictMono fun x : ℕ => x ^ m := fun _ _ h =>
-  pow_lt_pow_of_lt_left h k
+/-- See also `pow_left_strictMonoOn`. -/
+protected theorem pow_left_strictMono (hn : n ≠ 0) : StrictMono (. ^ n : ℕ → ℕ) :=
+  fun _ _ h ↦ Nat.pow_lt_pow_left h hn
 #align nat.pow_left_strict_mono Nat.pow_left_strictMono
 
 theorem mul_lt_mul_pow_succ {n a q : ℕ} (a0 : 0 < a) (q1 : 1 < q) : n * q < a * q ^ (n + 1) := by
@@ -127,25 +112,21 @@ theorem mul_lt_mul_pow_succ {n a q : ℕ} (a0 : 0 < a) (q1 : 1 < q) : n * q < a
   exact lt_mul_of_one_le_of_lt (Nat.succ_le_iff.mpr a0) (Nat.lt_pow_self q1 n)
 #align nat.mul_lt_mul_pow_succ Nat.mul_lt_mul_pow_succ
 
-end Nat
-
-theorem StrictMono.nat_pow {n : ℕ} (hn : 1 ≤ n) {f : ℕ → ℕ} (hf : StrictMono f) :
+theorem _root_.StrictMono.nat_pow {n : ℕ} (hn : n ≠ 0) {f : ℕ → ℕ} (hf : StrictMono f) :
     StrictMono fun m => f m ^ n :=
   (Nat.pow_left_strictMono hn).comp hf
 #align strict_mono.nat_pow StrictMono.nat_pow
 
-namespace Nat
-
-theorem pow_le_iff_le_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m ≤ y ^ m ↔ x ≤ y :=
-  StrictMono.le_iff_le (pow_left_strictMono k)
-#align nat.pow_le_iff_le_left Nat.pow_le_iff_le_left
+protected theorem pow_le_pow_iff_left (hm : m ≠ 0) : x ^ m ≤ y ^ m ↔ x ≤ y :=
+  pow_le_pow_iff_left (zero_le _) (zero_le _) hm
+#align nat.pow_le_iff_le_left Nat.pow_le_pow_iff_left
 
-theorem pow_lt_iff_lt_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m < y ^ m ↔ x < y :=
-  StrictMono.lt_iff_lt (pow_left_strictMono k)
-#align nat.pow_lt_iff_lt_left Nat.pow_lt_iff_lt_left
+protected theorem pow_lt_pow_iff_left (hm : m ≠ 0) : x ^ m < y ^ m ↔ x < y :=
+  pow_lt_pow_iff_left (zero_le _) (zero_le _) hm
+#align nat.pow_lt_iff_lt_left Nat.pow_lt_pow_iff_left
 
-theorem pow_left_injective {m : ℕ} (k : 1 ≤ m) : Function.Injective fun x : ℕ => x ^ m :=
-  StrictMono.injective (pow_left_strictMono k)
+theorem pow_left_injective (hm : m ≠ 0) : Function.Injective fun x : ℕ => x ^ m :=
+  (Nat.pow_left_strictMono hm).injective
 #align nat.pow_left_injective Nat.pow_left_injective
 
 theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by
@@ -203,14 +184,14 @@ theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ} (_ : 0 < x), x ^
     · intro a
       cases' x with x
       · simp
-      · have le := (pow_le_iff_le_right (Nat.le_add_left _ _)).mp a
+      · have le := (pow_le_pow_iff_right $ by simp).mp a
         use (x + 2) ^ (l - k)
         rw [← pow_add, add_comm k, tsub_add_cancel_of_le le]
 #align nat.pow_dvd_pow_iff_pow_le_pow Nat.pow_dvd_pow_iff_pow_le_pow
 
 /-- If `1 < x`, then `x^k` divides `x^l` if and only if `k` is at most `l`. -/
 theorem pow_dvd_pow_iff_le_right {x k l : ℕ} (w : 1 < x) : x ^ k ∣ x ^ l ↔ k ≤ l := by
-  rw [pow_dvd_pow_iff_pow_le_pow (lt_of_succ_lt w), pow_le_iff_le_right w]
+  rw [pow_dvd_pow_iff_pow_le_pow (lt_of_succ_lt w), pow_le_pow_iff_right w]
 #align nat.pow_dvd_pow_iff_le_right Nat.pow_dvd_pow_iff_le_right
 
 theorem pow_dvd_pow_iff_le_right' {b k l : ℕ} : (b + 2) ^ k ∣ (b + 2) ^ l ↔ k ≤ l :=
@@ -242,7 +223,7 @@ theorem pow_div {x m n : ℕ} (h : n ≤ m) (hx : 0 < x) : x ^ m / x ^ n = x ^ (
 #align nat.pow_div Nat.pow_div
 
 theorem lt_of_pow_dvd_right {p i n : ℕ} (hn : n ≠ 0) (hp : 2 ≤ p) (h : p ^ i ∣ n) : i < n := by
-  rw [← pow_lt_iff_lt_right hp]
+  rw [← pow_lt_pow_iff_right (succ_le_iff.1 hp)]
   exact lt_of_le_of_lt (le_of_dvd hn.bot_lt h) (lt_pow_self (succ_le_iff.mp hp) n)
 #align nat.lt_of_pow_dvd_right Nat.lt_of_pow_dvd_right
 
feat: theorems about power of twos (#8547)

These were factored out of #5920 as they seem generally useful.

Diff
@@ -71,6 +71,10 @@ theorem one_lt_pow (n m : ℕ) (h₀ : 0 < n) (h₁ : 1 < m) : 1 < m ^ n := by
   exact pow_lt_pow_of_lt_left h₁ h₀
 #align nat.one_lt_pow Nat.one_lt_pow
 
+theorem two_pow_pos (n : ℕ) : 0 < 2^n := Nat.pos_pow_of_pos _ (by decide)
+
+theorem two_pow_succ (n : ℕ) : 2^(n + 1) = 2^n + 2^n := by simp [pow_succ, mul_two]
+
 theorem one_lt_pow' (n m : ℕ) : 1 < (m + 2) ^ (n + 1) :=
   one_lt_pow (n + 1) (m + 2) (succ_pos n) (Nat.lt_of_sub_eq_succ rfl)
 #align nat.one_lt_pow' Nat.one_lt_pow'
feat: patch for new alias command (#6172)
Diff
@@ -149,7 +149,7 @@ theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by
   exact Nat.mul_self_sub_mul_self_eq a b
 #align nat.sq_sub_sq Nat.sq_sub_sq
 
-alias sq_sub_sq ← pow_two_sub_pow_two
+alias pow_two_sub_pow_two := sq_sub_sq
 #align nat.pow_two_sub_pow_two Nat.pow_two_sub_pow_two
 
 /-! ### `pow` and `mod` / `dvd` -/
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,14 +2,11 @@
 Copyright (c) 2014 Floris van Doorn (c) 2016 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.pow
-! leanprover-community/mathlib commit 3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.GroupPower.Order
 
+#align_import data.nat.pow from "leanprover-community/mathlib"@"3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6"
+
 /-! # `Nat.pow`
 
 Results on the power operation on natural numbers.
chore: formatting issues (#4947)

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

Diff
@@ -40,8 +40,8 @@ theorem pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p ^ n < p ^ (n + 1) :=
 #align nat.pow_lt_pow_succ Nat.pow_lt_pow_succ
 
 theorem le_self_pow {n : ℕ} (hn : n ≠ 0) : ∀ m : ℕ, m ≤ m ^ n
-| 0 => zero_le _
-| (_ + 1) => _root_.le_self_pow (le_add_left _ _) hn
+  | 0 => zero_le _
+  | (_ + 1) => _root_.le_self_pow (le_add_left _ _) hn
 #align nat.le_self_pow Nat.le_self_pow
 
 theorem lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
chore: fix #align lines (#3640)

This PR fixes two things:

  • Most align statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align). This is often seen in the mathport output after ending calc blocks.
  • All remaining more-than-one-line #align statements. (This was needed for a script I wrote for #3630.)
Diff
@@ -50,7 +50,6 @@ theorem lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
     calc
       n + 1 < p ^ n + 1 := Nat.add_lt_add_right (lt_pow_self h _) _
       _ ≤ p ^ (n + 1) := pow_lt_pow_succ h _
-
 #align nat.lt_pow_self Nat.lt_pow_self
 
 theorem lt_two_pow (n : ℕ) : n < 2 ^ n :=
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
@@ -154,6 +154,7 @@ theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by
 #align nat.sq_sub_sq Nat.sq_sub_sq
 
 alias sq_sub_sq ← pow_two_sub_pow_two
+#align nat.pow_two_sub_pow_two Nat.pow_two_sub_pow_two
 
 /-! ### `pow` and `mod` / `dvd` -/
 
feat: add Nat.le_self_pow (#1273)

This is the Lean 4 version of leanprover-community/mathlib#18022

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

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad, Mario Carneiro
 
 ! This file was ported from Lean 3 source module data.nat.pow
-! leanprover-community/mathlib commit aba57d4d3dae35460225919dcd82fe91355162f9
+! leanprover-community/mathlib commit 3e00d81bdcbf77c8188bbd18f5524ddc3ed8cac6
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -39,6 +39,11 @@ theorem pow_lt_pow_succ {p : ℕ} (h : 1 < p) (n : ℕ) : p ^ n < p ^ (n + 1) :=
   pow_lt_pow_of_lt_right h n.lt_succ_self
 #align nat.pow_lt_pow_succ Nat.pow_lt_pow_succ
 
+theorem le_self_pow {n : ℕ} (hn : n ≠ 0) : ∀ m : ℕ, m ≤ m ^ n
+| 0 => zero_le _
+| (_ + 1) => _root_.le_self_pow (le_add_left _ _) hn
+#align nat.le_self_pow Nat.le_self_pow
+
 theorem lt_pow_self {p : ℕ} (h : 1 < p) : ∀ n : ℕ, n < p ^ n
   | 0 => by simp [zero_lt_one]
   | n + 1 =>
chore: tidy various files (#1086)
Diff
@@ -10,7 +10,7 @@ Authors: Floris van Doorn, Leonardo de Moura, Jeremy Avigad, Mario Carneiro
 -/
 import Mathlib.Algebra.GroupPower.Order
 
-/-! # `nat.pow`
+/-! # `Nat.pow`
 
 Results on the power operation on natural numbers.
 -/
@@ -97,25 +97,25 @@ theorem one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) :=
   one_lt_pow (n + 1) 2 (succ_pos n) (by decide)
 #align nat.one_lt_two_pow' Nat.one_lt_two_pow'
 
-theorem pow_right_strict_mono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ => x ^ n := fun _ _ =>
+theorem pow_right_strictMono {x : ℕ} (k : 2 ≤ x) : StrictMono fun n : ℕ => x ^ n := fun _ _ =>
   pow_lt_pow_of_lt_right k
-#align nat.pow_right_strict_mono Nat.pow_right_strict_mono
+#align nat.pow_right_strict_mono Nat.pow_right_strictMono
 
 theorem pow_le_iff_le_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m ≤ x ^ n ↔ m ≤ n :=
-  StrictMono.le_iff_le (pow_right_strict_mono k)
+  StrictMono.le_iff_le (pow_right_strictMono k)
 #align nat.pow_le_iff_le_right Nat.pow_le_iff_le_right
 
 theorem pow_lt_iff_lt_right {x m n : ℕ} (k : 2 ≤ x) : x ^ m < x ^ n ↔ m < n :=
-  StrictMono.lt_iff_lt (pow_right_strict_mono k)
+  StrictMono.lt_iff_lt (pow_right_strictMono k)
 #align nat.pow_lt_iff_lt_right Nat.pow_lt_iff_lt_right
 
 theorem pow_right_injective {x : ℕ} (k : 2 ≤ x) : Function.Injective fun n : ℕ => x ^ n :=
-  StrictMono.injective (pow_right_strict_mono k)
+  StrictMono.injective (pow_right_strictMono k)
 #align nat.pow_right_injective Nat.pow_right_injective
 
-theorem pow_left_strict_mono {m : ℕ} (k : 1 ≤ m) : StrictMono fun x : ℕ => x ^ m := fun _ _ h =>
+theorem pow_left_strictMono {m : ℕ} (k : 1 ≤ m) : StrictMono fun x : ℕ => x ^ m := fun _ _ h =>
   pow_lt_pow_of_lt_left h k
-#align nat.pow_left_strict_mono Nat.pow_left_strict_mono
+#align nat.pow_left_strict_mono Nat.pow_left_strictMono
 
 theorem mul_lt_mul_pow_succ {n a q : ℕ} (a0 : 0 < a) (q1 : 1 < q) : n * q < a * q ^ (n + 1) := by
   rw [pow_succ, ← mul_assoc, mul_lt_mul_right (zero_lt_one.trans q1)]
@@ -126,21 +126,21 @@ end Nat
 
 theorem StrictMono.nat_pow {n : ℕ} (hn : 1 ≤ n) {f : ℕ → ℕ} (hf : StrictMono f) :
     StrictMono fun m => f m ^ n :=
-  (Nat.pow_left_strict_mono hn).comp hf
+  (Nat.pow_left_strictMono hn).comp hf
 #align strict_mono.nat_pow StrictMono.nat_pow
 
 namespace Nat
 
 theorem pow_le_iff_le_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m ≤ y ^ m ↔ x ≤ y :=
-  StrictMono.le_iff_le (pow_left_strict_mono k)
+  StrictMono.le_iff_le (pow_left_strictMono k)
 #align nat.pow_le_iff_le_left Nat.pow_le_iff_le_left
 
 theorem pow_lt_iff_lt_left {m x y : ℕ} (k : 1 ≤ m) : x ^ m < y ^ m ↔ x < y :=
-  StrictMono.lt_iff_lt (pow_left_strict_mono k)
+  StrictMono.lt_iff_lt (pow_left_strictMono k)
 #align nat.pow_lt_iff_lt_left Nat.pow_lt_iff_lt_left
 
 theorem pow_left_injective {m : ℕ} (k : 1 ≤ m) : Function.Injective fun x : ℕ => x ^ m :=
-  StrictMono.injective (pow_left_strict_mono k)
+  StrictMono.injective (pow_left_strictMono k)
 #align nat.pow_left_injective Nat.pow_left_injective
 
 theorem sq_sub_sq (a b : ℕ) : a ^ 2 - b ^ 2 = (a + b) * (a - b) := by
@@ -172,20 +172,21 @@ theorem mod_pow_succ {b : ℕ} (w m : ℕ) : m % b ^ succ w = b * (m / b % b ^ w
         rw [mod_eq_of_lt h₁, mod_eq_of_lt h₂]
         simp [div_add_mod]
       · -- step: p ≥ b^succ w
-      -- Generate condition for induction hypothesis
-      have h₂ : p - b ^ succ w < p := tsub_lt_self ((pow_pos b_pos _).trans_le h₁) (pow_pos b_pos _)
-      -- Apply induction
-      rw [mod_eq_sub_mod h₁, IH _ h₂]
-      -- Normalize goal and h1
-      simp only [pow_succ']
-      simp only [GE.ge, pow_succ'] at h₁
-      -- Pull subtraction outside mod and div
-      rw [sub_mul_mod h₁, sub_mul_div _ _ _ h₁]
-      -- Cancel subtraction inside mod b^w
-      have p_b_ge : b ^ w ≤ p / b := by
-        rw [le_div_iff_mul_le b_pos, mul_comm]
-        exact h₁
-      rw [Eq.symm (mod_eq_sub_mod p_b_ge)]
+        -- Generate condition for induction hypothesis
+        have h₂ : p - b ^ succ w < p :=
+          tsub_lt_self ((pow_pos b_pos _).trans_le h₁) (pow_pos b_pos _)
+        -- Apply induction
+        rw [mod_eq_sub_mod h₁, IH _ h₂]
+        -- Normalize goal and h1
+        simp only [pow_succ']
+        simp only [GE.ge, pow_succ'] at h₁
+        -- Pull subtraction outside mod and div
+        rw [sub_mul_mod h₁, sub_mul_div _ _ _ h₁]
+        -- Cancel subtraction inside mod b^w
+        have p_b_ge : b ^ w ≤ p / b := by
+          rw [le_div_iff_mul_le b_pos, mul_comm]
+          exact h₁
+        rw [Eq.symm (mod_eq_sub_mod p_b_ge)]
 #align nat.mod_pow_succ Nat.mod_pow_succ
 
 theorem pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : ∀ {x : ℕ} (_ : 0 < x), x ^ k ∣ x ^ l ↔ x ^ k ≤ x ^ l
feat port Data.Nat.Pow (#1050)

aba57d4d

Co-authored-by: Siddhartha Gadgil <siddhartha.gadgil@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Dependencies 2 + 113

114 files ported (98.3%)
47204 lines ported (99.7%)
Show graph

The unported dependencies are