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

tactic: obtain ⟨k, hk⟩ :=
  limNthHom_spec f_compat r _
    (show (0 : ℝ) < (p : ℝ) ^ (-n : ℤ) from Nat.zpow_pos_of_pos hp_prime.1.pos _)
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n : ℕ
⊢ ↑(lift f_compat) r - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: have := le_of_lt (hk (max n k) (le_max_right _ _))
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
⊢ ↑(lift f_compat) r - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: rw [norm_le_pow_iff_mem_span_pow] at this
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k))‖ ≤ ↑p ^ (-↑n)
⊢ ↑(lift f_compat) r - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: dsimp [lift]
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑(lift f_compat) r - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: rw [sub_eq_sub_add_sub (limNthHom f_compat r) _ ↑(nthHom f r (max n k))]
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ limNthHom f_compat r - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: apply Ideal.add_mem _ _ this
state_before: case intro
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑(nthHom f r (max n k)) - ↑(ZMod.val (↑(f n) r)) + (limNthHom f_compat r - ↑(nthHom f r (max n k))) ∈
    Ideal.span {↑p ^ n}

tactic: rw [Ideal.mem_span_singleton]
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑(nthHom f r (max n k)) - ↑(ZMod.val (↑(f n) r)) ∈ Ideal.span {↑p ^ n}

tactic: convert
  (Int.castRingHom ℤ_[p]).map_dvd (pow_dvd_nthHom_sub f_compat r n (max n k) (le_max_left _ _))
state_before: p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑p ^ n ∣ ↑(nthHom f r (max n k)) - ↑(ZMod.val (↑(f n) r))

tactic: rw [map_pow]
state_before: case h.e'_3
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑p ^ n = ↑(Int.castRingHom ℤ_[p]) (↑p ^ n)

tactic: rfl
state_before: case h.e'_3
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑p ^ n = ↑(Int.castRingHom ℤ_[p]) ↑p ^ n

tactic: rw [map_sub]
state_before: case h.e'_4
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑(nthHom f r (max n k)) - ↑(ZMod.val (↑(f n) r)) =
    ↑(Int.castRingHom ℤ_[p]) (nthHom (fun k2 => f k2) r (max n k) - nthHom (fun k2 => f k2) r n)

tactic: rfl
state_before: case h.e'_4
p : ℕ
hp_prime : Fact (Nat.Prime p)
R : Type u_1
inst✝ : NonAssocSemiring R
f : (k : ℕ) → R →+* ZMod (p ^ k)
f_compat : ∀ (k1 k2 : ℕ) (hk : k1 ≤ k2), RingHom.comp (ZMod.castHom (_ : p ^ k1 ∣ p ^ k2) (ZMod (p ^ k1))) (f k2) = f k1
r : R
n k : ℕ
hk : ∀ (n_1 : ℕ), n_1 ≥ k → ‖limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r n_1)‖ < ↑p ^ (-↑n)
this : limNthHom f_compat r - ↑(nthHom (fun k2 => f k2) r (max n k)) ∈ Ideal.span {↑p ^ n}
⊢ ↑(nthHom f r (max n k)) - ↑(ZMod.val (↑(f n) r)) =
    ↑(Int.castRingHom ℤ_[p]) (nthHom (fun k2 => f k2) r (max n k)) -
      ↑(Int.castRingHom ℤ_[p]) (nthHom (fun k2 => f k2) r n)