Theorem: padicValRat.mul
File: Mathlib/NumberTheory/Padics/PadicVal.lean

tactic: have : q * r = q.num * r.num /. (q.den * r.den) := by rw_mod_cast [Rat.mul_num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
⊢ padicValRat p (q * r) = padicValRat p q + padicValRat p r

tactic: have hq' : q.num /. q.den ≠ 0 := by rwa [Rat.num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
⊢ padicValRat p (q * r) = padicValRat p q + padicValRat p r

tactic: have hr' : r.num /. r.den ≠ 0 := by rwa [Rat.num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
⊢ padicValRat p (q * r) = padicValRat p q + padicValRat p r

tactic: have hp' : Prime (p : ℤ) := Nat.prime_iff_prime_int.1 hp.1
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
hr' : r.num /. ↑r.den ≠ 0
⊢ padicValRat p (q * r) = padicValRat p q + padicValRat p r

tactic: rw [padicValRat.defn p (mul_ne_zero hq hr) this]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
hr' : r.num /. ↑r.den ≠ 0
hp' : _root_.Prime ↑p
⊢ padicValRat p (q * r) = padicValRat p q + padicValRat p r

tactic: conv_rhs =>
  rw [← @Rat.num_den q, padicValRat.defn p hq', ← @Rat.num_den r, padicValRat.defn p hr']
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
hr' : r.num /. ↑r.den ≠ 0
hp' : _root_.Prime ↑p
⊢ ↑(Part.get (multiplicity (↑p) (q.num * r.num)) (_ : multiplicity.Finite (↑p) (q.num * r.num))) -
      ↑(Part.get (multiplicity (↑p) (↑q.den * ↑r.den)) (_ : multiplicity.Finite (↑p) (↑q.den * ↑r.den))) =
    padicValRat p q + padicValRat p r

tactic: rw [multiplicity.mul' hp', multiplicity.mul' hp', Nat.cast_add, Nat.cast_add]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
hr' : r.num /. ↑r.den ≠ 0
hp' : _root_.Prime ↑p
⊢ ↑(Part.get (multiplicity (↑p) (q.num * r.num)) (_ : multiplicity.Finite (↑p) (q.num * r.num))) -
      ↑(Part.get (multiplicity (↑p) (↑q.den * ↑r.den)) (_ : multiplicity.Finite (↑p) (↑q.den * ↑r.den))) =
    ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
        ↑(Part.get (multiplicity ↑p ↑q.den) (_ : multiplicity.Finite ↑p ↑q.den)) +
      (↑(Part.get (multiplicity (↑p) r.num) (_ : multiplicity.Finite (↑p) r.num)) -
        ↑(Part.get (multiplicity ↑p ↑r.den) (_ : multiplicity.Finite ↑p ↑r.den)))

tactic: ring
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
hr' : r.num /. ↑r.den ≠ 0
hp' : _root_.Prime ↑p
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) +
        ↑(Part.get (multiplicity (↑p) r.num) (_ : multiplicity.Finite (↑p) r.num)) -
      (↑(Part.get (multiplicity ↑p ↑q.den) (_ : multiplicity.Finite ↑p ↑q.den)) +
        ↑(Part.get (multiplicity ↑p ↑r.den) (_ : multiplicity.Finite ↑p ↑r.den))) =
    ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
        ↑(Part.get (multiplicity ↑p ↑q.den) (_ : multiplicity.Finite ↑p ↑q.den)) +
      (↑(Part.get (multiplicity (↑p) r.num) (_ : multiplicity.Finite (↑p) r.num)) -
        ↑(Part.get (multiplicity ↑p ↑r.den) (_ : multiplicity.Finite ↑p ↑r.den)))

tactic: rw_mod_cast [Rat.mul_num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
⊢ q * r = q.num * r.num /. (↑q.den * ↑r.den)

tactic: rwa [Rat.num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
⊢ q.num /. ↑q.den ≠ 0

tactic: rwa [Rat.num_den]
state_before: p : ℕ
hp : Fact (Nat.Prime p)
q r : ℚ
hq : q ≠ 0
hr : r ≠ 0
this : q * r = q.num * r.num /. (↑q.den * ↑r.den)
hq' : q.num /. ↑q.den ≠ 0
⊢ r.num /. ↑r.den ≠ 0