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

Proof steps:
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
n : ℕ
⊢ x.appr n < p ^ n
state_after: case zero
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
⊢ x.appr 0 < p ^ 0

case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
⊢ x.appr (n + 1) < p ^ (n + 1)
tactic: induction' n with n ih generalizing x
state_before: case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
⊢ x.appr (n + 1) < p ^ (n + 1)
state_after: case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
⊢ (if h : x - ↑(x.appr n) = 0 then x.appr n
    else
      x.appr n +
        p ^ n *
          (toZMod ↑(unitCoeff ⋯) *
              0 ^
                match (x - ↑(x.appr n)).valuation - ↑n with
                | Int.ofNat m => m
                | Int.negSucc m => m.succ).val) <
    p ^ (n + 1)
tactic: simp only [appr, map_natCast, ZMod.natCast_self, RingHom.map_pow, Int.natAbs, RingHom.map_mul]
state_before: case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
⊢ (if h : x - ↑(x.appr n) = 0 then x.appr n
    else
      x.appr n +
        p ^ n *
          (toZMod ↑(unitCoeff ⋯) *
              0 ^
                match (x - ↑(x.appr n)).valuation - ↑n with
                | Int.ofNat m => m
                | Int.negSucc m => m.succ).val) <
    p ^ (n + 1)
state_after: case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
hp : p ^ n < p ^ (n + 1)
⊢ (if h : x - ↑(x.appr n) = 0 then x.appr n
    else
      x.appr n +
        p ^ n *
          (toZMod ↑(unitCoeff ⋯) *
              0 ^
                match (x - ↑(x.appr n)).valuation - ↑n with
                | Int.ofNat m => m
                | Int.negSucc m => m.succ).val) <
    p ^ (n + 1)
tactic: have hp : p ^ n < p ^ (n + 1) := by apply pow_lt_pow_right hp_prime.1.one_lt (lt_add_one n)
state_before: case succ
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
hp : p ^ n < p ^ (n + 1)
⊢ (if h : x - ↑(x.appr n) = 0 then x.appr n
    else
      x.appr n +
        p ^ n *
          (toZMod ↑(unitCoeff ⋯) *
              0 ^
                match (x - ↑(x.appr n)).valuation - ↑n with
                | Int.ofNat m => m
                | Int.negSucc m => m.succ).val) <
    p ^ (n + 1)
state_after: case pos
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
hp : p ^ n < p ^ (n + 1)
h : x - ↑(x.appr n) = 0
⊢ x.appr n < p ^ (n + 1)

case neg
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
hp : p ^ n < p ^ (n + 1)
h : ¬x - ↑(x.appr n) = 0
⊢ x.appr n +
      p ^ n *
        (toZMod ↑(unitCoeff ⋯) *
            0 ^
              match (x - ↑(x.appr n)).valuation - ↑n with
              | Int.ofNat m => m
              | Int.negSucc m => m.succ).val <
    p ^ (n + 1)
tactic: split_ifs with h