l3lab/ntp-mathlib huggingface dataset:
theorem arcsin_eq_arctan {x : ℝ} (h : x ∈ Ioo (-(1 : ℝ)) 1) :
    arcsin x = arctan (x / sqrt (1 - x ^ 2)) := by
  rw_mod_cast [arctan_eq_arcsin, div_pow, sq_sqrt, one_add_div, div_div, ← sqrt_mul,
    mul_div_cancel', sub_add_cancel, sqrt_one, div_one] <;> simp at h <;> 

Proof state:
case hx
x : ℝ
h : -1 < x ∧ x < 1
⊢ 0 ≤ 1 - x ^ 2

Next tactic:
nlinarith [h.1, h.2]
theorem arcsin_eq_arctan {x : ℝ} (h : x ∈ Ioo (-(1 : ℝ)) 1) :
    arcsin x = arctan (x / sqrt (1 - x ^ 2)) := by
  rw_mod_cast [arctan_eq_arcsin, div_pow, sq_sqrt, one_add_div, div_div, ← sqrt_mul,
    mul_div_cancel', sub_add_cancel, sqrt_one, div_one] <;> simp at h <;> 

Proof state:
x : ℝ
h : -1 < x ∧ x < 1
⊢ 1 - x ^ 2 ≠ 0

Next tactic:
nlinarith [h.1, h.2]
theorem arcsin_eq_arctan {x : ℝ} (h : x ∈ Ioo (-(1 : ℝ)) 1) :
    arcsin x = arctan (x / sqrt (1 - x ^ 2)) := by
  rw_mod_cast [arctan_eq_arcsin, div_pow, sq_sqrt, one_add_div, div_div, ← sqrt_mul,
    mul_div_cancel', sub_add_cancel, sqrt_one, div_one] <;> simp at h <;> 

Proof state:
x : ℝ
h : -1 < x ∧ x < 1
⊢ 0 ≤ 1 - x ^ 2

Next tactic:
nlinarith [h.1, h.2]
@[simp]
theorem arctan_zero : arctan 0 = 0 := by 

Proof state:
⊢ arctan 0 = 0

Next tactic:
simp [arctan_eq_arcsin]
theorem arctan_eq_of_tan_eq {x y : ℝ} (h : tan x = y) (hx : x ∈ Ioo (-(π / 2)) (π / 2)) :
    arctan y = x :=
  injOn_tan (arctan_mem_Ioo _) hx (by 

Proof state:
x y : ℝ
h : tan x = y
hx : x ∈ Ioo (-(π / 2)) (π / 2)
⊢ tan (arctan y) = tan x

Next tactic:
rw [tan_arctan, h]
@[simp]
theorem arctan_one : arctan 1 = π / 4 :=
  arctan_eq_of_tan_eq tan_pi_div_four <| by 

Proof state:
⊢ π / 4 ∈ Ioo (-(π / 2)) (π / 2)

Next tactic:
constructor
@[simp]
theorem arctan_one : arctan 1 = π / 4 :=
  arctan_eq_of_tan_eq tan_pi_div_four <| by constructor <;> 

Proof state:
case left
⊢ -(π / 2) < π / 4

Next tactic:
linarith [pi_pos]
@[simp]
theorem arctan_one : arctan 1 = π / 4 :=
  arctan_eq_of_tan_eq tan_pi_div_four <| by constructor <;> 

Proof state:
case right
⊢ π / 4 < π / 2

Next tactic:
linarith [pi_pos]
@[simp]
theorem arctan_neg (x : ℝ) : arctan (-x) = -arctan x := by 

Proof state:
x : ℝ
⊢ arctan (-x) = -arctan x

Next tactic:
simp [arctan_eq_arcsin, neg_div]
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  

Proof state:
x : ℝ
h : 0 ≤ x
⊢ arctan x = arccos (sqrt (1 + x ^ 2))⁻¹

Next tactic:
rw [arctan_eq_arcsin, arccos_eq_arcsin]
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; 

Proof state:
x : ℝ
h : 0 ≤ x
⊢ arcsin (x / sqrt (1 + x ^ 2)) = arcsin (sqrt (1 - (sqrt (1 + x ^ 2))⁻¹ ^ 2))
x : ℝ h : 0 ≤ x ⊢ 0 ≤ (sqrt (1 + x ^ 2))⁻¹

Next tactic:
swap
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · 

Proof state:
x : ℝ
h : 0 ≤ x
⊢ 0 ≤ (sqrt (1 + x ^ 2))⁻¹

Next tactic:
exact inv_nonneg.2 (sqrt_nonneg _)
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  

Proof state:
x : ℝ
h : 0 ≤ x
⊢ arcsin (x / sqrt (1 + x ^ 2)) = arcsin (sqrt (1 - (sqrt (1 + x ^ 2))⁻¹ ^ 2))

Next tactic:
congr 1
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  congr 1
  

Proof state:
case e_a
x : ℝ
h : 0 ≤ x
⊢ x / sqrt (1 + x ^ 2) = sqrt (1 - (sqrt (1 + x ^ 2))⁻¹ ^ 2)

Next tactic:
rw_mod_cast [← sqrt_inv, sq_sqrt, ← one_div, one_sub_div, add_sub_cancel', sqrt_div, sqrt_sq h]
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  congr 1
  rw_mod_cast [← sqrt_inv, sq_sqrt, ← one_div, one_sub_div, add_sub_cancel', sqrt_div, sqrt_sq h]
  

Proof state:
case e_a.hx
x : ℝ
h : 0 ≤ x
⊢ 0 ≤ x ^ 2
case e_a
x : ℝ
h : 0 ≤ x
⊢ 1 + x ^ 2 ≠ 0
case e_a x : ℝ h : 0 ≤ x ⊢ 0 ≤ (1 + x ^ 2)⁻¹

Next tactic:
all_goals positivity
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  congr 1
  rw_mod_cast [← sqrt_inv, sq_sqrt, ← one_div, one_sub_div, add_sub_cancel', sqrt_div, sqrt_sq h]
  all_goals 

Proof state:
case e_a.hx
x : ℝ
h : 0 ≤ x
⊢ 0 ≤ x ^ 2

Next tactic:
positivity
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  congr 1
  rw_mod_cast [← sqrt_inv, sq_sqrt, ← one_div, one_sub_div, add_sub_cancel', sqrt_div, sqrt_sq h]
  all_goals 

Proof state:
case e_a
x : ℝ
h : 0 ≤ x
⊢ 1 + x ^ 2 ≠ 0

Next tactic:
positivity
theorem arctan_eq_arccos {x : ℝ} (h : 0 ≤ x) : arctan x = arccos (sqrt (1 + x ^ 2))⁻¹ := by
  rw [arctan_eq_arcsin, arccos_eq_arcsin]; swap; · exact inv_nonneg.2 (sqrt_nonneg _)
  congr 1
  rw_mod_cast [← sqrt_inv, sq_sqrt, ← one_div, one_sub_div, add_sub_cancel', sqrt_div, sqrt_sq h]
  all_goals 

Proof state:
case e_a
x : ℝ
h : 0 ≤ x
⊢ 0 ≤ (1 + x ^ 2)⁻¹

Next tactic:
positivity
theorem arccos_eq_arctan {x : ℝ} (h : 0 < x) : arccos x = arctan (sqrt (1 - x ^ 2) / x) := by
  

Proof state:
x : ℝ
h : 0 < x
⊢ arccos x = arctan (sqrt (1 - x ^ 2) / x)

Next tactic:
rw [arccos, eq_comm]
theorem arccos_eq_arctan {x : ℝ} (h : 0 < x) : arccos x = arctan (sqrt (1 - x ^ 2) / x) := by
  rw [arccos, eq_comm]
  

Proof state:
x : ℝ
h : 0 < x
⊢ arctan (sqrt (1 - x ^ 2) / x) = π / 2 - arcsin x

Next tactic:
refine' arctan_eq_of_tan_eq _ ⟨_, _⟩
theorem arccos_eq_arctan {x : ℝ} (h : 0 < x) : arccos x = arctan (sqrt (1 - x ^ 2) / x) := by
  rw [arccos, eq_comm]
  refine' arctan_eq_of_tan_eq _ ⟨_, _⟩
  · 

Proof state:
case refine'_1
x : ℝ
h : 0 < x
⊢ tan (π / 2 - arcsin x) = sqrt (1 - x ^ 2) / x

Next tactic:
rw_mod_cast [tan_pi_div_two_sub, tan_arcsin, inv_div]
theorem arccos_eq_arctan {x : ℝ} (h : 0 < x) : arccos x = arctan (sqrt (1 - x ^ 2) / x) := by
  rw [arccos, eq_comm]
  refine' arctan_eq_of_tan_eq _ ⟨_, _⟩
  · rw_mod_cast [tan_pi_div_two_sub, tan_arcsin, inv_div]
  · 

Proof state:
case refine'_2
x : ℝ
h : 0 < x
⊢ -(π / 2) < π / 2 - arcsin x

Next tactic:
linarith only [arcsin_le_pi_div_two x, pi_pos]
theorem arccos_eq_arctan {x : ℝ} (h : 0 < x) : arccos x = arctan (sqrt (1 - x ^ 2) / x) := by
  rw [arccos, eq_comm]
  refine' arctan_eq_of_tan_eq _ ⟨_, _⟩
  · rw_mod_cast [tan_pi_div_two_sub, tan_arcsin, inv_div]
  · linarith only [arcsin_le_pi_div_two x, pi_pos]
  · 

Proof state:
case refine'_3
x : ℝ
h : 0 < x
⊢ π / 2 - arcsin x < π / 2

Next tactic:
linarith only [arcsin_pos.2 h]
theorem directedOn_iff_directed {s} : @DirectedOn α r s ↔ Directed r (Subtype.val : s → α) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
s : Set α
⊢ DirectedOn r s ↔ Directed r Subtype.val

Next tactic:
simp [Directed, DirectedOn]
theorem directedOn_iff_directed {s} : @DirectedOn α r s ↔ Directed r (Subtype.val : s → α) := by
  simp [Directed, DirectedOn]; 

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
s : Set α
⊢ (∀ x ∈ s, ∀ y ∈ s, ∃ z ∈ s, r x z ∧ r y z) ↔ ∀ a ∈ s, ∀ a_1 ∈ s, ∃ a_2, r a a_2 ∧ a_2 ∈ s ∧ r a_1 a_2

Next tactic:
refine' ball_congr fun x _ => by simp [And.comm, and_assoc]
theorem directedOn_iff_directed {s} : @DirectedOn α r s ↔ Directed r (Subtype.val : s → α) := by
  simp [Directed, DirectedOn]; refine' ball_congr fun x _ => by 

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
s : Set α
x : α
x✝ : x ∈ s
⊢ (∀ y ∈ s, ∃ z ∈ s, r x z ∧ r y z) ↔ ∀ a ∈ s, ∃ a_1, r x a_1 ∧ a_1 ∈ s ∧ r a a_1

Next tactic:
simp [And.comm, and_assoc]
theorem directedOn_range {f : ι → α} : Directed r f ↔ DirectedOn r (Set.range f) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
f : ι → α
⊢ Directed r f ↔ DirectedOn r (Set.range f)

Next tactic:
simp_rw [Directed, DirectedOn, Set.forall_range_iff, Set.exists_range_iff]
theorem directedOn_image {s : Set β} {f : β → α} :
    DirectedOn r (f '' s) ↔ DirectedOn (f ⁻¹'o r) s := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
s : Set β
f : β → α
⊢ DirectedOn r (f '' s) ↔ DirectedOn (f ⁻¹'o r) s

Next tactic:
simp only [DirectedOn, Set.mem_image, exists_exists_and_eq_and, forall_exists_index, and_imp,
    forall_apply_eq_imp_iff₂, Order.Preimage]
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
⊢ Directed (fun x x_1 => x ≤ x_1) (extend e f ⊥)

Next tactic:
intro a b
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
a b : β
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ a) (extend e f ⊥ z) ∧ (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ z)

Next tactic:
rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · 

Proof state:
case inl
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
a b : β
ha : ¬∃ i, e i = a
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ a) (extend e f ⊥ z) ∧ (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ z)

Next tactic:
use b
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    

Proof state:
case h
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
a b : β
ha : ¬∃ i, e i = a
⊢ (fun x x_1 => x ≤ x_1) (extend e f ⊥ a) (extend e f ⊥ b) ∧ (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ b)

Next tactic:
simp [Function.extend_apply' _ _ _ ha]
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  

Proof state:
case inr.intro
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
b : β
i : ι
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ z) ∧
      (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ z)

Next tactic:
rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
  · 

Proof state:
case inr.intro.inl
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
b : β
i : ι
hb : ¬∃ i, e i = b
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ z) ∧
      (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ z)

Next tactic:
use e i
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
  · use e i
    

Proof state:
case h
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
b : β
i : ι
hb : ¬∃ i, e i = b
⊢ (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ (e i)) ∧
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ b) (extend e f ⊥ (e i))

Next tactic:
simp [Function.extend_apply' _ _ _ hb]
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
  · use e i
    simp [Function.extend_apply' _ _ _ hb]
  

Proof state:
case inr.intro.inr.intro
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
i j : ι
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ z) ∧
      (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e j)) (extend e f ⊥ z)

Next tactic:
rcases hf i j with ⟨k, hi, hj⟩
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
  · use e i
    simp [Function.extend_apply' _ _ _ hb]
  rcases hf i j with ⟨k, hi, hj⟩
  

Proof state:
case inr.intro.inr.intro.intro.intro
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
i j k : ι
hi : f i ≤ f k
hj : f j ≤ f k
⊢ ∃ z,
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ z) ∧
      (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e j)) (extend e f ⊥ z)

Next tactic:
use e k
theorem Directed.extend_bot [Preorder α] [OrderBot α] {e : ι → β} {f : ι → α}
    (hf : Directed (· ≤ ·) f) (he : Function.Injective e) :
    Directed (· ≤ ·) (Function.extend e f ⊥) := by
  intro a b
  rcases (em (∃ i, e i = a)).symm with (ha | ⟨i, rfl⟩)
  · use b
    simp [Function.extend_apply' _ _ _ ha]
  rcases (em (∃ i, e i = b)).symm with (hb | ⟨j, rfl⟩)
  · use e i
    simp [Function.extend_apply' _ _ _ hb]
  rcases hf i j with ⟨k, hi, hj⟩
  use e k
  

Proof state:
case h
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : Preorder α
inst✝ : OrderBot α
e : ι → β
f : ι → α
hf : Directed (fun x x_1 => x ≤ x_1) f
he : Injective e
i j k : ι
hi : f i ≤ f k
hj : f j ≤ f k
⊢ (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e i)) (extend e f ⊥ (e k)) ∧
    (fun x x_1 => x ≤ x_1) (extend e f ⊥ (e j)) (extend e f ⊥ (e k))

Next tactic:
simp only [he.extend_apply, *, true_and_iff]
instance OrderDual.isDirected_ge [LE α] [IsDirected α (· ≤ ·)] : IsDirected αᵒᵈ (· ≥ ·) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : LE α
inst✝ : IsDirected α fun x x_1 => x ≤ x_1
⊢ IsDirected αᵒᵈ fun x x_1 => x ≥ x_1

Next tactic:
assumption
instance OrderDual.isDirected_le [LE α] [IsDirected α (· ≥ ·)] : IsDirected αᵒᵈ (· ≤ ·) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝¹ : LE α
inst✝ : IsDirected α fun x x_1 => x ≥ x_1
⊢ IsDirected αᵒᵈ fun x x_1 => x ≤ x_1

Next tactic:
assumption
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
a : α
s : Set α
hd : DirectedOn r s
ha : ∀ b ∈ s, ∃ c ∈ s, r a c ∧ r b c
⊢ DirectedOn r (insert a s)

Next tactic:
rintro x (rfl | hx) y (rfl | hy)
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · 

Proof state:
case inl.inl
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
s : Set α
hd : DirectedOn r s
y : α
ha : ∀ b ∈ s, ∃ c ∈ s, r y c ∧ r b c
⊢ ∃ z ∈ insert y s, r y z ∧ r y z

Next tactic:
exact ⟨y, Set.mem_insert _ _, h _, h _⟩
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · 

Proof state:
case inl.inr
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
s : Set α
hd : DirectedOn r s
x : α
ha : ∀ b ∈ s, ∃ c ∈ s, r x c ∧ r b c
y : α
hy : y ∈ s
⊢ ∃ z ∈ insert x s, r x z ∧ r y z

Next tactic:
obtain ⟨w, hws, hwr⟩ := ha y hy
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · obtain ⟨w, hws, hwr⟩ := ha y hy
    

Proof state:
case inl.inr.intro.intro
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
s : Set α
hd : DirectedOn r s
x : α
ha : ∀ b ∈ s, ∃ c ∈ s, r x c ∧ r b c
y : α
hy : y ∈ s
w : α
hws : w ∈ s
hwr : r x w ∧ r y w
⊢ ∃ z ∈ insert x s, r x z ∧ r y z

Next tactic:
exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · obtain ⟨w, hws, hwr⟩ := ha y hy
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
  · 

Proof state:
case inr.inl
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
s : Set α
hd : DirectedOn r s
x : α
hx : x ∈ s
y : α
ha : ∀ b ∈ s, ∃ c ∈ s, r y c ∧ r b c
⊢ ∃ z ∈ insert y s, r x z ∧ r y z

Next tactic:
obtain ⟨w, hws, hwr⟩ := ha x hx
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · obtain ⟨w, hws, hwr⟩ := ha y hy
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
  · obtain ⟨w, hws, hwr⟩ := ha x hx
    

Proof state:
case inr.inl.intro.intro
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
s : Set α
hd : DirectedOn r s
x : α
hx : x ∈ s
y : α
ha : ∀ b ∈ s, ∃ c ∈ s, r y c ∧ r b c
w : α
hws : w ∈ s
hwr : r y w ∧ r x w
⊢ ∃ z ∈ insert y s, r x z ∧ r y z

Next tactic:
exact ⟨w, Set.mem_insert_of_mem _ hws, hwr.symm⟩
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · obtain ⟨w, hws, hwr⟩ := ha y hy
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
  · obtain ⟨w, hws, hwr⟩ := ha x hx
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr.symm⟩
  · 

Proof state:
case inr.inr
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
a : α
s : Set α
hd : DirectedOn r s
ha : ∀ b ∈ s, ∃ c ∈ s, r a c ∧ r b c
x : α
hx : x ∈ s
y : α
hy : y ∈ s
⊢ ∃ z ∈ insert a s, r x z ∧ r y z

Next tactic:
obtain ⟨w, hws, hwr⟩ := hd x hx y hy
protected theorem DirectedOn.insert (h : Reflexive r) (a : α) {s : Set α} (hd : DirectedOn r s)
    (ha : ∀ b ∈ s, ∃ c ∈ s, a ≼ c ∧ b ≼ c) : DirectedOn r (insert a s) := by
  rintro x (rfl | hx) y (rfl | hy)
  · exact ⟨y, Set.mem_insert _ _, h _, h _⟩
  · obtain ⟨w, hws, hwr⟩ := ha y hy
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
  · obtain ⟨w, hws, hwr⟩ := ha x hx
    exact ⟨w, Set.mem_insert_of_mem _ hws, hwr.symm⟩
  · obtain ⟨w, hws, hwr⟩ := hd x hx y hy
    

Proof state:
case inr.inr.intro.intro
α : Type u
β : Type v
ι : Sort w
r r' s✝ : α → α → Prop
h : Reflexive r
a : α
s : Set α
hd : DirectedOn r s
ha : ∀ b ∈ s, ∃ c ∈ s, r a c ∧ r b c
x : α
hx : x ∈ s
y : α
hy : y ∈ s
w : α
hws : w ∈ s
hwr : r x w ∧ r y w
⊢ ∃ z ∈ insert a s, r x z ∧ r y z

Next tactic:
exact ⟨w, Set.mem_insert_of_mem _ hws, hwr⟩
theorem directedOn_pair' (h : Reflexive r) {a b : α} (hab : a ≼ b) :
    DirectedOn r ({b, a} : Set α) := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
h : Reflexive r
a b : α
hab : r a b
⊢ DirectedOn r {b, a}

Next tactic:
rw [Set.pair_comm]
theorem directedOn_pair' (h : Reflexive r) {a b : α} (hab : a ≼ b) :
    DirectedOn r ({b, a} : Set α) := by
  rw [Set.pair_comm]
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
h : Reflexive r
a b : α
hab : r a b
⊢ DirectedOn r {a, b}

Next tactic:
apply directedOn_pair h hab
theorem exists_lt_of_directed_ge [IsDirected β (· ≥ ·)] [Nontrivial β] : ∃ a b : β, a < b := by
  

Proof state:
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝³ : Preorder α
a : α
inst✝² : PartialOrder β
inst✝¹ : IsDirected β fun x x_1 => x ≥ x_1
inst✝ : Nontrivial β
⊢ ∃ a b, a < b

Next tactic:
rcases exists_pair_ne β with ⟨a, b, hne⟩
theorem exists_lt_of_directed_ge [IsDirected β (· ≥ ·)] [Nontrivial β] : ∃ a b : β, a < b := by
  rcases exists_pair_ne β with ⟨a, b, hne⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝³ : Preorder α
a✝ : α
inst✝² : PartialOrder β
inst✝¹ : IsDirected β fun x x_1 => x ≥ x_1
inst✝ : Nontrivial β
a b : β
hne : a ≠ b
⊢ ∃ a b, a < b

Next tactic:
rcases isBot_or_exists_lt a with (ha | ⟨c, hc⟩)
theorem exists_lt_of_directed_ge [IsDirected β (· ≥ ·)] [Nontrivial β] : ∃ a b : β, a < b := by
  rcases exists_pair_ne β with ⟨a, b, hne⟩
  rcases isBot_or_exists_lt a with (ha | ⟨c, hc⟩)
  

Proof state:
case intro.intro.inl
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝³ : Preorder α
a✝ : α
inst✝² : PartialOrder β
inst✝¹ : IsDirected β fun x x_1 => x ≥ x_1
inst✝ : Nontrivial β
a b : β
hne : a ≠ b
ha : IsBot a
⊢ ∃ a b, a < b
case intro.intro.inr.intro
α : Type u
β : Type v
ι : Sort w
r r' s : α → α → Prop
inst✝³ : Preorder α
a✝ : α
inst✝² : PartialOrder β
inst✝¹ : IsDirected β fun x x_1 => x ≥ x_1
inst✝ : Nontrivial β
a b : β
hne : a ≠ b
c : β
hc : c < a
⊢ ∃ a b, a < b

Next tactic:
exacts [⟨a, b, (ha b).lt_of_ne hne⟩, ⟨_, _, hc⟩]
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a b c : FreeAlgebra R X), a * b * c = a * (b * c)

Next tactic:
rintro ⟨⟩ ⟨⟩ ⟨⟩
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    

Proof state:
case mk.mk.mk
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
a✝³ : FreeAlgebra R X
a✝² : Pre R X
b✝ : FreeAlgebra R X
a✝¹ : Pre R X
c✝ : FreeAlgebra R X
a✝ : Pre R X
⊢ Quot.mk (Rel R X) a✝² * Quot.mk (Rel R X) a✝¹ * Quot.mk (Rel R X) a✝ =
    Quot.mk (Rel R X) a✝² * (Quot.mk (Rel R X) a✝¹ * Quot.mk (Rel R X) a✝)

Next tactic:
exact Quot.sound Rel.mul_assoc
instance instMonoidWithZero : MonoidWithZero (FreeAlgebra R X) where
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound Rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    

Proof state:
R : Type u_1
inst✝ : CommSemiring R
X : Type u_2
⊢ ∀ (a : FreeAlgebra R X), 1 * a = a

Next tactic:
rintro ⟨⟩