l3lab/ntp-mathlib huggingface dataset:
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
⊢ x ∣ a ∨ x ∣ b

Next tactic:
cases' gcd_dvd_left x a with y hy
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      

Proof state:
case intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
⊢ x ∣ a ∨ x ∣ b

Next tactic:
cases' hi.isUnit_or_isUnit hy with hu hu
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · 

Proof state:
case intro.inl
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ x ∣ a ∨ x ∣ b

Next tactic:
right
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        

Proof state:
case intro.inl.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ x ∣ b

Next tactic:
trans gcd (x * b) (a * b)
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ x ∣ gcd (x * b) (a * b)
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ gcd (x * b) (a * b) ∣ b

Next tactic:
apply dvd_gcd (dvd_mul_right x b) h
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        apply dvd_gcd (dvd_mul_right x b) h
        

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ gcd (x * b) (a * b) ∣ b

Next tactic:
rw [(gcd_mul_right' b x a).dvd_iff_dvd_left]
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        apply dvd_gcd (dvd_mul_right x b) h
        rw [(gcd_mul_right' b x a).dvd_iff_dvd_left]
        

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit (gcd x a)
⊢ gcd x a * b ∣ b

Next tactic:
exact (associated_unit_mul_left _ _ hu).dvd
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        apply dvd_gcd (dvd_mul_right x b) h
        rw [(gcd_mul_right' b x a).dvd_iff_dvd_left]
        exact (associated_unit_mul_left _ _ hu).dvd
      · 

Proof state:
case intro.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit y
⊢ x ∣ a ∨ x ∣ b

Next tactic:
left
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        apply dvd_gcd (dvd_mul_right x b) h
        rw [(gcd_mul_right' b x a).dvd_iff_dvd_left]
        exact (associated_unit_mul_left _ _ hu).dvd
      · left
        

Proof state:
case intro.inr.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit y
⊢ x ∣ a

Next tactic:
rw [hy]
theorem prime_of_irreducible [GCDMonoid α] {x : α} (hi : Irreducible x) : Prime x :=
  ⟨hi.ne_zero,
    ⟨hi.1, fun a b h => by
      cases' gcd_dvd_left x a with y hy
      cases' hi.isUnit_or_isUnit hy with hu hu
      · right
        trans gcd (x * b) (a * b)
        apply dvd_gcd (dvd_mul_right x b) h
        rw [(gcd_mul_right' b x a).dvd_iff_dvd_left]
        exact (associated_unit_mul_left _ _ hu).dvd
      · left
        rw [hy]
        

Proof state:
case intro.inr.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : GCDMonoid α
x : α
hi : Irreducible x
a b : α
h : x ∣ a * b
y : α
hy : x = gcd x a * y
hu : IsUnit y
⊢ gcd x a * y ∣ a

Next tactic:
exact dvd_trans (associated_mul_unit_left _ _ hu).dvd (gcd_dvd_right x a)
instance uniqueNormalizationMonoidOfUniqueUnits : Unique (NormalizationMonoid α) where
  default := normalizationMonoidOfUniqueUnits
  uniq := fun ⟨u, _, _, _⟩ => by 

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
x✝ : NormalizationMonoid α
u : α → αˣ
normUnit_zero✝ : u 0 = 1
normUnit_mul✝ : ∀ {a b : α}, a ≠ 0 → b ≠ 0 → u (a * b) = u a * u b
normUnit_coe_units✝ : ∀ (u_1 : αˣ), u ↑u_1 = u_1⁻¹
⊢ { normUnit := u, normUnit_zero := normUnit_zero✝, normUnit_mul := normUnit_mul✝,
      normUnit_coe_units := normUnit_coe_units✝ } =
    default

Next tactic:
congr
instance uniqueNormalizationMonoidOfUniqueUnits : Unique (NormalizationMonoid α) where
  default := normalizationMonoidOfUniqueUnits
  uniq := fun ⟨u, _, _, _⟩ => by congr; 

Proof state:
case e_normUnit
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
x✝ : NormalizationMonoid α
u : α → αˣ
normUnit_zero✝ : u 0 = 1
normUnit_mul✝ : ∀ {a b : α}, a ≠ 0 → b ≠ 0 → u (a * b) = u a * u b
normUnit_coe_units✝ : ∀ (u_1 : αˣ), u ↑u_1 = u_1⁻¹
⊢ u = fun x => 1

Next tactic:
simp [eq_iff_true_of_subsingleton]
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
⊢ g₁ = g₂

Next tactic:
have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
⊢ gcd = gcd

Next tactic:
ext a b
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      

Proof state:
case h.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
a b : α
⊢ gcd a b = gcd a b

Next tactic:
refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · 

Proof state:
case h.h.refine'_1
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
a b : α
⊢ gcd a b ∣ gcd a b

Next tactic:
exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · 

Proof state:
case h.h.refine'_2
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
a b : α
⊢ gcd a b ∣ gcd a b

Next tactic:
exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
⊢ g₁ = g₂

Next tactic:
have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
⊢ lcm = lcm

Next tactic:
ext a b
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      

Proof state:
case h.h
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
a b : α
⊢ lcm a b = lcm a b

Next tactic:
refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · 

Proof state:
case h.h.refine'_1
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
a b : α
⊢ lcm a b ∣ lcm a b

Next tactic:
exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · 

Proof state:
case h.h.refine'_2
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
a b : α
⊢ lcm a b ∣ lcm a b

Next tactic:
exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
    

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₁ g₂ : GCDMonoid α
hgcd : gcd = gcd
hlcm : lcm = lcm
⊢ g₁ = g₂

Next tactic:
cases g₁
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
    cases g₁
    

Proof state:
case mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
g₂ : GCDMonoid α
gcd✝ lcm✝ : α → α → α
gcd_dvd_left✝ : ∀ (a b : α), gcd✝ a b ∣ a
gcd_dvd_right✝ : ∀ (a b : α), gcd✝ a b ∣ b
dvd_gcd✝ : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd✝ c b
gcd_mul_lcm✝ : ∀ (a b : α), Associated (gcd✝ a b * lcm✝ a b) (a * b)
lcm_zero_left✝ : ∀ (a : α), lcm✝ 0 a = 0
lcm_zero_right✝ : ∀ (a : α), lcm✝ a 0 = 0
hgcd : gcd = gcd
hlcm : lcm = lcm
⊢ { gcd := gcd✝, lcm := lcm✝, gcd_dvd_left := gcd_dvd_left✝, gcd_dvd_right := gcd_dvd_right✝, dvd_gcd := dvd_gcd✝,
      gcd_mul_lcm := gcd_mul_lcm✝, lcm_zero_left := lcm_zero_left✝, lcm_zero_right := lcm_zero_right✝ } =
    g₂

Next tactic:
cases g₂
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
    cases g₁
    cases g₂
    

Proof state:
case mk.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
gcd✝¹ lcm✝¹ : α → α → α
gcd_dvd_left✝¹ : ∀ (a b : α), gcd✝¹ a b ∣ a
gcd_dvd_right✝¹ : ∀ (a b : α), gcd✝¹ a b ∣ b
dvd_gcd✝¹ : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd✝¹ c b
gcd_mul_lcm✝¹ : ∀ (a b : α), Associated (gcd✝¹ a b * lcm✝¹ a b) (a * b)
lcm_zero_left✝¹ : ∀ (a : α), lcm✝¹ 0 a = 0
lcm_zero_right✝¹ : ∀ (a : α), lcm✝¹ a 0 = 0
gcd✝ lcm✝ : α → α → α
gcd_dvd_left✝ : ∀ (a b : α), gcd✝ a b ∣ a
gcd_dvd_right✝ : ∀ (a b : α), gcd✝ a b ∣ b
dvd_gcd✝ : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd✝ c b
gcd_mul_lcm✝ : ∀ (a b : α), Associated (gcd✝ a b * lcm✝ a b) (a * b)
lcm_zero_left✝ : ∀ (a : α), lcm✝ 0 a = 0
lcm_zero_right✝ : ∀ (a : α), lcm✝ a 0 = 0
hgcd : gcd = gcd
hlcm : lcm = lcm
⊢ { gcd := gcd✝¹, lcm := lcm✝¹, gcd_dvd_left := gcd_dvd_left✝¹, gcd_dvd_right := gcd_dvd_right✝¹, dvd_gcd := dvd_gcd✝¹,
      gcd_mul_lcm := gcd_mul_lcm✝¹, lcm_zero_left := lcm_zero_left✝¹, lcm_zero_right := lcm_zero_right✝¹ } =
    { gcd := gcd✝, lcm := lcm✝, gcd_dvd_left := gcd_dvd_left✝, gcd_dvd_right := gcd_dvd_right✝, dvd_gcd := dvd_gcd✝,
      gcd_mul_lcm := gcd_mul_lcm✝, lcm_zero_left := lcm_zero_left✝, lcm_zero_right := lcm_zero_right✝ }

Next tactic:
dsimp only at hgcd hlcm
instance subsingleton_gcdMonoid_of_unique_units : Subsingleton (GCDMonoid α) :=
  ⟨fun g₁ g₂ => by
    have hgcd : g₁.gcd = g₂.gcd := by
      ext a b
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      · exact dvd_gcd (@gcd_dvd_left _ _ g₁ _ _) (@gcd_dvd_right _ _ g₁ _ _)
      · exact @dvd_gcd _ _ g₁ _ _ _ (@gcd_dvd_left _ _ g₂ _ _) (@gcd_dvd_right _ _ g₂ _ _)
    have hlcm : g₁.lcm = g₂.lcm := by
      ext a b
      -- Porting note: Lean4 seems to need help specifying `g₁` and `g₂`
      refine' associated_iff_eq.mp (associated_of_dvd_dvd _ _)
      · exact (@lcm_dvd_iff _ _ g₁ ..).mpr ⟨@dvd_lcm_left _ _ g₂ _ _, @dvd_lcm_right _ _ g₂ _ _⟩
      · exact lcm_dvd_iff.mpr ⟨@dvd_lcm_left _ _ g₁ _ _, @dvd_lcm_right _ _ g₁ _ _⟩
    cases g₁
    cases g₂
    dsimp only at hgcd hlcm
    

Proof state:
case mk.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
gcd✝¹ lcm✝¹ : α → α → α
gcd_dvd_left✝¹ : ∀ (a b : α), gcd✝¹ a b ∣ a
gcd_dvd_right✝¹ : ∀ (a b : α), gcd✝¹ a b ∣ b
dvd_gcd✝¹ : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd✝¹ c b
gcd_mul_lcm✝¹ : ∀ (a b : α), Associated (gcd✝¹ a b * lcm✝¹ a b) (a * b)
lcm_zero_left✝¹ : ∀ (a : α), lcm✝¹ 0 a = 0
lcm_zero_right✝¹ : ∀ (a : α), lcm✝¹ a 0 = 0
gcd✝ lcm✝ : α → α → α
gcd_dvd_left✝ : ∀ (a b : α), gcd✝ a b ∣ a
gcd_dvd_right✝ : ∀ (a b : α), gcd✝ a b ∣ b
dvd_gcd✝ : ∀ {a b c : α}, a ∣ c → a ∣ b → a ∣ gcd✝ c b
gcd_mul_lcm✝ : ∀ (a b : α), Associated (gcd✝ a b * lcm✝ a b) (a * b)
lcm_zero_left✝ : ∀ (a : α), lcm✝ 0 a = 0
lcm_zero_right✝ : ∀ (a : α), lcm✝ a 0 = 0
hgcd : gcd✝¹ = gcd✝
hlcm : lcm✝¹ = lcm✝
⊢ { gcd := gcd✝¹, lcm := lcm✝¹, gcd_dvd_left := gcd_dvd_left✝¹, gcd_dvd_right := gcd_dvd_right✝¹, dvd_gcd := dvd_gcd✝¹,
      gcd_mul_lcm := gcd_mul_lcm✝¹, lcm_zero_left := lcm_zero_left✝¹, lcm_zero_right := lcm_zero_right✝¹ } =
    { gcd := gcd✝, lcm := lcm✝, gcd_dvd_left := gcd_dvd_left✝, gcd_dvd_right := gcd_dvd_right✝, dvd_gcd := dvd_gcd✝,
      gcd_mul_lcm := gcd_mul_lcm✝, lcm_zero_left := lcm_zero_left✝, lcm_zero_right := lcm_zero_right✝ }

Next tactic:
simp only [hgcd, hlcm]
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
⊢ ∀ (a b : NormalizedGCDMonoid α), a = b

Next tactic:
intro a b
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    intro a b
    

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
a b : NormalizedGCDMonoid α
⊢ a = b

Next tactic:
cases' a with a_norm a_gcd
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    intro a b
    cases' a with a_norm a_gcd
    

Proof state:
case mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
b : NormalizedGCDMonoid α
a_norm : NormalizationMonoid α
a_gcd : GCDMonoid α
normalize_gcd✝ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝ : ∀ (a b : α), normalize (lcm a b) = lcm a b
⊢ NormalizedGCDMonoid.mk normalize_gcd✝ normalize_lcm✝ = b

Next tactic:
cases' b with b_norm b_gcd
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    intro a b
    cases' a with a_norm a_gcd
    cases' b with b_norm b_gcd
    

Proof state:
case mk.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
a_norm : NormalizationMonoid α
a_gcd : GCDMonoid α
normalize_gcd✝¹ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝¹ : ∀ (a b : α), normalize (lcm a b) = lcm a b
b_norm : NormalizationMonoid α
b_gcd : GCDMonoid α
normalize_gcd✝ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝ : ∀ (a b : α), normalize (lcm a b) = lcm a b
⊢ NormalizedGCDMonoid.mk normalize_gcd✝¹ normalize_lcm✝¹ = NormalizedGCDMonoid.mk normalize_gcd✝ normalize_lcm✝

Next tactic:
have := Subsingleton.elim a_gcd b_gcd
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    intro a b
    cases' a with a_norm a_gcd
    cases' b with b_norm b_gcd
    have := Subsingleton.elim a_gcd b_gcd
    

Proof state:
case mk.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
a_norm : NormalizationMonoid α
a_gcd : GCDMonoid α
normalize_gcd✝¹ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝¹ : ∀ (a b : α), normalize (lcm a b) = lcm a b
b_norm : NormalizationMonoid α
b_gcd : GCDMonoid α
normalize_gcd✝ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝ : ∀ (a b : α), normalize (lcm a b) = lcm a b
this : a_gcd = b_gcd
⊢ NormalizedGCDMonoid.mk normalize_gcd✝¹ normalize_lcm✝¹ = NormalizedGCDMonoid.mk normalize_gcd✝ normalize_lcm✝

Next tactic:
subst this
instance subsingleton_normalizedGCDMonoid_of_unique_units : Subsingleton (NormalizedGCDMonoid α) :=
  ⟨by
    intro a b
    cases' a with a_norm a_gcd
    cases' b with b_norm b_gcd
    have := Subsingleton.elim a_gcd b_gcd
    subst this
    

Proof state:
case mk.mk
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Unique αˣ
a_norm : NormalizationMonoid α
a_gcd : GCDMonoid α
normalize_gcd✝¹ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝¹ : ∀ (a b : α), normalize (lcm a b) = lcm a b
b_norm : NormalizationMonoid α
normalize_gcd✝ : ∀ (a b : α), normalize (gcd a b) = gcd a b
normalize_lcm✝ : ∀ (a b : α), normalize (lcm a b) = lcm a b
⊢ NormalizedGCDMonoid.mk normalize_gcd✝¹ normalize_lcm✝¹ = NormalizedGCDMonoid.mk normalize_gcd✝ normalize_lcm✝

Next tactic:
have := Subsingleton.elim a_norm b_norm