Theorem: PadicInt.dvd_appr_sub_appr
File: Mathlib/NumberTheory/Padics/RingHoms.lean

Proof steps:
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m n : ℕ
h : m ≤ n
⊢ p ^ m ∣ x.appr n - x.appr m
state_after: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
h : m ≤ m + k
⊢ p ^ m ∣ x.appr (m + k) - x.appr m
tactic: obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le h
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
h : m ≤ m + k
⊢ p ^ m ∣ x.appr (m + k) - x.appr m
state_after: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
⊢ p ^ m ∣ x.appr (m + k) - x.appr m
tactic: clear h
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
⊢ p ^ m ∣ x.appr (m + k) - x.appr m
state_after: case intro.zero
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m : ℕ
⊢ p ^ m ∣ x.appr (m + 0) - x.appr m

case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣ x.appr (m + (k + 1)) - x.appr m
tactic: induction' k with k ih
state_before: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣ x.appr (m + (k + 1)) - x.appr m
state_after: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣ x.appr (m + k + 1) - x.appr m
tactic: rw [← add_assoc]
state_before: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣ x.appr (m + k + 1) - x.appr m
state_after: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣
    (if hy : x - ↑(x.appr (m + k)) = 0 then x.appr (m + k)
      else
        x.appr (m + k) +
          p ^ (m + k) * (toZMod (↑(unitCoeff hy) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val) -
      x.appr m
tactic: dsimp [appr]
state_before: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
⊢ p ^ m ∣
    (if hy : x - ↑(x.appr (m + k)) = 0 then x.appr (m + k)
      else
        x.appr (m + k) +
          p ^ (m + k) * (toZMod (↑(unitCoeff hy) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val) -
      x.appr m
state_after: case pos
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣ x.appr (m + k) - x.appr m

case neg
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣
    x.appr (m + k) +
        p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val -
      x.appr m
tactic: split_ifs with h
state_before: case neg
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣
    x.appr (m + k) +
        p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val -
      x.appr m
state_after: case neg
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣
    p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val +
      (x.appr (m + k) - x.appr m)
tactic: rw [add_comm, add_tsub_assoc_of_le (appr_mono _ (Nat.le_add_right m k))]
state_before: case neg
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣
    p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val +
      (x.appr (m + k) - x.appr m)
state_after: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣ p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val
tactic: apply dvd_add _ ih
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣ p ^ (m + k) * (toZMod (↑(unitCoeff h) * ↑p ^ ((x - ↑(x.appr (m + k))).valuation - ↑(m + k)).natAbs)).val
state_after: case h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣ p ^ (m + k)
tactic: apply dvd_mul_of_dvd_left
state_before: case h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ x.appr (m + k) - x.appr m
h : ¬x - ↑(x.appr (m + k)) = 0
⊢ p ^ m ∣ p ^ (m + k)
state_after: no goals
tactic: apply pow_dvd_pow _ (Nat.le_add_right m k)