l3lab/ntp-mathlib huggingface dataset:
theorem minimals_image_of_rel_iff_rel (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) :
    minimals s (f '' x) = f '' (minimals r x) := by
  ext a
  simp only [minimals, mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
  constructor
  · rintro ⟨⟨a, ha, rfl⟩ , h⟩
    

Proof state:
case h.mp.intro.intro.intro
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a✝ b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
a : α
ha : a ∈ x
h : ∀ a_1 ∈ x, s (f a_1) (f a) → s (f a) (f a_1)
⊢ ∃ x_1 ∈ {a | a ∈ x ∧ ∀ ⦃b : α⦄, b ∈ x → r b a → r a b}, f x_1 = f a

Next tactic:
exact ⟨a, ⟨ha, fun y hy hya ↦ (hf ha hy).mpr (h _ hy ((hf hy ha).mp hya))⟩, rfl⟩
theorem minimals_image_of_rel_iff_rel (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) :
    minimals s (f '' x) = f '' (minimals r x) := by
  ext a
  simp only [minimals, mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
  constructor
  · rintro ⟨⟨a, ha, rfl⟩ , h⟩
    exact ⟨a, ⟨ha, fun y hy hya ↦ (hf ha hy).mpr (h _ hy ((hf hy ha).mp hya))⟩, rfl⟩
  

Proof state:
case h.mpr
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a✝ b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
a : β
⊢ (∃ x_1 ∈ {a | a ∈ x ∧ ∀ ⦃b : α⦄, b ∈ x → r b a → r a b}, f x_1 = a) →
    a ∈ {a | (∃ x_1 ∈ x, f x_1 = a) ∧ ∀ a_2 ∈ x, s (f a_2) a → s a (f a_2)}

Next tactic:
rintro ⟨a,⟨⟨ha,h⟩,rfl⟩⟩
theorem minimals_image_of_rel_iff_rel (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) :
    minimals s (f '' x) = f '' (minimals r x) := by
  ext a
  simp only [minimals, mem_image, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
  constructor
  · rintro ⟨⟨a, ha, rfl⟩ , h⟩
    exact ⟨a, ⟨ha, fun y hy hya ↦ (hf ha hy).mpr (h _ hy ((hf hy ha).mp hya))⟩, rfl⟩
  rintro ⟨a,⟨⟨ha,h⟩,rfl⟩⟩
  

Proof state:
case h.mpr.intro.intro.intro
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a✝ b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
a : α
ha : a ∈ x
h : ∀ ⦃b : α⦄, b ∈ x → r b a → r a b
⊢ f a ∈ {a | (∃ x_1 ∈ x, f x_1 = a) ∧ ∀ a_1 ∈ x, s (f a_1) a → s a (f a_1)}

Next tactic:
exact ⟨⟨_, ha, rfl⟩, fun y hy hya ↦ (hf ha hy).mp (h hy ((hf hy ha).mpr hya))⟩
theorem RelEmbedding.minimals_image_eq (f : r ↪r s) (x : Set α) :
    minimals s (f '' x) = f '' (minimals r x) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
x : Set α
⊢ minimals s (⇑f '' x) = ⇑f '' minimals r x

Next tactic:
rw [minimals_image_of_rel_iff_rel]
theorem RelEmbedding.minimals_image_eq (f : r ↪r s) (x : Set α) :
    minimals s (f '' x) = f '' (minimals r x) := by
  rw [minimals_image_of_rel_iff_rel]; 

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
x : Set α
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))

Next tactic:
simp [f.map_rel_iff]
theorem inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (minimals s ((f '' x) ∩ y)) = minimals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
y : Set β
⊢ x ∩ f ⁻¹' minimals s (f '' x ∩ y) = minimals r (x ∩ f ⁻¹' y)

Next tactic:
ext a
theorem inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (minimals s ((f '' x) ∩ y)) = minimals r (x ∩ f ⁻¹' y) := by
  ext a
  

Proof state:
case h
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a✝ b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
y : Set β
a : α
⊢ a ∈ x ∩ f ⁻¹' minimals s (f '' x ∩ y) ↔ a ∈ minimals r (x ∩ f ⁻¹' y)

Next tactic:
simp only [minimals, mem_inter_iff, mem_image, and_imp, forall_exists_index,
    forall_apply_eq_imp_iff₂, preimage_setOf_eq, mem_setOf_eq, mem_preimage]
theorem inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (minimals s ((f '' x) ∩ y)) = minimals r (x ∩ f ⁻¹' y) := by
  ext a
  simp only [minimals, mem_inter_iff, mem_image, and_imp, forall_exists_index,
    forall_apply_eq_imp_iff₂, preimage_setOf_eq, mem_setOf_eq, mem_preimage]
  

Proof state:
case h
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a✝ b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
y : Set β
a : α
⊢ (a ∈ x ∧ ((∃ x_1 ∈ x, f x_1 = f a) ∧ f a ∈ y) ∧ ∀ a_1 ∈ x, f a_1 ∈ y → s (f a_1) (f a) → s (f a) (f a_1)) ↔
    (a ∈ x ∧ f a ∈ y) ∧ ∀ ⦃b : α⦄, b ∈ x → f b ∈ y → r b a → r a b

Next tactic:
exact ⟨fun ⟨hax,⟨_,hay⟩,h2⟩ ↦ ⟨⟨hax, hay⟩, fun a₁ ha₁ ha₁y ha₁a ↦
          (hf hax ha₁).mpr (h2 _ ha₁ ha₁y ((hf ha₁ hax).mp ha₁a))⟩ ,
        fun ⟨⟨hax,hay⟩,h⟩ ↦ ⟨hax, ⟨⟨_, hax, rfl⟩, hay⟩, fun a' ha' ha'y hsa' ↦
          (hf hax ha').mp (h ha' ha'y ((hf ha' hax).mpr hsa'))⟩⟩
theorem inter_preimage_minimals_eq_of_rel_iff_rel_on_of_subset
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (hy : y ⊆ f '' x) :
    x ∩ f ⁻¹' (minimals s y) = minimals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
y : Set β
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
hy : y ⊆ f '' x
⊢ x ∩ f ⁻¹' minimals s y = minimals r (x ∩ f ⁻¹' y)

Next tactic:
rw [← inter_eq_self_of_subset_right hy, inter_minimals_preimage_inter_eq_of_rel_iff_rel_on hf,
    preimage_inter, ← inter_assoc, inter_eq_self_of_subset_left (subset_preimage_image f x)]
theorem RelEmbedding.inter_preimage_minimals_eq (f : r ↪r s) (x : Set α) (y : Set β) :
    x ∩ f⁻¹' (minimals s ((f '' x) ∩ y)) = minimals r (x ∩ f ⁻¹' y) :=
  inter_minimals_preimage_inter_eq_of_rel_iff_rel_on (by 

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
x : Set α
y : Set β
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))

Next tactic:
simp [f.map_rel_iff]
theorem RelEmbedding.inter_preimage_minimals_eq_of_subset (f : r ↪r s) (h : y ⊆ f '' x) :
    x ∩ f ⁻¹' (minimals s y) = minimals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
y : Set β
x : Set α
f : r ↪r s
h : y ⊆ ⇑f '' x
⊢ x ∩ ⇑f ⁻¹' minimals s y = minimals r (x ∩ ⇑f ⁻¹' y)

Next tactic:
rw [inter_preimage_minimals_eq_of_rel_iff_rel_on_of_subset _ h]
theorem RelEmbedding.inter_preimage_minimals_eq_of_subset (f : r ↪r s) (h : y ⊆ f '' x) :
    x ∩ f ⁻¹' (minimals s y) = minimals r (x ∩ f ⁻¹' y) := by
  rw [inter_preimage_minimals_eq_of_rel_iff_rel_on_of_subset _ h]; 

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
y : Set β
x : Set α
f : r ↪r s
h : y ⊆ ⇑f '' x
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))

Next tactic:
simp [f.map_rel_iff]
theorem RelEmbedding.minimals_preimage_eq (f : r ↪r s) (y : Set β) :
    minimals r (f ⁻¹' y) = f ⁻¹' minimals s (y ∩ range f) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ minimals r (⇑f ⁻¹' y) = ⇑f ⁻¹' minimals s (y ∩ range ⇑f)

Next tactic:
convert (f.inter_preimage_minimals_eq univ y).symm
theorem RelEmbedding.minimals_preimage_eq (f : r ↪r s) (y : Set β) :
    minimals r (f ⁻¹' y) = f ⁻¹' minimals s (y ∩ range f) := by
  convert (f.inter_preimage_minimals_eq univ y).symm; 

Proof state:
case h.e'_2.h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' y = univ ∩ ⇑f ⁻¹' y
case h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' minimals s (y ∩ range ⇑f) = univ ∩ ⇑f ⁻¹' minimals s (⇑f '' univ ∩ y)

Next tactic:
simp [univ_inter]
theorem RelEmbedding.minimals_preimage_eq (f : r ↪r s) (y : Set β) :
    minimals r (f ⁻¹' y) = f ⁻¹' minimals s (y ∩ range f) := by
  convert (f.inter_preimage_minimals_eq univ y).symm; simp [univ_inter]; 

Proof state:
case h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' minimals s (y ∩ range ⇑f) = univ ∩ ⇑f ⁻¹' minimals s (⇑f '' univ ∩ y)

Next tactic:
simp [inter_comm]
theorem inter_maximals_preimage_inter_eq_of_rel_iff_rel_on
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (maximals s ((f '' x) ∩ y)) = maximals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
y : Set β
⊢ x ∩ f ⁻¹' maximals s (f '' x ∩ y) = maximals r (x ∩ f ⁻¹' y)

Next tactic:
apply inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
theorem inter_maximals_preimage_inter_eq_of_rel_iff_rel_on
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (y : Set β) :
    x ∩ f ⁻¹' (maximals s ((f '' x) ∩ y)) = maximals r (x ∩ f ⁻¹' y) := by
  apply inter_minimals_preimage_inter_eq_of_rel_iff_rel_on
  

Proof state:
case hf
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
y : Set β
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a' a ↔ s (f a') (f a))

Next tactic:
exact fun _ _ a b ↦ hf b a
theorem inter_preimage_maximals_eq_of_rel_iff_rel_on_of_subset
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (hy : y ⊆ f '' x) :
    x ∩ f ⁻¹' (maximals s y) = maximals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
y : Set β
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
hy : y ⊆ f '' x
⊢ x ∩ f ⁻¹' maximals s y = maximals r (x ∩ f ⁻¹' y)

Next tactic:
apply inter_preimage_minimals_eq_of_rel_iff_rel_on_of_subset _ hy
theorem inter_preimage_maximals_eq_of_rel_iff_rel_on_of_subset
    (hf : ∀ ⦃a a'⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))) (hy : y ⊆ f '' x) :
    x ∩ f ⁻¹' (maximals s y) = maximals r (x ∩ f ⁻¹' y) := by
  apply inter_preimage_minimals_eq_of_rel_iff_rel_on_of_subset _ hy
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f : α → β
r : α → α → Prop
s : β → β → Prop
x : Set α
y : Set β
hf : ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))
hy : y ⊆ f '' x
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a' a ↔ s (f a') (f a))

Next tactic:
exact fun _ _ a b ↦ hf b a
theorem RelEmbedding.inter_preimage_maximals_eq (f : r ↪r s) (x : Set α) (y : Set β) :
    x ∩ f⁻¹' (maximals s ((f '' x) ∩ y)) = maximals r (x ∩ f ⁻¹' y) :=
  inter_minimals_preimage_inter_eq_of_rel_iff_rel_on (by 

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
x : Set α
y : Set β
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a' a ↔ s (f a') (f a))

Next tactic:
simp [f.map_rel_iff]
theorem RelEmbedding.inter_preimage_maximals_eq_of_subset (f : r ↪r s) (h : y ⊆ f '' x) :
    x ∩ f ⁻¹' (maximals s y) = maximals r (x ∩ f ⁻¹' y) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
y : Set β
x : Set α
f : r ↪r s
h : y ⊆ ⇑f '' x
⊢ x ∩ ⇑f ⁻¹' maximals s y = maximals r (x ∩ ⇑f ⁻¹' y)

Next tactic:
rw [inter_preimage_maximals_eq_of_rel_iff_rel_on_of_subset _ h]
theorem RelEmbedding.inter_preimage_maximals_eq_of_subset (f : r ↪r s) (h : y ⊆ f '' x) :
    x ∩ f ⁻¹' (maximals s y) = maximals r (x ∩ f ⁻¹' y) := by
  rw [inter_preimage_maximals_eq_of_rel_iff_rel_on_of_subset _ h]; 

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
y : Set β
x : Set α
f : r ↪r s
h : y ⊆ ⇑f '' x
⊢ ∀ ⦃a a' : α⦄, a ∈ x → a' ∈ x → (r a a' ↔ s (f a) (f a'))

Next tactic:
simp [f.map_rel_iff]
theorem RelEmbedding.maximals_preimage_eq (f : r ↪r s) (y : Set β) :
    maximals r (f ⁻¹' y) = f ⁻¹' maximals s (y ∩ range f) := by
  

Proof state:
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ maximals r (⇑f ⁻¹' y) = ⇑f ⁻¹' maximals s (y ∩ range ⇑f)

Next tactic:
convert (f.inter_preimage_maximals_eq univ y).symm
theorem RelEmbedding.maximals_preimage_eq (f : r ↪r s) (y : Set β) :
    maximals r (f ⁻¹' y) = f ⁻¹' maximals s (y ∩ range f) := by
  convert (f.inter_preimage_maximals_eq univ y).symm; 

Proof state:
case h.e'_2.h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' y = univ ∩ ⇑f ⁻¹' y
case h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' maximals s (y ∩ range ⇑f) = univ ∩ ⇑f ⁻¹' maximals s (⇑f '' univ ∩ y)

Next tactic:
simp [univ_inter]
theorem RelEmbedding.maximals_preimage_eq (f : r ↪r s) (y : Set β) :
    maximals r (f ⁻¹' y) = f ⁻¹' maximals s (y ∩ range f) := by
  convert (f.inter_preimage_maximals_eq univ y).symm; simp [univ_inter]; 

Proof state:
case h.e'_3
β : Type u_2
α : Type u_1
r✝ r₁ r₂ : α → α → Prop
s✝ t : Set α
a b : α
inst✝ : PartialOrder α
f✝ : α → β
r : α → α → Prop
s : β → β → Prop
f : r ↪r s
y : Set β
⊢ ⇑f ⁻¹' maximals s (y ∩ range ⇑f) = univ ∩ ⇑f ⁻¹' maximals s (⇑f '' univ ∩ y)

Next tactic:
simp [inter_comm]
theorem minimals_Icc (hab : a ≤ b) : minimals (· ≤ ·) (Icc a b) = {a} := by
  

Proof state:
α : Type u_1
r r₁ r₂ : α → α → Prop
s t : Set α
a✝ b✝ : α
inst✝¹ inst✝ : PartialOrder α
a b : α
hab : a ≤ b
⊢ minimals (fun x x_1 => x ≤ x_1) (Icc a b) = {a}

Next tactic:
simp_rw [Icc, and_comm (a := (a ≤ _))]
theorem minimals_Icc (hab : a ≤ b) : minimals (· ≤ ·) (Icc a b) = {a} := by
  simp_rw [Icc, and_comm (a := (a ≤ _))]; 

Proof state:
α : Type u_1
r r₁ r₂ : α → α → Prop
s t : Set α
a✝ b✝ : α
inst✝¹ inst✝ : PartialOrder α
a b : α
hab : a ≤ b
⊢ minimals (fun x x_1 => x ≤ x_1) {x | x ≤ b ∧ a ≤ x} = {a}

Next tactic:
exact maximals_Icc (α := αᵒᵈ) hab
theorem minimals_Ico (hab : a < b) : minimals (· ≤ ·) (Ico a b) = {a} := by
  

Proof state:
α : Type u_1
r r₁ r₂ : α → α → Prop
s t : Set α
a✝ b✝ : α
inst✝¹ inst✝ : PartialOrder α
a b : α
hab : a < b
⊢ minimals (fun x x_1 => x ≤ x_1) (Ico a b) = {a}

Next tactic:
simp_rw [Ico, and_comm (a := _ ≤ _)]
theorem minimals_Ico (hab : a < b) : minimals (· ≤ ·) (Ico a b) = {a} := by
  simp_rw [Ico, and_comm (a := _ ≤ _)]; 

Proof state:
α : Type u_1
r r₁ r₂ : α → α → Prop
s t : Set α
a✝ b✝ : α
inst✝¹ inst✝ : PartialOrder α
a b : α
hab : a < b
⊢ minimals (fun x x_1 => x ≤ x_1) {x | x < b ∧ a ≤ x} = {a}

Next tactic:
exact maximals_Ioc (α := αᵒᵈ) hab
/-- The category of `MonoOver α`, for `α : Type u`, is equivalent to the partial order `Set α`.
-/
@[simps]
noncomputable def Types.monoOverEquivalenceSet (α : Type u) : MonoOver α ≌ Set α where
  functor :=
    { obj := fun f => Set.range f.1.hom
      map := fun {f g} t =>
        homOfLE
          (by
            

Proof state:
α : Type u
f g : MonoOver α
t : f ⟶ g
⊢ (fun f => Set.range f.obj.hom) f ≤ (fun f => Set.range f.obj.hom) g

Next tactic:
rintro a ⟨x, rfl⟩
/-- The category of `MonoOver α`, for `α : Type u`, is equivalent to the partial order `Set α`.
-/
@[simps]
noncomputable def Types.monoOverEquivalenceSet (α : Type u) : MonoOver α ≌ Set α where
  functor :=
    { obj := fun f => Set.range f.1.hom
      map := fun {f g} t =>
        homOfLE
          (by
            rintro a ⟨x, rfl⟩
            

Proof state:
case intro
α : Type u
f g : MonoOver α
t : f ⟶ g
x : (𝟭 (Type u)).obj f.obj.left
⊢ Comma.hom f.obj x ∈ (fun f => Set.range f.obj.hom) g

Next tactic:
exact ⟨t.1 x, congr_fun t.w x⟩
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
l : List α
x : α
hx : x ∉ l
⊢ Set.InjOn (fun k => insertNth k x l) {n | n ≤ length l}

Next tactic:
induction' l with hd tl IH
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
hx : x ∉ []
⊢ Set.InjOn (fun k => insertNth k x []) {n | n ≤ length []}

Next tactic:
intro n hn m hm _
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
hx : x ∉ []
n : ℕ
hn : n ∈ {n | n ≤ length []}
m : ℕ
hm : m ∈ {n | n ≤ length []}
a✝ : (fun k => insertNth k x []) n = (fun k => insertNth k x []) m
⊢ n = m

Next tactic:
simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    

Proof state:
case nil
α : Type u_1
β : Type u_2
γ : Type u_3
x : α
hx : x ∉ []
n m : ℕ
a✝ : (fun k => insertNth k x []) n = (fun k => insertNth k x []) m
hn : n = 0
hm : m = 0
⊢ n = m

Next tactic:
simp [hn, hm]
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · 

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
hx : x ∉ hd :: tl
⊢ Set.InjOn (fun k => insertNth k x (hd :: tl)) {n | n ≤ length (hd :: tl)}

Next tactic:
intro n hn m hm h
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
hx : x ∉ hd :: tl
n : ℕ
hn : n ∈ {n | n ≤ length (hd :: tl)}
m : ℕ
hm : m ∈ {n | n ≤ length (hd :: tl)}
h : (fun k => insertNth k x (hd :: tl)) n = (fun k => insertNth k x (hd :: tl)) m
⊢ n = m

Next tactic:
simp only [length, Set.mem_setOf_eq] at hn hm
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    simp only [length, Set.mem_setOf_eq] at hn hm
    

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
hx : x ∉ hd :: tl
n : ℕ
hn : n ≤ length tl + 1
m : ℕ
hm : m ≤ length tl + 1
h : (fun k => insertNth k x (hd :: tl)) n = (fun k => insertNth k x (hd :: tl)) m
⊢ n = m

Next tactic:
simp only [mem_cons, not_or] at hx
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    simp only [length, Set.mem_setOf_eq] at hn hm
    simp only [mem_cons, not_or] at hx
    

Proof state:
case cons
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
n : ℕ
hn : n ≤ length tl + 1
m : ℕ
hm : m ≤ length tl + 1
h : (fun k => insertNth k x (hd :: tl)) n = (fun k => insertNth k x (hd :: tl)) m
hx : ¬x = hd ∧ x ∉ tl
⊢ n = m

Next tactic:
cases n
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    simp only [length, Set.mem_setOf_eq] at hn hm
    simp only [mem_cons, not_or] at hx
    cases n <;> 

Proof state:
case cons.zero
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
m : ℕ
hm : m ≤ length tl + 1
hx : ¬x = hd ∧ x ∉ tl
hn : Nat.zero ≤ length tl + 1
h : (fun k => insertNth k x (hd :: tl)) Nat.zero = (fun k => insertNth k x (hd :: tl)) m
⊢ Nat.zero = m

Next tactic:
cases m
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    simp only [length, Set.mem_setOf_eq] at hn hm
    simp only [mem_cons, not_or] at hx
    cases n <;> 

Proof state:
case cons.succ
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
m : ℕ
hm : m ≤ length tl + 1
hx : ¬x = hd ∧ x ∉ tl
n✝ : ℕ
hn : Nat.succ n✝ ≤ length tl + 1
h : (fun k => insertNth k x (hd :: tl)) (Nat.succ n✝) = (fun k => insertNth k x (hd :: tl)) m
⊢ Nat.succ n✝ = m

Next tactic:
cases m
theorem injOn_insertNth_index_of_not_mem (l : List α) (x : α) (hx : x ∉ l) :
    Set.InjOn (fun k => insertNth k x l) { n | n ≤ l.length } := by
  induction' l with hd tl IH
  · intro n hn m hm _
    simp only [Set.mem_singleton_iff, Set.setOf_eq_eq_singleton,
      length, nonpos_iff_eq_zero] at hn hm
    simp [hn, hm]
  · intro n hn m hm h
    simp only [length, Set.mem_setOf_eq] at hn hm
    simp only [mem_cons, not_or] at hx
    cases n <;> cases m
    · 

Proof state:
case cons.zero.zero
α : Type u_1
β : Type u_2
γ : Type u_3
x hd : α
tl : List α
IH : x ∉ tl → Set.InjOn (fun k => insertNth k x tl) {n | n ≤ length tl}
hx : ¬x = hd ∧ x ∉ tl
hn hm : Nat.zero ≤ length tl + 1
h : (fun k => insertNth k x (hd :: tl)) Nat.zero = (fun k => insertNth k x (hd :: tl)) Nat.zero
⊢ Nat.zero = Nat.zero

Next tactic:
rfl