l3lab/ntp-mathlib huggingface dataset:
theorem CompleteBipartiteGraph.chromaticNumber {V W : Type*} [Nonempty V] [Nonempty W] :
    (completeBipartiteGraph V W).chromaticNumber = 2 := by
  apply chromaticNumber_eq_card_of_forall_surj (CompleteBipartiteGraph.bicoloring V W)
  intro C b
  have v := Classical.arbitrary V
  have w := Classical.arbitrary W
  have h : (completeBipartiteGraph V W).Adj (Sum.inl v) (Sum.inr w) := by simp
  have hn := C.valid h
  by_cases he : C (Sum.inl v) = b
  · exact ⟨_, he⟩
  · by_cases he' : C (Sum.inr w) = b
    · exact ⟨_, he'⟩
    · exfalso
      cases b <;>
        simp only [Bool.eq_true_eq_not_eq_false, Bool.eq_false_eq_not_eq_true] at he he' <;>
          rw [he, he'] at hn <;>
        

Proof state:
case neg.h.true
V✝ : Type u
G : SimpleGraph V✝
α : Type v
C✝ : Coloring G α
V : Type u_1
W : Type u_2
inst✝¹ : Nonempty V
inst✝ : Nonempty W
C : Coloring (completeBipartiteGraph V W) Bool
v : V
w : W
h : Adj (completeBipartiteGraph V W) (Sum.inl v) (Sum.inr w)
hn : false ≠ false
he : C (Sum.inl v) = false
he' : C (Sum.inr w) = false
⊢ False

Next tactic:
contradiction
theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
s : Finset V
h : IsClique G ↑s
inst✝ : Fintype α
C : Coloring G α
⊢ Finset.card s ≤ Fintype.card α

Next tactic:
rw [isClique_iff_induce_eq] at h
theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α := by
  rw [isClique_iff_induce_eq] at h
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
s : Finset V
h : induce (↑s) G = ⊤
inst✝ : Fintype α
C : Coloring G α
⊢ Finset.card s ≤ Fintype.card α

Next tactic:
have f : G.induce ↑s ↪g G := Embedding.comap (Function.Embedding.subtype fun x => x ∈ ↑s) G
theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α := by
  rw [isClique_iff_induce_eq] at h
  have f : G.induce ↑s ↪g G := Embedding.comap (Function.Embedding.subtype fun x => x ∈ ↑s) G
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
s : Finset V
h : induce (↑s) G = ⊤
inst✝ : Fintype α
C : Coloring G α
f : induce (↑s) G ↪g G
⊢ Finset.card s ≤ Fintype.card α

Next tactic:
rw [h] at f
theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α := by
  rw [isClique_iff_induce_eq] at h
  have f : G.induce ↑s ↪g G := Embedding.comap (Function.Embedding.subtype fun x => x ∈ ↑s) G
  rw [h] at f
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
s : Finset V
h : induce (↑s) G = ⊤
inst✝ : Fintype α
C : Coloring G α
f : ⊤ ↪g G
⊢ Finset.card s ≤ Fintype.card α

Next tactic:
convert Fintype.card_le_of_injective _ (C.comp f.toHom).injective_of_top_hom using 1
theorem IsClique.card_le_of_coloring {s : Finset V} (h : G.IsClique s) [Fintype α]
    (C : G.Coloring α) : s.card ≤ Fintype.card α := by
  rw [isClique_iff_induce_eq] at h
  have f : G.induce ↑s ↪g G := Embedding.comap (Function.Embedding.subtype fun x => x ∈ ↑s) G
  rw [h] at f
  convert Fintype.card_le_of_injective _ (C.comp f.toHom).injective_of_top_hom using 1
  

Proof state:
case h.e'_3
V : Type u
G : SimpleGraph V
α : Type v
C✝ : Coloring G α
s : Finset V
h : induce (↑s) G = ⊤
inst✝ : Fintype α
C : Coloring G α
f : ⊤ ↪g G
⊢ Finset.card s = Fintype.card ↑↑s

Next tactic:
simp
theorem IsClique.card_le_of_colorable {s : Finset V} (h : G.IsClique s) {n : ℕ}
    (hc : G.Colorable n) : s.card ≤ n := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
s : Finset V
h : IsClique G ↑s
n : ℕ
hc : Colorable G n
⊢ Finset.card s ≤ n

Next tactic:
convert h.card_le_of_coloring hc.some
theorem IsClique.card_le_of_colorable {s : Finset V} (h : G.IsClique s) {n : ℕ}
    (hc : G.Colorable n) : s.card ≤ n := by
  convert h.card_le_of_coloring hc.some
  

Proof state:
case h.e'_4
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
s : Finset V
h : IsClique G ↑s
n : ℕ
hc : Colorable G n
⊢ n = Fintype.card (Fin n)

Next tactic:
simp
theorem IsClique.card_le_chromaticNumber [Finite V] {s : Finset V} (h : G.IsClique s) :
    s.card ≤ G.chromaticNumber := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝ : Finite V
s : Finset V
h : IsClique G ↑s
⊢ Finset.card s ≤ chromaticNumber G

Next tactic:
cases nonempty_fintype V
theorem IsClique.card_le_chromaticNumber [Finite V] {s : Finset V} (h : G.IsClique s) :
    s.card ≤ G.chromaticNumber := by
  cases nonempty_fintype V
  

Proof state:
case intro
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
inst✝ : Finite V
s : Finset V
h : IsClique G ↑s
val✝ : Fintype V
⊢ Finset.card s ≤ chromaticNumber G

Next tactic:
exact h.card_le_of_colorable G.colorable_chromaticNumber_of_fintype
protected theorem Colorable.cliqueFree {n m : ℕ} (hc : G.Colorable n) (hm : n < m) :
    G.CliqueFree m := by
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n m : ℕ
hc : Colorable G n
hm : n < m
⊢ CliqueFree G m

Next tactic:
by_contra h
protected theorem Colorable.cliqueFree {n m : ℕ} (hc : G.Colorable n) (hm : n < m) :
    G.CliqueFree m := by
  by_contra h
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n m : ℕ
hc : Colorable G n
hm : n < m
h : ¬CliqueFree G m
⊢ False

Next tactic:
simp only [CliqueFree, isNClique_iff, not_forall, Classical.not_not] at h
protected theorem Colorable.cliqueFree {n m : ℕ} (hc : G.Colorable n) (hm : n < m) :
    G.CliqueFree m := by
  by_contra h
  simp only [CliqueFree, isNClique_iff, not_forall, Classical.not_not] at h
  

Proof state:
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n m : ℕ
hc : Colorable G n
hm : n < m
h : ∃ x, IsClique G ↑x ∧ Finset.card x = m
⊢ False

Next tactic:
obtain ⟨s, h, rfl⟩ := h
protected theorem Colorable.cliqueFree {n m : ℕ} (hc : G.Colorable n) (hm : n < m) :
    G.CliqueFree m := by
  by_contra h
  simp only [CliqueFree, isNClique_iff, not_forall, Classical.not_not] at h
  obtain ⟨s, h, rfl⟩ := h
  

Proof state:
case intro.intro
V : Type u
G : SimpleGraph V
α : Type v
C : Coloring G α
n : ℕ
hc : Colorable G n
s : Finset V
h : IsClique G ↑s
hm : n < Finset.card s
⊢ False

Next tactic:
exact Nat.lt_le_asymm hm (h.card_le_of_colorable hc)
/-- Given an element `a` of a commutative semigroup with zero, there exists another element whose
    product with zero equals `a` iff `a` equals zero. -/
@[simp]
theorem zero_dvd_iff : 0 ∣ a ↔ a = 0 :=
  ⟨eq_zero_of_zero_dvd, fun h => by
    

Proof state:
α : Type u_1
inst✝ : SemigroupWithZero α
a : α
h : a = 0
⊢ 0 ∣ a

Next tactic:
rw [h]
/-- Given an element `a` of a commutative semigroup with zero, there exists another element whose
    product with zero equals `a` iff `a` equals zero. -/
@[simp]
theorem zero_dvd_iff : 0 ∣ a ↔ a = 0 :=
  ⟨eq_zero_of_zero_dvd, fun h => by
    rw [h]
    

Proof state:
α : Type u_1
inst✝ : SemigroupWithZero α
a : α
h : a = 0
⊢ 0 ∣ 0

Next tactic:
exact ⟨0, by simp⟩
/-- Given an element `a` of a commutative semigroup with zero, there exists another element whose
    product with zero equals `a` iff `a` equals zero. -/
@[simp]
theorem zero_dvd_iff : 0 ∣ a ↔ a = 0 :=
  ⟨eq_zero_of_zero_dvd, fun h => by
    rw [h]
    exact ⟨0, by 

Proof state:
α : Type u_1
inst✝ : SemigroupWithZero α
a : α
h : a = 0
⊢ 0 = 0 * 0

Next tactic:
simp
@[simp]
theorem dvd_zero (a : α) : a ∣ 0 :=
  Dvd.intro 0 (by 

Proof state:
α : Type u_1
inst✝ : SemigroupWithZero α
a✝ a : α
⊢ a * 0 = 0

Next tactic:
simp
/-- Given two elements `b`, `c` of a `CancelMonoidWithZero` and a nonzero element `a`,
 `a*b` divides `a*c` iff `b` divides `c`. -/
theorem mul_dvd_mul_iff_left [CancelMonoidWithZero α] {a b c : α} (ha : a ≠ 0) :
    a * b ∣ a * c ↔ b ∣ c :=
  exists_congr fun d => by 

Proof state:
α : Type u_1
inst✝ : CancelMonoidWithZero α
a b c : α
ha : a ≠ 0
d : α
⊢ a * c = a * b * d ↔ c = b * d

Next tactic:
rw [mul_assoc, mul_right_inj' ha]
/-- Given two elements `a`, `b` of a commutative `CancelMonoidWithZero` and a nonzero
  element `c`, `a*c` divides `b*c` iff `a` divides `b`. -/
theorem mul_dvd_mul_iff_right [CancelCommMonoidWithZero α] {a b c : α} (hc : c ≠ 0) :
    a * c ∣ b * c ↔ a ∣ b :=
  exists_congr fun d => by 

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
a b c : α
hc : c ≠ 0
d : α
⊢ b * c = a * c * d ↔ b = a * d

Next tactic:
rw [mul_right_comm, mul_left_inj' hc]
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  

Proof state:
α : Type u_1
inst✝ : CommMonoidWithZero α
a b : α
hd : a ∣ b
hnd : ¬b ∣ a
⊢ DvdNotUnit a b

Next tactic:
constructor
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · 

Proof state:
case left
α : Type u_1
inst✝ : CommMonoidWithZero α
a b : α
hd : a ∣ b
hnd : ¬b ∣ a
⊢ a ≠ 0

Next tactic:
rintro rfl
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · rintro rfl
    

Proof state:
case left
α : Type u_1
inst✝ : CommMonoidWithZero α
b : α
hd : 0 ∣ b
hnd : ¬b ∣ 0
⊢ False

Next tactic:
exact hnd (dvd_zero _)
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · rintro rfl
    exact hnd (dvd_zero _)
  · 

Proof state:
case right
α : Type u_1
inst✝ : CommMonoidWithZero α
a b : α
hd : a ∣ b
hnd : ¬b ∣ a
⊢ ∃ x, ¬IsUnit x ∧ b = a * x

Next tactic:
rcases hd with ⟨c, rfl⟩
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · rintro rfl
    exact hnd (dvd_zero _)
  · rcases hd with ⟨c, rfl⟩
    

Proof state:
case right.intro
α : Type u_1
inst✝ : CommMonoidWithZero α
a c : α
hnd : ¬a * c ∣ a
⊢ ∃ x, ¬IsUnit x ∧ a * c = a * x

Next tactic:
refine' ⟨c, _, rfl⟩
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · rintro rfl
    exact hnd (dvd_zero _)
  · rcases hd with ⟨c, rfl⟩
    refine' ⟨c, _, rfl⟩
    

Proof state:
case right.intro
α : Type u_1
inst✝ : CommMonoidWithZero α
a c : α
hnd : ¬a * c ∣ a
⊢ ¬IsUnit c

Next tactic:
rintro ⟨u, rfl⟩
theorem dvdNotUnit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬b ∣ a) : DvdNotUnit a b := by
  constructor
  · rintro rfl
    exact hnd (dvd_zero _)
  · rcases hd with ⟨c, rfl⟩
    refine' ⟨c, _, rfl⟩
    rintro ⟨u, rfl⟩
    

Proof state:
case right.intro.intro
α : Type u_1
inst✝ : CommMonoidWithZero α
a : α
u : αˣ
hnd : ¬a * ↑u ∣ a
⊢ False

Next tactic:
simp at hnd
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by 

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝ : x ∣ y ∧ ¬y ∣ x
d : α
hd : y = x * d
hyx : ¬y ∣ x
hx0 : x = 0
⊢ False

Next tactic:
simp [hx0] at hyx
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by 

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : x ∣ y ∧ ¬y ∣ x
d : α
hd : y = x * d
hyx : ¬y ∣ x
x✝ : d ∣ 1
e : α
he : 1 = d * e
⊢ x = y * e

Next tactic:
rw [hd, mul_assoc, ← he, mul_one]
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩,
        hd⟩⟩,
    fun ⟨hx0, d, hdu, hdx⟩ =>
    ⟨⟨d, hdx⟩, fun ⟨e, he⟩ =>
      hdu
        (isUnit_of_dvd_one
          ⟨e, mul_left_cancel₀ hx0 <| by 

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : DvdNotUnit x y
hx0 : x ≠ 0
d : α
hdu : ¬IsUnit d
hdx : y = x * d
x✝ : y ∣ x
e : α
he : x = y * e
⊢ x * 1 = x * (d * e)

Next tactic:
conv =>
            lhs
            rw [he, hdx]
            simp [mul_assoc]
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩,
        hd⟩⟩,
    fun ⟨hx0, d, hdu, hdx⟩ =>
    ⟨⟨d, hdx⟩, fun ⟨e, he⟩ =>
      hdu
        (isUnit_of_dvd_one
          ⟨e, mul_left_cancel₀ hx0 <| by conv =>
            

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : DvdNotUnit x y
hx0 : x ≠ 0
d : α
hdu : ¬IsUnit d
hdx : y = x * d
x✝ : y ∣ x
e : α
he : x = y * e
| x * 1 = x * (d * e)

Next tactic:
lhs
            rw [he, hdx]
            simp [mul_assoc]
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩,
        hd⟩⟩,
    fun ⟨hx0, d, hdu, hdx⟩ =>
    ⟨⟨d, hdx⟩, fun ⟨e, he⟩ =>
      hdu
        (isUnit_of_dvd_one
          ⟨e, mul_left_cancel₀ hx0 <| by conv =>
            

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : DvdNotUnit x y
hx0 : x ≠ 0
d : α
hdu : ¬IsUnit d
hdx : y = x * d
x✝ : y ∣ x
e : α
he : x = y * e
| x * 1 = x * (d * e)

Next tactic:
lhs
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩,
        hd⟩⟩,
    fun ⟨hx0, d, hdu, hdx⟩ =>
    ⟨⟨d, hdx⟩, fun ⟨e, he⟩ =>
      hdu
        (isUnit_of_dvd_one
          ⟨e, mul_left_cancel₀ hx0 <| by conv =>
            lhs
            

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : DvdNotUnit x y
hx0 : x ≠ 0
d : α
hdu : ¬IsUnit d
hdx : y = x * d
x✝ : y ∣ x
e : α
he : x = y * e
| x * 1

Next tactic:
rw [he, hdx]
theorem dvd_and_not_dvd_iff [CancelCommMonoidWithZero α] {x y : α} :
    x ∣ y ∧ ¬y ∣ x ↔ DvdNotUnit x y :=
  ⟨fun ⟨⟨d, hd⟩, hyx⟩ =>
    ⟨fun hx0 => by simp [hx0] at hyx,
      ⟨d, mt isUnit_iff_dvd_one.1 fun ⟨e, he⟩ => hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩,
        hd⟩⟩,
    fun ⟨hx0, d, hdu, hdx⟩ =>
    ⟨⟨d, hdx⟩, fun ⟨e, he⟩ =>
      hdu
        (isUnit_of_dvd_one
          ⟨e, mul_left_cancel₀ hx0 <| by conv =>
            lhs
            rw [he, hdx]
            

Proof state:
α : Type u_1
inst✝ : CancelCommMonoidWithZero α
x y : α
x✝¹ : DvdNotUnit x y
hx0 : x ≠ 0
d : α
hdu : ¬IsUnit d
hdx : y = x * d
x✝ : y ∣ x
e : α
he : x = y * e
| x * d * e * 1

Next tactic:
simp [mul_assoc]
theorem ne_zero_of_dvd_ne_zero {p q : α} (h₁ : q ≠ 0) (h₂ : p ∣ q) : p ≠ 0 := by
  

Proof state:
α : Type u_1
inst✝ : MonoidWithZero α
p q : α
h₁ : q ≠ 0
h₂ : p ∣ q
⊢ p ≠ 0

Next tactic:
rcases h₂ with ⟨u, rfl⟩
theorem ne_zero_of_dvd_ne_zero {p q : α} (h₁ : q ≠ 0) (h₂ : p ∣ q) : p ≠ 0 := by
  rcases h₂ with ⟨u, rfl⟩
  

Proof state:
case intro
α : Type u_1
inst✝ : MonoidWithZero α
p u : α
h₁ : p * u ≠ 0
⊢ p ≠ 0

Next tactic:
exact left_ne_zero_of_mul h₁
theorem dvd_antisymm : a ∣ b → b ∣ a → a = b := by
  

Proof state:
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Subsingleton αˣ
a b : α
⊢ a ∣ b → b ∣ a → a = b

Next tactic:
rintro ⟨c, rfl⟩ ⟨d, hcd⟩
theorem dvd_antisymm : a ∣ b → b ∣ a → a = b := by
  rintro ⟨c, rfl⟩ ⟨d, hcd⟩
  

Proof state:
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Subsingleton αˣ
a c d : α
hcd : a = a * c * d
⊢ a = a * c

Next tactic:
rw [mul_assoc, eq_comm, mul_right_eq_self₀, mul_eq_one] at hcd
theorem dvd_antisymm : a ∣ b → b ∣ a → a = b := by
  rintro ⟨c, rfl⟩ ⟨d, hcd⟩
  rw [mul_assoc, eq_comm, mul_right_eq_self₀, mul_eq_one] at hcd
  

Proof state:
case intro.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Subsingleton αˣ
a c d : α
hcd : c = 1 ∧ d = 1 ∨ a = 0
⊢ a = a * c

Next tactic:
obtain ⟨rfl, -⟩ | rfl := hcd
theorem dvd_antisymm : a ∣ b → b ∣ a → a = b := by
  rintro ⟨c, rfl⟩ ⟨d, hcd⟩
  rw [mul_assoc, eq_comm, mul_right_eq_self₀, mul_eq_one] at hcd
  obtain ⟨rfl, -⟩ | rfl := hcd <;> 

Proof state:
case intro.intro.inl.intro
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Subsingleton αˣ
a d : α
⊢ a = a * 1

Next tactic:
simp
theorem dvd_antisymm : a ∣ b → b ∣ a → a = b := by
  rintro ⟨c, rfl⟩ ⟨d, hcd⟩
  rw [mul_assoc, eq_comm, mul_right_eq_self₀, mul_eq_one] at hcd
  obtain ⟨rfl, -⟩ | rfl := hcd <;> 

Proof state:
case intro.intro.inr
α : Type u_1
inst✝¹ : CancelCommMonoidWithZero α
inst✝ : Subsingleton αˣ
c d : α
⊢ 0 = 0 * c

Next tactic:
simp
/-- Constructs an isomorphism of lattices from an order isomorphism between them. -/
@[simps]
def Iso.mk {α β : Lat.{u}} (e : α ≃o β) : α ≅ β where
  hom := (e : LatticeHom _ _)
  inv := (e.symm : LatticeHom _ _)
  hom_inv_id := by
    

Proof state:
α β : Lat
e : ↑α ≃o ↑β
⊢ { toSupHom := { toFun := ⇑e, map_sup' := (_ : ∀ (a b : ↑α), e (a ⊔ b) = e a ⊔ e b) },
        map_inf' := (_ : ∀ (a b : ↑α), e (a ⊓ b) = e a ⊓ e b) } ≫
      {
        toSupHom :=
          { toFun := ⇑(OrderIso.symm e),
            map_sup' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊔ b) = (OrderIso.symm e) a ⊔ (OrderIso.symm e) b) },
        map_inf' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊓ b) = (OrderIso.symm e) a ⊓ (OrderIso.symm e) b) } =
    𝟙 α

Next tactic:
ext
/-- Constructs an isomorphism of lattices from an order isomorphism between them. -/
@[simps]
def Iso.mk {α β : Lat.{u}} (e : α ≃o β) : α ≅ β where
  hom := (e : LatticeHom _ _)
  inv := (e.symm : LatticeHom _ _)
  hom_inv_id := by
    ext
    

Proof state:
case w
α β : Lat
e : ↑α ≃o ↑β
x✝ : (forget Lat).obj α
⊢ ({ toSupHom := { toFun := ⇑e, map_sup' := (_ : ∀ (a b : ↑α), e (a ⊔ b) = e a ⊔ e b) },
          map_inf' := (_ : ∀ (a b : ↑α), e (a ⊓ b) = e a ⊓ e b) } ≫
        {
          toSupHom :=
            { toFun := ⇑(OrderIso.symm e),
              map_sup' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊔ b) = (OrderIso.symm e) a ⊔ (OrderIso.symm e) b) },
          map_inf' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊓ b) = (OrderIso.symm e) a ⊓ (OrderIso.symm e) b) })
      x✝ =
    (𝟙 α) x✝

Next tactic:
exact e.symm_apply_apply _
/-- Constructs an isomorphism of lattices from an order isomorphism between them. -/
@[simps]
def Iso.mk {α β : Lat.{u}} (e : α ≃o β) : α ≅ β where
  hom := (e : LatticeHom _ _)
  inv := (e.symm : LatticeHom _ _)
  hom_inv_id := by
    ext
    exact e.symm_apply_apply _
  inv_hom_id := by
    

Proof state:
α β : Lat
e : ↑α ≃o ↑β
⊢ {
        toSupHom :=
          { toFun := ⇑(OrderIso.symm e),
            map_sup' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊔ b) = (OrderIso.symm e) a ⊔ (OrderIso.symm e) b) },
        map_inf' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊓ b) = (OrderIso.symm e) a ⊓ (OrderIso.symm e) b) } ≫
      { toSupHom := { toFun := ⇑e, map_sup' := (_ : ∀ (a b : ↑α), e (a ⊔ b) = e a ⊔ e b) },
        map_inf' := (_ : ∀ (a b : ↑α), e (a ⊓ b) = e a ⊓ e b) } =
    𝟙 β

Next tactic:
ext
/-- Constructs an isomorphism of lattices from an order isomorphism between them. -/
@[simps]
def Iso.mk {α β : Lat.{u}} (e : α ≃o β) : α ≅ β where
  hom := (e : LatticeHom _ _)
  inv := (e.symm : LatticeHom _ _)
  hom_inv_id := by
    ext
    exact e.symm_apply_apply _
  inv_hom_id := by
    ext
    

Proof state:
case w
α β : Lat
e : ↑α ≃o ↑β
x✝ : (forget Lat).obj β
⊢ ({
          toSupHom :=
            { toFun := ⇑(OrderIso.symm e),
              map_sup' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊔ b) = (OrderIso.symm e) a ⊔ (OrderIso.symm e) b) },
          map_inf' := (_ : ∀ (a b : ↑β), (OrderIso.symm e) (a ⊓ b) = (OrderIso.symm e) a ⊓ (OrderIso.symm e) b) } ≫
        { toSupHom := { toFun := ⇑e, map_sup' := (_ : ∀ (a b : ↑α), e (a ⊔ b) = e a ⊔ e b) },
          map_inf' := (_ : ∀ (a b : ↑α), e (a ⊓ b) = e a ⊓ e b) })
      x✝ =
    (𝟙 β) x✝

Next tactic:
exact e.apply_symm_apply _
/-- If `a` semiconjugates a unit `x` to a unit `y`, then it semiconjugates `x⁻¹` to `y⁻¹`. -/
@[to_additive "If `a` semiconjugates an additive unit `x` to an additive unit `y`, then it
semiconjugates `-x` to `-y`."]
theorem units_inv_right {a : M} {x y : Mˣ} (h : SemiconjBy a x y) : SemiconjBy a ↑x⁻¹ ↑y⁻¹ :=
  calc
    a * ↑x⁻¹ = ↑y⁻¹ * (y * a) * ↑x⁻¹ := by 

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
a : M
x y : Mˣ
h : SemiconjBy a ↑x ↑y
⊢ a * ↑x⁻¹ = ↑y⁻¹ * (↑y * a) * ↑x⁻¹

Next tactic:
rw [Units.inv_mul_cancel_left]
/-- If `a` semiconjugates a unit `x` to a unit `y`, then it semiconjugates `x⁻¹` to `y⁻¹`. -/
@[to_additive "If `a` semiconjugates an additive unit `x` to an additive unit `y`, then it
semiconjugates `-x` to `-y`."]
theorem units_inv_right {a : M} {x y : Mˣ} (h : SemiconjBy a x y) : SemiconjBy a ↑x⁻¹ ↑y⁻¹ :=
  calc
    a * ↑x⁻¹ = ↑y⁻¹ * (y * a) * ↑x⁻¹ := by rw [Units.inv_mul_cancel_left]
    _        = ↑y⁻¹ * a              := by 

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
a : M
x y : Mˣ
h : SemiconjBy a ↑x ↑y
⊢ ↑y⁻¹ * (↑y * a) * ↑x⁻¹ = ↑y⁻¹ * a

Next tactic:
rw [← h.eq, mul_assoc, Units.mul_inv_cancel_right]
/-- If a unit `a` semiconjugates `x` to `y`, then `a⁻¹` semiconjugates `y` to `x`. -/
@[to_additive "If an additive unit `a` semiconjugates `x` to `y`, then `-a` semiconjugates `y` to
`x`."]
theorem units_inv_symm_left {a : Mˣ} {x y : M} (h : SemiconjBy (↑a) x y) : SemiconjBy (↑a⁻¹) y x :=
  calc
    ↑a⁻¹ * y = ↑a⁻¹ * (y * a * ↑a⁻¹) := by 

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
a : Mˣ
x y : M
h : SemiconjBy (↑a) x y
⊢ ↑a⁻¹ * y = ↑a⁻¹ * (y * ↑a * ↑a⁻¹)

Next tactic:
rw [Units.mul_inv_cancel_right]
/-- If a unit `a` semiconjugates `x` to `y`, then `a⁻¹` semiconjugates `y` to `x`. -/
@[to_additive "If an additive unit `a` semiconjugates `x` to `y`, then `-a` semiconjugates `y` to
`x`."]
theorem units_inv_symm_left {a : Mˣ} {x y : M} (h : SemiconjBy (↑a) x y) : SemiconjBy (↑a⁻¹) y x :=
  calc
    ↑a⁻¹ * y = ↑a⁻¹ * (y * a * ↑a⁻¹) := by rw [Units.mul_inv_cancel_right]
    _ = x * ↑a⁻¹ := by 

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
a : Mˣ
x y : M
h : SemiconjBy (↑a) x y
⊢ ↑a⁻¹ * (y * ↑a * ↑a⁻¹) = x * ↑a⁻¹

Next tactic:
rw [← h.eq, ← mul_assoc, Units.inv_mul_cancel_left]
/-- `a` semiconjugates `x` to `a * x * a⁻¹`. -/
@[to_additive "`a` semiconjugates `x` to `a + x + -a`."]
theorem Units.mk_semiconjBy [Monoid M] (u : Mˣ) (x : M) : SemiconjBy (↑u) x (u * x * ↑u⁻¹) := by
  

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
u : Mˣ
x : M
⊢ SemiconjBy (↑u) x (↑u * x * ↑u⁻¹)

Next tactic:
unfold SemiconjBy
/-- `a` semiconjugates `x` to `a * x * a⁻¹`. -/
@[to_additive "`a` semiconjugates `x` to `a + x + -a`."]
theorem Units.mk_semiconjBy [Monoid M] (u : Mˣ) (x : M) : SemiconjBy (↑u) x (u * x * ↑u⁻¹) := by
  unfold SemiconjBy; 

Proof state:
M : Type u_1
G : Type u_2
inst✝ : Monoid M
u : Mˣ
x : M
⊢ ↑u * x = ↑u * x * ↑u⁻¹ * ↑u

Next tactic:
rw [Units.inv_mul_cancel_right]
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) :
    c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
  

Proof state:
α : Type u_1
r✝ r : α → α → Prop
inst✝ : IsRefl α r
c : Cardinal.{u_1}
⊢ c ≤ cof r ↔ ∀ {S : Set α}, (∀ (a : α), ∃ b ∈ S, r a b) → c ≤ #↑S

Next tactic:
rw [cof, le_csInf_iff'' (cof_nonempty r)]
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) :
    c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
  rw [cof, le_csInf_iff'' (cof_nonempty r)]
  

Proof state:
α : Type u_1
r✝ r : α → α → Prop
inst✝ : IsRefl α r
c : Cardinal.{u_1}
⊢ (∀ b ∈ {c | ∃ S, (∀ (a : α), ∃ b ∈ S, r a b) ∧ #↑S = c}, c ≤ b) ↔ ∀ {S : Set α}, (∀ (a : α), ∃ b ∈ S, r a b) → c ≤ #↑S

Next tactic:
use fun H S h => H _ ⟨S, h, rfl⟩
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) :
    c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
  rw [cof, le_csInf_iff'' (cof_nonempty r)]
  use fun H S h => H _ ⟨S, h, rfl⟩
  

Proof state:
case mpr
α : Type u_1
r✝ r : α → α → Prop
inst✝ : IsRefl α r
c : Cardinal.{u_1}
⊢ (∀ {S : Set α}, (∀ (a : α), ∃ b ∈ S, r a b) → c ≤ #↑S) → ∀ b ∈ {c | ∃ S, (∀ (a : α), ∃ b ∈ S, r a b) ∧ #↑S = c}, c ≤ b

Next tactic:
rintro H d ⟨S, h, rfl⟩