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

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

tactic: clear h
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
h : m ≤ m + k
⊢ p ^ m ∣ appr x (m + k) - appr x m

tactic: induction' k with k ih
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
⊢ p ^ m ∣ appr x (m + k) - appr x m

tactic: rw [Nat.succ_eq_add_one, ← add_assoc]
state_before: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
⊢ p ^ m ∣ appr x (m + succ k) - appr x 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 ∣ appr x (m + k) - appr x m
⊢ p ^ m ∣ appr x (m + k + 1) - appr x m

tactic: split_ifs with h
state_before: case intro.succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
⊢ p ^ m ∣
    (if hy : x - ↑(appr x (m + k + 0)) = 0 then appr x (m + k + 0)
      else
        appr x (m + k + 0) +
          p ^ (m + k + 0) *
            ZMod.val
              (↑toZMod (↑(unitCoeff hy) * ↑p ^ Int.natAbs (valuation (x - ↑(appr x (m + k + 0))) - ↑(m + k + 0))))) -
      appr x m

tactic: dsimp
state_before: case intro.succ.inr
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : ¬x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣
    appr x (m + k + 0) +
        p ^ (m + k + 0) *
          ZMod.val
            (↑toZMod
              (↑(unitCoeff (_ : ¬x - ↑(appr x (m + k + 0)) = 0)) *
                ↑p ^ Int.natAbs (valuation (x - ↑(appr x (m + k + 0))) - ↑(m + k + 0)))) -
      appr x m

tactic: rw [add_comm, add_tsub_assoc_of_le (appr_mono _ (Nat.le_add_right m k))]
state_before: case intro.succ.inr
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : ¬x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣
    appr x (m + k) +
        p ^ (m + k) *
          ZMod.val
            (↑toZMod
              (↑(unitCoeff (_ : ¬x - ↑(appr x (m + k + 0)) = 0)) *
                ↑p ^ Int.natAbs (valuation (x - ↑(appr x (m + k))) - ↑(m + k)))) -
      appr x m

tactic: apply dvd_add _ ih
state_before: case intro.succ.inr
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : ¬x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣
    p ^ (m + k) *
        ZMod.val
          (↑toZMod
            (↑(unitCoeff (_ : ¬x - ↑(appr x (m + k + 0)) = 0)) *
              ↑p ^ Int.natAbs (valuation (x - ↑(appr x (m + k))) - ↑(m + k)))) +
      (appr x (m + k) - appr x m)

tactic: apply dvd_mul_of_dvd_left
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : ¬x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣
    p ^ (m + k) *
      ZMod.val
        (↑toZMod
          (↑(unitCoeff (_ : ¬x - ↑(appr x (m + k + 0)) = 0)) *
            ↑p ^ Int.natAbs (valuation (x - ↑(appr x (m + k))) - ↑(m + k))))

tactic: apply pow_dvd_pow _ (Nat.le_add_right m k)
state_before: case h
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : ¬x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣ p ^ (m + k)

tactic: simp only [zero_eq, add_zero, le_refl, tsub_eq_zero_of_le, ne_eq, Nat.isUnit_iff, dvd_zero]
state_before: case intro.zero
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m : ℕ
⊢ p ^ m ∣ appr x (m + zero) - appr x m

tactic: exact ih
state_before: case intro.succ.inl
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
m k : ℕ
ih : p ^ m ∣ appr x (m + k) - appr x m
h : x - ↑(appr x (m + k + 0)) = 0
⊢ p ^ m ∣ appr x (m + k + 0) - appr x m