l3lab/ntp-mathlib huggingface dataset:
open MulOpposite in
@[to_additive]
theorem of_mulOpposite (h : TwoUniqueProds Gᵐᵒᵖ) : TwoUniqueProds G where
  uniqueMul_of_one_lt_card hc := by
    let f : G ↪ Gᵐᵒᵖ := ⟨op, op_injective⟩
    rw [← card_map f, ← card_map f, mul_comm] at hc
    obtain ⟨p1, h1, p2, h2, hne, hu1, hu2⟩ := h.uniqueMul_of_one_lt_card hc
    simp_rw [mem_product] at h1 h2 ⊢
    refine ⟨(_, _), ⟨?_, ?_⟩, (_, _), ⟨?_, ?_⟩, ?_, hu1.of_mulOpposite, hu2.of_mulOpposite⟩
    pick_goal 5
    · contrapose! hne; rw [Prod.ext_iff] at hne ⊢
      exact ⟨unop_injective hne.2, unop_injective hne.1⟩
    all_goals 

Proof state:
case intro.intro.intro.intro.intro.intro.refine_1
G : Type u
H : Type v
inst✝¹ : Mul G
inst✝ : Mul H
h : TwoUniqueProds Gᵐᵒᵖ
A✝ B✝ : Finset G
f : G ↪ Gᵐᵒᵖ := { toFun := op, inj' := (_ : Function.Injective op) }
hc : 1 < card (map f B✝) * card (map f A✝)
p1 p2 : Gᵐᵒᵖ × Gᵐᵒᵖ
hne : p1 ≠ p2
hu1 : UniqueMul (map f B✝) (map f A✝) p1.1 p1.2
hu2 : UniqueMul (map f B✝) (map f A✝) p2.1 p2.2
h1 :
  p1.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p1.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
h2 :
  p2.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p2.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
⊢ (p1.2.1, p1.1.1).1 ∈ A✝

Next tactic:
apply (mem_map' f).mp
open MulOpposite in
@[to_additive]
theorem of_mulOpposite (h : TwoUniqueProds Gᵐᵒᵖ) : TwoUniqueProds G where
  uniqueMul_of_one_lt_card hc := by
    let f : G ↪ Gᵐᵒᵖ := ⟨op, op_injective⟩
    rw [← card_map f, ← card_map f, mul_comm] at hc
    obtain ⟨p1, h1, p2, h2, hne, hu1, hu2⟩ := h.uniqueMul_of_one_lt_card hc
    simp_rw [mem_product] at h1 h2 ⊢
    refine ⟨(_, _), ⟨?_, ?_⟩, (_, _), ⟨?_, ?_⟩, ?_, hu1.of_mulOpposite, hu2.of_mulOpposite⟩
    pick_goal 5
    · contrapose! hne; rw [Prod.ext_iff] at hne ⊢
      exact ⟨unop_injective hne.2, unop_injective hne.1⟩
    all_goals 

Proof state:
case intro.intro.intro.intro.intro.intro.refine_2
G : Type u
H : Type v
inst✝¹ : Mul G
inst✝ : Mul H
h : TwoUniqueProds Gᵐᵒᵖ
A✝ B✝ : Finset G
f : G ↪ Gᵐᵒᵖ := { toFun := op, inj' := (_ : Function.Injective op) }
hc : 1 < card (map f B✝) * card (map f A✝)
p1 p2 : Gᵐᵒᵖ × Gᵐᵒᵖ
hne : p1 ≠ p2
hu1 : UniqueMul (map f B✝) (map f A✝) p1.1 p1.2
hu2 : UniqueMul (map f B✝) (map f A✝) p2.1 p2.2
h1 :
  p1.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p1.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
h2 :
  p2.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p2.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
⊢ (p1.2.1, p1.1.1).2 ∈ B✝

Next tactic:
apply (mem_map' f).mp
open MulOpposite in
@[to_additive]
theorem of_mulOpposite (h : TwoUniqueProds Gᵐᵒᵖ) : TwoUniqueProds G where
  uniqueMul_of_one_lt_card hc := by
    let f : G ↪ Gᵐᵒᵖ := ⟨op, op_injective⟩
    rw [← card_map f, ← card_map f, mul_comm] at hc
    obtain ⟨p1, h1, p2, h2, hne, hu1, hu2⟩ := h.uniqueMul_of_one_lt_card hc
    simp_rw [mem_product] at h1 h2 ⊢
    refine ⟨(_, _), ⟨?_, ?_⟩, (_, _), ⟨?_, ?_⟩, ?_, hu1.of_mulOpposite, hu2.of_mulOpposite⟩
    pick_goal 5
    · contrapose! hne; rw [Prod.ext_iff] at hne ⊢
      exact ⟨unop_injective hne.2, unop_injective hne.1⟩
    all_goals 

Proof state:
case intro.intro.intro.intro.intro.intro.refine_3
G : Type u
H : Type v
inst✝¹ : Mul G
inst✝ : Mul H
h : TwoUniqueProds Gᵐᵒᵖ
A✝ B✝ : Finset G
f : G ↪ Gᵐᵒᵖ := { toFun := op, inj' := (_ : Function.Injective op) }
hc : 1 < card (map f B✝) * card (map f A✝)
p1 p2 : Gᵐᵒᵖ × Gᵐᵒᵖ
hne : p1 ≠ p2
hu1 : UniqueMul (map f B✝) (map f A✝) p1.1 p1.2
hu2 : UniqueMul (map f B✝) (map f A✝) p2.1 p2.2
h1 :
  p1.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p1.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
h2 :
  p2.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p2.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
⊢ (p2.2.1, p2.1.1).1 ∈ A✝

Next tactic:
apply (mem_map' f).mp
open MulOpposite in
@[to_additive]
theorem of_mulOpposite (h : TwoUniqueProds Gᵐᵒᵖ) : TwoUniqueProds G where
  uniqueMul_of_one_lt_card hc := by
    let f : G ↪ Gᵐᵒᵖ := ⟨op, op_injective⟩
    rw [← card_map f, ← card_map f, mul_comm] at hc
    obtain ⟨p1, h1, p2, h2, hne, hu1, hu2⟩ := h.uniqueMul_of_one_lt_card hc
    simp_rw [mem_product] at h1 h2 ⊢
    refine ⟨(_, _), ⟨?_, ?_⟩, (_, _), ⟨?_, ?_⟩, ?_, hu1.of_mulOpposite, hu2.of_mulOpposite⟩
    pick_goal 5
    · contrapose! hne; rw [Prod.ext_iff] at hne ⊢
      exact ⟨unop_injective hne.2, unop_injective hne.1⟩
    all_goals 

Proof state:
case intro.intro.intro.intro.intro.intro.refine_4
G : Type u
H : Type v
inst✝¹ : Mul G
inst✝ : Mul H
h : TwoUniqueProds Gᵐᵒᵖ
A✝ B✝ : Finset G
f : G ↪ Gᵐᵒᵖ := { toFun := op, inj' := (_ : Function.Injective op) }
hc : 1 < card (map f B✝) * card (map f A✝)
p1 p2 : Gᵐᵒᵖ × Gᵐᵒᵖ
hne : p1 ≠ p2
hu1 : UniqueMul (map f B✝) (map f A✝) p1.1 p1.2
hu2 : UniqueMul (map f B✝) (map f A✝) p2.1 p2.2
h1 :
  p1.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p1.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
h2 :
  p2.1 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } B✝ ∧
    p2.2 ∈ map { toFun := op, inj' := (_ : Function.Injective op) } A✝
⊢ (p2.2.1, p2.1.1).2 ∈ B✝

Next tactic:
apply (mem_map' f).mp
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    

Proof state:
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card A * card B
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    

Proof state:
case intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card A * card B
hA : 0 < card A
hB : 0 < card B
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
rw [card_pos] at hA hB
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    

Proof state:
case intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card A * card B
hA : Finset.Nonempty A
hB : Finset.Nonempty B
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
rw [← card_product] at hc
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    

Proof state:
case intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    

Proof state:
case intro.intro.intro.intro.intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
have : UniqueMul A B a0 b0
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · 

Proof state:
case this
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
⊢ UniqueMul A B a0 b0

Next tactic:
intro a b ha hb he
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      

Proof state:
case this
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
a b : G
ha : a ∈ A
hb : b ∈ B
he : a * b = a0 * b0
⊢ a = a0 ∧ b = b0

Next tactic:
obtain hl | rfl | hl := lt_trichotomy b b0
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      obtain hl | rfl | hl := lt_trichotomy b b0
      · 

Proof state:
case this.inl
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
a b : G
ha : a ∈ A
hb : b ∈ B
he : a * b = a0 * b0
hl : b < b0
⊢ a = a0 ∧ b = b0

Next tactic:
exact ((he0 ▸ he ▸ mul_lt_mul_left' hl a).not_le <| le_max' _ _ <| mul_mem_mul ha hb0).elim
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      obtain hl | rfl | hl := lt_trichotomy b b0
      · exact ((he0 ▸ he ▸ mul_lt_mul_left' hl a).not_le <| le_max' _ _ <| mul_mem_mul ha hb0).elim
      · 

Proof state:
case this.inr.inl
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 : G
ha0 : a0 ∈ A
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
a b : G
ha : a ∈ A
hb hb0 : b ∈ B
he0 : a0 * b = max' (A * B) (_ : Finset.Nonempty (A * B))
he : a * b = a0 * b
⊢ a = a0 ∧ b = b

Next tactic:
exact ⟨mul_right_cancel he, rfl⟩
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      obtain hl | rfl | hl := lt_trichotomy b b0
      · exact ((he0 ▸ he ▸ mul_lt_mul_left' hl a).not_le <| le_max' _ _ <| mul_mem_mul ha hb0).elim
      · exact ⟨mul_right_cancel he, rfl⟩
      · 

Proof state:
case this.inr.inr
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
a b : G
ha : a ∈ A
hb : b ∈ B
he : a * b = a0 * b0
hl : b0 < b
⊢ a = a0 ∧ b = b0

Next tactic:
exact ((he0 ▸ mul_lt_mul_left' hl a0).not_le <| le_max' _ _ <| mul_mem_mul ha0 hb).elim
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      obtain hl | rfl | hl := lt_trichotomy b b0
      · exact ((he0 ▸ he ▸ mul_lt_mul_left' hl a).not_le <| le_max' _ _ <| mul_mem_mul ha hb0).elim
      · exact ⟨mul_right_cancel he, rfl⟩
      · exact ((he0 ▸ mul_lt_mul_left' hl a0).not_le <| le_max' _ _ <| mul_mem_mul ha0 hb).elim
    

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
this : UniqueMul A B a0 b0
⊢ ∃ p1 ∈ A ×ˢ B, ∃ p2 ∈ A ×ˢ B, p1 ≠ p2 ∧ UniqueMul A B p1.1 p1.2 ∧ UniqueMul A B p2.1 p2.2

Next tactic:
refine ⟨_, mk_mem_product ha0 hb0, _, mk_mem_product ha1 hb1, fun he ↦ ?_, this, ?_⟩
/-- This instance asserts that if `G` has a right-cancellative multiplication, a linear order, and
  multiplication is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueProds`. -/
@[to_additive
  "This instance asserts that if `G` has a right-cancellative addition, a linear order,
  and addition is strictly monotone w.r.t. the second argument, then `G` has `TwoUniqueSums`." ]
instance (priority := 100) of_covariant_right [IsRightCancelMul G]
    [LinearOrder G] [CovariantClass G G (· * ·) (· < ·)] :
    TwoUniqueProds G where
  uniqueMul_of_one_lt_card {A B} hc := by
    obtain ⟨hA, hB, -⟩ := Nat.one_lt_mul_iff.mp hc
    rw [card_pos] at hA hB
    rw [← card_product] at hc
    obtain ⟨a0, b0, ha0, hb0, he0⟩ := mem_mul.mp (max'_mem _ <| hA.mul hB)
    obtain ⟨a1, b1, ha1, hb1, he1⟩ := mem_mul.mp (min'_mem _ <| hA.mul hB)
    have : UniqueMul A B a0 b0
    · intro a b ha hb he
      obtain hl | rfl | hl := lt_trichotomy b b0
      · exact ((he0 ▸ he ▸ mul_lt_mul_left' hl a).not_le <| le_max' _ _ <| mul_mem_mul ha hb0).elim
      · exact ⟨mul_right_cancel he, rfl⟩
      · exact ((he0 ▸ mul_lt_mul_left' hl a0).not_le <| le_max' _ _ <| mul_mem_mul ha0 hb).elim
    refine ⟨_, mk_mem_product ha0 hb0, _, mk_mem_product ha1 hb1, fun he ↦ ?_, this, ?_⟩
    · 

Proof state:
case intro.intro.intro.intro.intro.intro.intro.intro.intro.intro.refine_1
G : Type u
H : Type v
inst✝⁴ : Mul G
inst✝³ : Mul H
inst✝² : IsRightCancelMul G
inst✝¹ : LinearOrder G
inst✝ : CovariantClass G G (fun x x_1 => x * x_1) fun x x_1 => x < x_1
A B : Finset G
hc : 1 < card (A ×ˢ B)
hA : Finset.Nonempty A
hB : Finset.Nonempty B
a0 b0 : G
ha0 : a0 ∈ A
hb0 : b0 ∈ B
he0 : a0 * b0 = max' (A * B) (_ : Finset.Nonempty (A * B))
a1 b1 : G
ha1 : a1 ∈ A
hb1 : b1 ∈ B
he1 : a1 * b1 = min' (A * B) (_ : Finset.Nonempty (A * B))
this : UniqueMul A B a0 b0
he : (a0, b0) = (a1, b1)
⊢ False

Next tactic:
rw [Prod.mk.inj_iff] at he