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

tactic: induction' n with n ih generalizing x
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: 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]
⊢ 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: 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]
⊢ (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: split_ifs with h
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: simp only [appr, zero_eq, _root_.pow_zero, zero_lt_one]
state_before: case zero
p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ x : ℤ_[p]
⊢ x.appr 0 < p ^ 0
state_after: no goals

tactic: apply pow_lt_pow_right hp_prime.1.one_lt (lt_add_one n)
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
r : ℚ
x✝ : ℤ_[p]
n : ℕ
ih : ∀ (x : ℤ_[p]), x.appr n < p ^ n
x : ℤ_[p]
⊢ p ^ n < p ^ (n + 1)
state_after: no goals

tactic: apply lt_trans (ih _) hp
state_before: 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)
state_after: no goals

tactic: calc
  _ < p ^ n + p ^ n * (p - 1) := ?_
  _ = p ^ (n + 1) := ?_
state_before: 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)
state_after: case neg.calc_1
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 + p ^ n * (p - 1)

case neg.calc_2
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
⊢ p ^ n + p ^ n * (p - 1) = p ^ (n + 1)

tactic: apply add_lt_add_of_lt_of_le (ih _)
state_before: case neg.calc_1
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 + p ^ n * (p - 1)
state_after: case neg.calc_1
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
⊢ 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 * (p - 1)

tactic: apply Nat.mul_le_mul_left
state_before: case neg.calc_1
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
⊢ 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 * (p - 1)
state_after: case neg.calc_1.h
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
⊢ (toZMod ↑(unitCoeff ⋯) *
        0 ^
          match (x - ↑(x.appr n)).valuation - ↑n with
          | Int.ofNat m => m
          | Int.negSucc m => m.succ).val ≤
    p - 1

tactic: apply le_pred_of_lt
state_before: case neg.calc_1.h
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
⊢ (toZMod ↑(unitCoeff ⋯) *
        0 ^
          match (x - ↑(x.appr n)).valuation - ↑n with
          | Int.ofNat m => m
          | Int.negSucc m => m.succ).val ≤
    p - 1
state_after: case neg.calc_1.h.h
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
⊢ (toZMod ↑(unitCoeff ⋯) *
        0 ^
          match (x - ↑(x.appr n)).valuation - ↑n with
          | Int.ofNat m => m
          | Int.negSucc m => m.succ).val <
    p.sub 0

tactic: apply ZMod.val_lt
state_before: case neg.calc_1.h.h
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
⊢ (toZMod ↑(unitCoeff ⋯) *
        0 ^
          match (x - ↑(x.appr n)).valuation - ↑n with
          | Int.ofNat m => m
          | Int.negSucc m => m.succ).val <
    p.sub 0
state_after: no goals

tactic: rw [mul_tsub, mul_one, ← _root_.pow_succ]
state_before: case neg.calc_2
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
⊢ p ^ n + p ^ n * (p - 1) = p ^ (n + 1)
state_after: case neg.calc_2
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
⊢ p ^ n + (p ^ (n + 1) - p ^ n) = p ^ (n + 1)

tactic: apply add_tsub_cancel_of_le (le_of_lt hp)
state_before: case neg.calc_2
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
⊢ p ^ n + (p ^ (n + 1) - p ^ n) = p ^ (n + 1)
state_after: no goals