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

tactic: simp_all
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hn : n = 0
⊢ False

tactic: simp_all
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d = 0
⊢ False

tactic: have hd : d ≠ 0 := Rat.mk_denom_ne_zero_of_ne_zero hqz qdf
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
⊢ padicValRat p q =
    ↑(Part.get (multiplicity (↑p) n) (_ : multiplicity.Finite (↑p) n)) -
      ↑(Part.get (multiplicity (↑p) d) (_ : multiplicity.Finite (↑p) d))

tactic: let ⟨c, hc1, hc2⟩ := Rat.num_den_mk hd qdf
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
⊢ padicValRat p q =
    ↑(Part.get (multiplicity (↑p) n) (_ : multiplicity.Finite (↑p) n)) -
      ↑(Part.get (multiplicity (↑p) d) (_ : multiplicity.Finite (↑p) d))

tactic: rw [padicValRat.multiplicity_sub_multiplicity hp.1.ne_one hqz]
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ padicValRat p q =
    ↑(Part.get (multiplicity (↑p) n) (_ : multiplicity.Finite (↑p) n)) -
      ↑(Part.get (multiplicity (↑p) d) (_ : multiplicity.Finite (↑p) d))

tactic: simp only [Nat.isUnit_iff, hc1, hc2]
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)) =
    ↑(Part.get (multiplicity (↑p) n) (_ : multiplicity.Finite (↑p) n)) -
      ↑(Part.get (multiplicity (↑p) d) (_ : multiplicity.Finite (↑p) d))

tactic: rw [multiplicity.mul' (Nat.prime_iff_prime_int.1 hp.1),
  multiplicity.mul' (Nat.prime_iff_prime_int.1 hp.1)]
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)) =
    ↑(Part.get (multiplicity (↑p) (c * q.num)) (_ : (multiplicity (↑p) (c * q.num)).Dom)) -
      ↑(Part.get (multiplicity (↑p) (c * ↑q.den)) (_ : (multiplicity (↑p) (c * ↑q.den)).Dom))

tactic: rw [Nat.cast_add, Nat.cast_add]
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)) =
    ↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c) +
          Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c) +
          Part.get (multiplicity ↑p ↑q.den) (_ : multiplicity.Finite ↑p ↑q.den))

tactic: simp_rw [Int.coe_nat_multiplicity p q.den]
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)) =
    ↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c)) +
        ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      (↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c)) +
        ↑(Part.get (multiplicity ↑p ↑q.den) (_ : multiplicity.Finite ↑p ↑q.den)))

tactic: ring
state_before: p✝ : ℕ
hp✝ : Fact (Nat.Prime p✝)
p : ℕ
hp : Fact (Nat.Prime p)
q : ℚ
n d : ℤ
hqz : q ≠ 0
qdf : q = n /. d
hd : d ≠ 0
c : ℤ
hc1 : n = c * q.num
hc2 : d = c * ↑q.den
⊢ ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)) =
    ↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c)) +
        ↑(Part.get (multiplicity (↑p) q.num) (_ : multiplicity.Finite (↑p) q.num)) -
      (↑(Part.get (multiplicity (↑p) c) (_ : multiplicity.Finite (↑p) c)) +
        ↑(Part.get (multiplicity p q.den) (_ : (multiplicity p q.den).Dom)))