-- Mathlib/RingTheory/WittVector/FrobeniusFractionField.lean
theorem exists_frobenius_solution_fractionRing_aux (m n : ℕ) (r' q' : 𝕎 k) (hr' : r'.coeff 0 ≠ 0)
    (hq' : q'.coeff 0 ≠ 0) (hq : (p : 𝕎 k) ^ n * q' ∈ nonZeroDivisors (𝕎 k)) :
    let b : 𝕎 k := frobeniusRotation p hr' hq'
    IsFractionRing.ringEquivOfRingEquiv (frobeniusEquiv p k)
          (algebraMap (𝕎 k) (FractionRing (𝕎 k)) b) *
        Localization.mk ((p : 𝕎 k) ^ m * r') ⟨(p : 𝕎 k) ^ n * q', hq⟩ =
      (p : Localization (nonZeroDivisors (𝕎 k))) ^ (m - n : ℤ) *
        algebraMap (𝕎 k) (FractionRing (𝕎 k)) b

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
h : q' = 0
⊢ q'.coeff 0 = 0

Tactic:
simp [h]

Result:
no goals

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq'' : (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0
⊢ φ ((algebraMap (𝕎 k) (FractionRing (𝕎 k))) b) * Localization.mk (↑p ^ m * r') ⟨↑p ^ n * q', hq⟩ =
    ↑p ^ ↑m / ↑p ^ ↑n * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) b

Tactic:
field_simp [FractionRing.p_nonzero p k]

Result:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq'' : (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0
⊢ (algebraMap (𝕎 k) (Localization (nonZeroDivisors (𝕎 k)))) (frobenius b) *
        (↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r') *
      ↑p ^ n =
    ↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) b * (↑p ^ n * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q')

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
H :
  (fun x => x * ↑p ^ m * ↑p ^ n) (frobenius (frobeniusRotation p hr' hq') * r') =
    (fun x => x * ↑p ^ m * ↑p ^ n) (frobeniusRotation p hr' hq' * q')
⊢ frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')

Tactic:
dsimp at H

Result:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
H : frobenius (frobeniusRotation p hr' hq') * r' * ↑p ^ m * ↑p ^ n = frobeniusRotation p hr' hq' * q' * ↑p ^ m * ↑p ^ n
⊢ frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')

Proof state:
case h.e'_2
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq'' : (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0
⊢ (algebraMap (𝕎 k) (Localization (nonZeroDivisors (𝕎 k)))) (frobenius b) *
        (↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r') *
      ↑p ^ n =
    (algebraMap (𝕎 k) (FractionRing (𝕎 k))) (frobenius b) * ↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r' * ↑p ^ n

Tactic:
ring

Result:
no goals

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
⊢ let b := frobeniusRotation p hr' hq';
  φ ((algebraMap (𝕎 k) (FractionRing (𝕎 k))) b) * Localization.mk (↑p ^ m * r') ⟨↑p ^ n * q', hq⟩ =
    ↑p ^ (↑m - ↑n) * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) b

Tactic:
intro b

Result:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
⊢ φ ((algebraMap (𝕎 k) (FractionRing (𝕎 k))) b) * Localization.mk (↑p ^ m * r') ⟨↑p ^ n * q', hq⟩ =
    ↑p ^ (↑m - ↑n) * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) b

Proof state:
case h.e'_2
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq'' : (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0
⊢ (algebraMap (𝕎 k) (Localization (nonZeroDivisors (𝕎 k)))) (frobenius b) *
        (↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r') *
      ↑p ^ n =
    (algebraMap (𝕎 k) (FractionRing (𝕎 k))) (frobenius b * ↑p ^ m * r' * ↑p ^ n)

Tactic:
simp only [RingHom.map_mul, RingHom.map_pow, map_natCast, frobeniusEquiv_apply]

Result:
case h.e'_2
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq'' : (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0
⊢ (algebraMap (𝕎 k) (Localization (nonZeroDivisors (𝕎 k)))) (frobenius b) *
        (↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r') *
      ↑p ^ n =
    (algebraMap (𝕎 k) (FractionRing (𝕎 k))) (frobenius b) * ↑p ^ m * (algebraMap (𝕎 k) (FractionRing (𝕎 k))) r' * ↑p ^ n

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
⊢ (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0

Tactic:
have hq''' : q' ≠ 0 := fun h => hq' (by simp [h])

Result:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
key : frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')
hq''' : q' ≠ 0
⊢ (algebraMap (𝕎 k) (FractionRing (𝕎 k))) q' ≠ 0

Proof state:
p : ℕ
hp : Fact (Nat.Prime p)
k : Type u_1
inst✝² : Field k
inst✝¹ : CharP k p
inst✝ : IsAlgClosed k
m n : ℕ
r' q' : 𝕎 k
hr' : r'.coeff 0 ≠ 0
hq' : q'.coeff 0 ≠ 0
hq : ↑p ^ n * q' ∈ nonZeroDivisors (𝕎 k)
b : 𝕎 k := frobeniusRotation p hr' hq'
H : frobenius (frobeniusRotation p hr' hq') * r' * ↑p ^ m * ↑p ^ n = frobeniusRotation p hr' hq' * q' * ↑p ^ m * ↑p ^ n
⊢ frobenius b * ↑p ^ m * r' * ↑p ^ n = ↑p ^ m * b * (↑p ^ n * q')

Tactic:
refine (Eq.trans ?_ H).trans ?_ <;> ring

Result:
no goals