Theorem: multiplicity.Int.pow_sub_pow
File: Mathlib/NumberTheory/Multiplicity.lean

tactic: cases' n with n
state_before: R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
⊢ multiplicity (↑p) (x ^ n - y ^ n) = multiplicity (↑p) (x - y) + multiplicity p n
state_after: case zero
R : Type u_1
n : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
⊢ multiplicity (↑p) (x ^ 0 - y ^ 0) = multiplicity (↑p) (x - y) + multiplicity p 0

case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: have h : (multiplicity _ _).Dom := finite_nat_iff.mpr ⟨hp.ne_one, n.succ_pos⟩
state_before: case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p n.succ).Dom
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: simp only [Nat.succ_eq_add_one] at h
state_before: case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p n.succ).Dom
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: rcases eq_coe_iff.mp (PartENat.natCast_get h).symm with ⟨⟨k, hk⟩, hpn⟩
state_before: case succ
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: conv_lhs => rw [hk, pow_mul, pow_mul]
state_before: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) (x ^ (n + 1) - y ^ (n + 1)) = multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) ((x ^ p ^ (multiplicity p (n + 1)).get h) ^ k - (y ^ p ^ (multiplicity p (n + 1)).get h) ^ k) =
    multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: rw [Nat.prime_iff_prime_int] at hp
state_before: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) ((x ^ p ^ (multiplicity p (n + 1)).get h) ^ k - (y ^ p ^ (multiplicity p (n + 1)).get h) ^ k) =
    multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) ((x ^ p ^ (multiplicity p (n + 1)).get h) ^ k - (y ^ p ^ (multiplicity p (n + 1)).get h) ^ k) =
    multiplicity (↑p) (x - y) + multiplicity p (n + 1)

tactic: rw [pow_sub_pow_of_prime hp, pow_prime_pow_sub_pow_prime_pow hp hp1 hxy hx, PartENat.natCast_get]
state_before: case succ.intro.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ multiplicity (↑p) ((x ^ p ^ (multiplicity p (n + 1)).get h) ^ k - (y ^ p ^ (multiplicity p (n + 1)).get h) ^ k) =
    multiplicity (↑p) (x - y) + multiplicity p (n + 1)
state_after: case succ.intro.intro.hxy
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ↑p ∣ x ^ p ^ (multiplicity p (n + 1)).get h - y ^ p ^ (multiplicity p (n + 1)).get h

case succ.intro.intro.hx
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬↑p ∣ x ^ p ^ (multiplicity p (n + 1)).get h

case succ.intro.intro.hn
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬↑p ∣ ↑k

tactic: simp only [multiplicity.zero, add_top, pow_zero, sub_self, Nat.zero_eq]
state_before: case zero
R : Type u_1
n : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Nat.Prime p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
⊢ multiplicity (↑p) (x ^ 0 - y ^ 0) = multiplicity (↑p) (x - y) + multiplicity p 0
state_after: no goals

tactic: rw [← geom_sum₂_mul]
state_before: case succ.intro.intro.hxy
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ↑p ∣ x ^ p ^ (multiplicity p (n + 1)).get h - y ^ p ^ (multiplicity p (n + 1)).get h
state_after: case succ.intro.intro.hxy
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ↑p ∣
    (∑ i ∈ range (p ^ (multiplicity p (n + 1)).get h), x ^ i * y ^ (p ^ (multiplicity p (n + 1)).get h - 1 - i)) *
      (x - y)

tactic: exact dvd_mul_of_dvd_right hxy _
state_before: case succ.intro.intro.hxy
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ↑p ∣
    (∑ i ∈ range (p ^ (multiplicity p (n + 1)).get h), x ^ i * y ^ (p ^ (multiplicity p (n + 1)).get h - 1 - i)) *
      (x - y)
state_after: no goals

tactic: exact fun h => hx (hp.dvd_of_dvd_pow h)
state_before: case succ.intro.intro.hx
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬↑p ∣ x ^ p ^ (multiplicity p (n + 1)).get h
state_after: no goals

tactic: rw [Int.natCast_dvd_natCast]
state_before: case succ.intro.intro.hn
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬↑p ∣ ↑k
state_after: case succ.intro.intro.hn
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬p ∣ k

tactic: rintro ⟨c, rfl⟩
state_before: case succ.intro.intro.hn
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
k : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * k
⊢ ¬p ∣ k
state_after: case succ.intro.intro.hn.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
c : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * (p * c)
⊢ False

tactic: refine hpn ⟨c, ?_⟩
state_before: case succ.intro.intro.hn.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
c : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * (p * c)
⊢ False
state_after: case succ.intro.intro.hn.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
c : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * (p * c)
⊢ n + 1 = p ^ ((multiplicity p (n + 1)).get h + 1) * c

tactic: rwa [pow_succ, mul_assoc]
state_before: case succ.intro.intro.hn.intro
R : Type u_1
n✝ : ℕ
inst✝ : CommRing R
a b x✝ y✝ : R
p : ℕ
hp : Prime ↑p
hp1 : Odd p
x y : ℤ
hxy : ↑p ∣ x - y
hx : ¬↑p ∣ x
n : ℕ
h : (multiplicity p (n + 1)).Dom
hpn : ¬p ^ ((multiplicity p (n + 1)).get h + 1) ∣ n + 1
c : ℕ
hk : n + 1 = p ^ (multiplicity p (n + 1)).get h * (p * c)
⊢ n + 1 = p ^ ((multiplicity p (n + 1)).get h + 1) * c
state_after: no goals