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

tactic: have : q * r = (q.num * r.num) /. (q.den * r.den) := by
  rw [Rat.mul_eq_mkRat, Rat.mkRat_eq_divInt, Nat.cast_mul]
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
state_after: 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 hq' : q.num /. q.den ≠ 0 := by rwa [Rat.num_divInt_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
state_after: 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 hr' : r.num /. r.den ≠ 0 := by rwa [Rat.num_divInt_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
state_after: 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: 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
state_after: 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: 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
state_after: 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
⊢ ↑((multiplicity (↑p) (q.num * r.num)).get ⋯) - ↑((multiplicity (↑p) (↑q.den * ↑r.den)).get ⋯) =
    padicValRat p q + padicValRat p r

tactic: conv_rhs =>
  rw [← q.num_divInt_den, padicValRat.defn p hq', ← r.num_divInt_den, 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
⊢ ↑((multiplicity (↑p) (q.num * r.num)).get ⋯) - ↑((multiplicity (↑p) (↑q.den * ↑r.den)).get ⋯) =
    padicValRat p q + padicValRat p r
state_after: 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
⊢ ↑((multiplicity (↑p) (q.num * r.num)).get ⋯) - ↑((multiplicity (↑p) (↑q.den * ↑r.den)).get ⋯) =
    ↑((multiplicity (↑p) q.num).get ⋯) - ↑((multiplicity ↑p ↑q.den).get ⋯) +
      (↑((multiplicity (↑p) r.num).get ⋯) - ↑((multiplicity ↑p ↑r.den).get ⋯))

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
⊢ ↑((multiplicity (↑p) (q.num * r.num)).get ⋯) - ↑((multiplicity (↑p) (↑q.den * ↑r.den)).get ⋯) =
    ↑((multiplicity (↑p) q.num).get ⋯) - ↑((multiplicity ↑p ↑q.den).get ⋯) +
      (↑((multiplicity (↑p) r.num).get ⋯) - ↑((multiplicity ↑p ↑r.den).get ⋯))
state_after: 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
⊢ ↑((multiplicity (↑p) q.num).get ⋯) + ↑((multiplicity (↑p) r.num).get ⋯) -
      (↑((multiplicity ↑p ↑q.den).get ⋯) + ↑((multiplicity ↑p ↑r.den).get ⋯)) =
    ↑((multiplicity (↑p) q.num).get ⋯) - ↑((multiplicity ↑p ↑q.den).get ⋯) +
      (↑((multiplicity (↑p) r.num).get ⋯) - ↑((multiplicity ↑p ↑r.den).get ⋯))

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
⊢ ↑((multiplicity (↑p) q.num).get ⋯) + ↑((multiplicity (↑p) r.num).get ⋯) -
      (↑((multiplicity ↑p ↑q.den).get ⋯) + ↑((multiplicity ↑p ↑r.den).get ⋯)) =
    ↑((multiplicity (↑p) q.num).get ⋯) - ↑((multiplicity ↑p ↑q.den).get ⋯) +
      (↑((multiplicity (↑p) r.num).get ⋯) - ↑((multiplicity ↑p ↑r.den).get ⋯))
state_after: no goals

tactic: rw [Rat.mul_eq_mkRat, Rat.mkRat_eq_divInt, Nat.cast_mul]
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)
state_after: no goals

tactic: rwa [Rat.num_divInt_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
state_after: no goals

tactic: rwa [Rat.num_divInt_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
state_after: no goals