Theorem: PadicInt.mem_span_pow_iff_le_valuation
File: Mathlib/NumberTheory/Padics/PadicIntegers.lean

tactic: rw [Ideal.mem_span_singleton]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ x ∈ Ideal.span {↑p ^ n} ↔ ↑n ≤ x.valuation
state_after: p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑p ^ n ∣ x ↔ ↑n ≤ x.valuation

tactic: constructor
state_before: p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑p ^ n ∣ x ↔ ↑n ≤ x.valuation
state_after: case mp
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑p ^ n ∣ x → ↑n ≤ x.valuation

case mpr
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑n ≤ x.valuation → ↑p ^ n ∣ x

tactic: rintro ⟨c, rfl⟩
state_before: case mp
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑p ^ n ∣ x → ↑n ≤ x.valuation
state_after: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
⊢ ↑n ≤ (↑p ^ n * c).valuation

tactic: suffices c ≠ 0 by
  rw [valuation_p_pow_mul _ _ this, le_add_iff_nonneg_right]
  apply valuation_nonneg
state_before: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
⊢ ↑n ≤ (↑p ^ n * c).valuation
state_after: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
⊢ c ≠ 0

tactic: contrapose! hx
state_before: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
⊢ c ≠ 0
state_after: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : c = 0
⊢ ↑p ^ n * c = 0

tactic: rw [hx, mul_zero]
state_before: case mp.intro
p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : c = 0
⊢ ↑p ^ n * c = 0
state_after: no goals

tactic: rw [valuation_p_pow_mul _ _ this, le_add_iff_nonneg_right]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
this : c ≠ 0
⊢ ↑n ≤ (↑p ^ n * c).valuation
state_after: p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
this : c ≠ 0
⊢ 0 ≤ c.valuation

tactic: apply valuation_nonneg
state_before: p : ℕ
hp : Fact (Nat.Prime p)
n : ℕ
c : ℤ_[p]
hx : ↑p ^ n * c ≠ 0
this : c ≠ 0
⊢ 0 ≤ c.valuation
state_after: no goals

tactic: nth_rewrite 2 [unitCoeff_spec hx]
state_before: case mpr
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑n ≤ x.valuation → ↑p ^ n ∣ x
state_after: case mpr
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑n ≤ x.valuation → ↑p ^ n ∣ ↑(unitCoeff hx) * ↑p ^ x.valuation.natAbs

tactic: lift x.valuation to ℕ using x.valuation_nonneg with k
state_before: case mpr
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n : ℕ
⊢ ↑n ≤ x.valuation → ↑p ^ n ∣ ↑(unitCoeff hx) * ↑p ^ x.valuation.natAbs
state_after: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
⊢ ↑n ≤ ↑k → ↑p ^ n ∣ ↑(unitCoeff hx) * ↑p ^ (↑k).natAbs

tactic: simp only [Int.natAbs_ofNat, Units.isUnit, IsUnit.dvd_mul_left, Int.ofNat_le]
state_before: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
⊢ ↑n ≤ ↑k → ↑p ^ n ∣ ↑(unitCoeff hx) * ↑p ^ (↑k).natAbs
state_after: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
⊢ n ≤ k → ↑p ^ n ∣ ↑p ^ k

tactic: intro H
state_before: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
⊢ n ≤ k → ↑p ^ n ∣ ↑p ^ k
state_after: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
H : n ≤ k
⊢ ↑p ^ n ∣ ↑p ^ k

tactic: obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le H
state_before: case mpr.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
H : n ≤ k
⊢ ↑p ^ n ∣ ↑p ^ k
state_after: case mpr.intro.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
H : n ≤ n + k
⊢ ↑p ^ n ∣ ↑p ^ (n + k)

tactic: simp only [pow_add, dvd_mul_right]
state_before: case mpr.intro.intro
p : ℕ
hp : Fact (Nat.Prime p)
x : ℤ_[p]
hx : x ≠ 0
n k : ℕ
H : n ≤ n + k
⊢ ↑p ^ n ∣ ↑p ^ (n + k)
state_after: no goals