l3lab/ntp-mathlib huggingface dataset:
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑(n₁ * n₂) / ↑(↑d₁ * ↑d₂) = ↑n₁ / ↑↑d₁ * (↑n₂ / ↑↑d₂)

Next tactic:
simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
      

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑↑d₂ ≠ 0
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑↑d₁ ≠ 0
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑(↑d₁ * ↑d₂) ≠ 0

Next tactic:
all_goals simp [d₁0, d₂0]
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
      all_goals 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑↑d₂ ≠ 0

Next tactic:
simp [d₁0, d₂0]
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
      all_goals 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑↑d₁ ≠ 0

Next tactic:
simp [d₁0, d₂0]
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
      all_goals 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
this : ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))
⊢ ↑(↑d₁ * ↑d₂) ≠ 0

Next tactic:
simp [d₁0, d₂0]
@[norm_cast]
theorem cast_mul_of_ne_zero :
    ∀ {m n : ℚ}, (m.den : α) ≠ 0 → (n.den : α) ≠ 0 → ((m * n : ℚ) : α) = m * n
  | ⟨n₁, d₁, h₁, c₁⟩, ⟨n₂, d₂, h₂, c₂⟩ => fun (d₁0 : (d₁ : α) ≠ 0) (d₂0 : (d₂ : α) ≠ 0) => by
    have d₁0' : (d₁ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₁0; exact d₁0 Nat.cast_zero
    have d₂0' : (d₂ : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d₂0; exact d₂0 Nat.cast_zero
    rw [num_den', num_den', mul_def' d₁0' d₂0']
    suffices (n₁ * (n₂ * (d₂ : α)⁻¹ * (d₁ : α)⁻¹) : α) = n₁ * ((d₁ : α)⁻¹ * (n₂ * (d₂ : α)⁻¹)) by
      rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, cast_mk_of_ne_zero]
      · simpa [division_def, mul_inv_rev, d₁0, d₂0, mul_assoc]
      all_goals simp [d₁0, d₂0]
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n₁ : ℤ
d₁ : ℕ
h₁ : d₁ ≠ 0
c₁ : Nat.Coprime (Int.natAbs n₁) d₁
n₂ : ℤ
d₂ : ℕ
h₂ : d₂ ≠ 0
c₂ : Nat.Coprime (Int.natAbs n₂) d₂
d₁0 : ↑d₁ ≠ 0
d₂0 : ↑d₂ ≠ 0
d₁0' : ↑d₁ ≠ 0
d₂0' : ↑d₂ ≠ 0
⊢ ↑n₁ * (↑n₂ * (↑d₂)⁻¹ * (↑d₁)⁻¹) = ↑n₁ * ((↑d₁)⁻¹ * (↑n₂ * (↑d₂)⁻¹))

Next tactic:
rw [(d₁.commute_cast (_ : α)).inv_right₀.eq]
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
⊢ ↑(mk' n d)⁻¹ = (↑(mk' n d))⁻¹

Next tactic:
have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
e : n = 0
⊢ False

Next tactic:
rw [e] at n0
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑0 ≠ 0
d0 : ↑d ≠ 0
e : n = 0
⊢ False

Next tactic:
exact n0 Int.cast_zero
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝ : n ≠ 0
⊢ ↑(mk' n d)⁻¹ = (↑(mk' n d))⁻¹

Next tactic:
have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; exact d0 Nat.cast_zero
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝ : n ≠ 0
e : d = 0
⊢ False

Next tactic:
rw [e] at d0
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑0 ≠ 0
x✝ : n ≠ 0
e : d = 0
⊢ False

Next tactic:
exact d0 Nat.cast_zero
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; exact d0 Nat.cast_zero
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝¹ : n ≠ 0
x✝ : ↑d ≠ 0
⊢ ↑(mk' n d)⁻¹ = (↑(mk' n d))⁻¹

Next tactic:
rw [num_den', inv_def']
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; exact d0 Nat.cast_zero
    rw [num_den', inv_def']
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝¹ : n ≠ 0
x✝ : ↑d ≠ 0
⊢ ↑(↑d /. n) = (↑(n /. ↑d))⁻¹

Next tactic:
rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, inv_div]
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; exact d0 Nat.cast_zero
    rw [num_den', inv_def']
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, inv_div] <;> 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝¹ : n ≠ 0
x✝ : ↑d ≠ 0
⊢ ↑↑d ≠ 0

Next tactic:
simp [n0, d0]
@[norm_cast]
theorem cast_inv_of_ne_zero :
    ∀ {n : ℚ}, (n.num : α) ≠ 0 → (n.den : α) ≠ 0 → ((n⁻¹ : ℚ) : α) = (n : α)⁻¹
  | ⟨n, d, h, c⟩ => fun (n0 : (n : α) ≠ 0) (d0 : (d : α) ≠ 0) => by
    have _ : (n : ℤ) ≠ 0 := fun e => by rw [e] at n0; exact n0 Int.cast_zero
    have _ : (d : ℤ) ≠ 0 :=
      Int.coe_nat_ne_zero.2 fun e => by rw [e] at d0; exact d0 Nat.cast_zero
    rw [num_den', inv_def']
    rw [cast_mk_of_ne_zero, cast_mk_of_ne_zero, inv_div] <;> 

Proof state:
case b0
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
n : ℤ
d : ℕ
h : d ≠ 0
c : Nat.Coprime (Int.natAbs n) d
n0 : ↑n ≠ 0
d0 : ↑d ≠ 0
x✝¹ : n ≠ 0
x✝ : ↑d ≠ 0
⊢ ↑n ≠ 0

Next tactic:
simp [n0, d0]
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
⊢ ↑(m / n) = ↑m / ↑n

Next tactic:
have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
⊢ ↑n⁻¹.den ∣ n.num

Next tactic:
conv in n⁻¹.den => rw [← @num_den n, inv_def']
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
| n⁻¹.den

Next tactic:
rw [← @num_den n, inv_def']
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
⊢ ↑(↑n.den /. n.num).den ∣ n.num

Next tactic:
apply den_dvd
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
this : ↑n⁻¹.den ∣ n.num
⊢ ↑(m / n) = ↑m / ↑n

Next tactic:
have : (n⁻¹.den : α) = 0 → (n.num : α) = 0 := fun h => by
    let ⟨k, e⟩ := this
    have := congr_arg ((↑) : ℤ → α) e; rwa [Int.cast_mul, Int.cast_ofNat, h, zero_mul] at this
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
  have : (n⁻¹.den : α) = 0 → (n.num : α) = 0 := fun h => by
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
this : ↑n⁻¹.den ∣ n.num
h : ↑n⁻¹.den = 0
⊢ ↑n.num = 0

Next tactic:
let ⟨k, e⟩ := this
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
  have : (n⁻¹.den : α) = 0 → (n.num : α) = 0 := fun h => by
    let ⟨k, e⟩ := this
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
this : ↑n⁻¹.den ∣ n.num
h : ↑n⁻¹.den = 0
k : ℤ
e : n.num = ↑n⁻¹.den * k
⊢ ↑n.num = 0

Next tactic:
have := congr_arg ((↑) : ℤ → α) e
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
  have : (n⁻¹.den : α) = 0 → (n.num : α) = 0 := fun h => by
    let ⟨k, e⟩ := this
    have := congr_arg ((↑) : ℤ → α) e; 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
this✝ : ↑n⁻¹.den ∣ n.num
h : ↑n⁻¹.den = 0
k : ℤ
e : n.num = ↑n⁻¹.den * k
this : ↑n.num = ↑(↑n⁻¹.den * k)
⊢ ↑n.num = 0

Next tactic:
rwa [Int.cast_mul, Int.cast_ofNat, h, zero_mul] at this
@[norm_cast]
theorem cast_div_of_ne_zero {m n : ℚ} (md : (m.den : α) ≠ 0) (nn : (n.num : α) ≠ 0)
    (nd : (n.den : α) ≠ 0) : ((m / n : ℚ) : α) = m / n := by
  have : (n⁻¹.den : ℤ) ∣ n.num := by
    conv in n⁻¹.den => rw [← @num_den n, inv_def']
    apply den_dvd
  have : (n⁻¹.den : α) = 0 → (n.num : α) = 0 := fun h => by
    let ⟨k, e⟩ := this
    have := congr_arg ((↑) : ℤ → α) e; rwa [Int.cast_mul, Int.cast_ofNat, h, zero_mul] at this
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝ : DivisionRing α
m n : ℚ
md : ↑m.den ≠ 0
nn : ↑n.num ≠ 0
nd : ↑n.den ≠ 0
this✝ : ↑n⁻¹.den ∣ n.num
this : ↑n⁻¹.den = 0 → ↑n.num = 0
⊢ ↑(m / n) = ↑m / ↑n

Next tactic:
rw [division_def, cast_mul_of_ne_zero md (mt this nn), cast_inv_of_ne_zero nn nd, division_def]
@[simp]
theorem map_ratCast [DivisionRing α] [DivisionRing β] [RingHomClass F α β] (f : F) (q : ℚ) :
    f q = q := by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
inst✝² : DivisionRing α
inst✝¹ : DivisionRing β
inst✝ : RingHomClass F α β
f : F
q : ℚ
⊢ f ↑q = ↑q

Next tactic:
rw [cast_def, map_div₀, map_intCast, map_natCast, cast_def]
@[simp]
theorem eq_ratCast {k} [DivisionRing k] [RingHomClass F ℚ k] (f : F) (r : ℚ) : f r = r := by
  

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
k : Type u_5
inst✝¹ : DivisionRing k
inst✝ : RingHomClass F ℚ k
f : F
r : ℚ
⊢ f r = ↑r

Next tactic:
rw [← map_ratCast f, Rat.cast_id]
/-- If `f` and `g` agree on the integers then they are equal `φ`. -/
theorem ext_rat' (h : ∀ m : ℤ, f m = g m) : f = g :=
  (FunLike.ext f g) fun r => by
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
M₀ : Type u_5
inst✝¹ : MonoidWithZero M₀
inst✝ : MonoidWithZeroHomClass F ℚ M₀
f g : F
h : ∀ (m : ℤ), f ↑m = g ↑m
r : ℚ
⊢ f r = g r

Next tactic:
rw [← r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, ← Int.cast_ofNat,
      eq_on_inv₀ f g]
/-- If `f` and `g` agree on the integers then they are equal `φ`. -/
theorem ext_rat' (h : ∀ m : ℤ, f m = g m) : f = g :=
  (FunLike.ext f g) fun r => by
    rw [← r.num_div_den, div_eq_mul_inv, map_mul, map_mul, h, ← Int.cast_ofNat,
      eq_on_inv₀ f g]
    

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
M₀ : Type u_5
inst✝¹ : MonoidWithZero M₀
inst✝ : MonoidWithZeroHomClass F ℚ M₀
f g : F
h : ∀ (m : ℤ), f ↑m = g ↑m
r : ℚ
⊢ f ↑↑r.den = g ↑↑r.den

Next tactic:
apply h
/-- Positive integer values of a morphism `φ` and its value on `-1` completely determine `φ`. -/
theorem ext_rat_on_pnat (same_on_neg_one : f (-1) = g (-1))
    (same_on_pnat : ∀ n : ℕ, 0 < n → f n = g n) : f = g :=
  ext_rat' <|
    FunLike.congr_fun <|
      show
        (f : ℚ →*₀ M₀).comp (Int.castRingHom ℚ : ℤ →*₀ ℚ) =
          (g : ℚ →*₀ M₀).comp (Int.castRingHom ℚ : ℤ →*₀ ℚ)
        from ext_int' (by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
M₀ : Type u_5
inst✝¹ : MonoidWithZero M₀
inst✝ : MonoidWithZeroHomClass F ℚ M₀
f g : F
same_on_neg_one : f (-1) = g (-1)
same_on_pnat : ∀ (n : ℕ), 0 < n → f ↑n = g ↑n
⊢ (comp ↑f ↑(Int.castRingHom ℚ)) (-1) = (comp ↑g ↑(Int.castRingHom ℚ)) (-1)

Next tactic:
simpa
/-- Positive integer values of a morphism `φ` and its value on `-1` completely determine `φ`. -/
theorem ext_rat_on_pnat (same_on_neg_one : f (-1) = g (-1))
    (same_on_pnat : ∀ n : ℕ, 0 < n → f n = g n) : f = g :=
  ext_rat' <|
    FunLike.congr_fun <|
      show
        (f : ℚ →*₀ M₀).comp (Int.castRingHom ℚ : ℤ →*₀ ℚ) =
          (g : ℚ →*₀ M₀).comp (Int.castRingHom ℚ : ℤ →*₀ ℚ)
        from ext_int' (by simpa) (by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
M₀ : Type u_5
inst✝¹ : MonoidWithZero M₀
inst✝ : MonoidWithZeroHomClass F ℚ M₀
f g : F
same_on_neg_one : f (-1) = g (-1)
same_on_pnat : ∀ (n : ℕ), 0 < n → f ↑n = g ↑n
⊢ ∀ (n : ℕ), 0 < n → (comp ↑f ↑(Int.castRingHom ℚ)) ↑n = (comp ↑g ↑(Int.castRingHom ℚ)) ↑n

Next tactic:
simpa
instance (priority := 100) distribSMul : DistribSMul ℚ K where
  smul := (· • ·)
  smul_zero a := by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
K : Type u_5
inst✝ : DivisionRing K
a : ℚ
⊢ a • 0 = 0

Next tactic:
rw [smul_def, mul_zero]
instance (priority := 100) distribSMul : DistribSMul ℚ K where
  smul := (· • ·)
  smul_zero a := by rw [smul_def, mul_zero]
  smul_add a x y := by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
K : Type u_5
inst✝ : DivisionRing K
a : ℚ
x y : K
⊢ a • (x + y) = a • x + a • y

Next tactic:
rw [smul_def, smul_def, smul_def, mul_add]
instance isScalarTower_right : IsScalarTower ℚ K K :=
  ⟨fun a x y => by 

Proof state:
F : Type u_1
ι : Type u_2
α : Type u_3
β : Type u_4
K : Type u_5
inst✝ : DivisionRing K
a : ℚ
x y : K
⊢ (a • x) • y = a • x • y

Next tactic:
simp only [smul_def, smul_eq_mul, mul_assoc]
theorem coe_injective ⦃f g : α →ₛ β⦄ (H : (f : α → β) = g) : f = g := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : MeasurableSpace α
f g : α →ₛ β
H : ↑f = ↑g
⊢ f = g

Next tactic:
cases f
theorem coe_injective ⦃f g : α →ₛ β⦄ (H : (f : α → β) = g) : f = g := by
  cases f; 

Proof state:
case mk
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : MeasurableSpace α
g : α →ₛ β
toFun✝ : α → β
measurableSet_fiber'✝ : ∀ (x : β), MeasurableSet (toFun✝ ⁻¹' {x})
finite_range'✝ : Set.Finite (range toFun✝)
H : ↑{ toFun := toFun✝, measurableSet_fiber' := measurableSet_fiber'✝, finite_range' := finite_range'✝ } = ↑g
⊢ { toFun := toFun✝, measurableSet_fiber' := measurableSet_fiber'✝, finite_range' := finite_range'✝ } = g

Next tactic:
cases g
theorem coe_injective ⦃f g : α →ₛ β⦄ (H : (f : α → β) = g) : f = g := by
  cases f; cases g; 

Proof state:
case mk.mk
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
inst✝ : MeasurableSpace α
toFun✝¹ : α → β
measurableSet_fiber'✝¹ : ∀ (x : β), MeasurableSet (toFun✝¹ ⁻¹' {x})
finite_range'✝¹ : Set.Finite (range toFun✝¹)
toFun✝ : α → β
measurableSet_fiber'✝ : ∀ (x : β), MeasurableSet (toFun✝ ⁻¹' {x})
finite_range'✝ : Set.Finite (range toFun✝)
H :
  ↑{ toFun := toFun✝¹, measurableSet_fiber' := measurableSet_fiber'✝¹, finite_range' := finite_range'✝¹ } =
    ↑{ toFun := toFun✝, measurableSet_fiber' := measurableSet_fiber'✝, finite_range' := finite_range'✝ }
⊢ { toFun := toFun✝¹, measurableSet_fiber' := measurableSet_fiber'✝¹, finite_range' := finite_range'✝¹ } =
    { toFun := toFun✝, measurableSet_fiber' := measurableSet_fiber'✝, finite_range' := finite_range'✝ }

Next tactic:
congr