l3lab/ntp-mathlib huggingface dataset:
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
c : α
hc : z < c
hcy : c < y
⊢ False

Next tactic:
exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
  

Proof state:
case intro.intro
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
hzy : z ⋖ y
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
by_cases hxz : x < z
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
  by_cases hxz : x < z
  /- when `x < z`, then we may use the induction hypothesis to get a chain
  `Relation.TransGen (· ⋖ ·) x z`, which we can extend with `Relation.TransGen.tail`. -/
  · 

Proof state:
case pos
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
hzy : z ⋖ y
hxz : x < z
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
exact .tail (transGen_covby_of_lt hxz) hzy
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
  by_cases hxz : x < z
  /- when `x < z`, then we may use the induction hypothesis to get a chain
  `Relation.TransGen (· ⋖ ·) x z`, which we can extend with `Relation.TransGen.tail`. -/
  · exact .tail (transGen_covby_of_lt hxz) hzy
  /- when `¬ x < z`, then actually `z ≤ x` (not because it's a linear order, but because
  `x ≤ z`), and since `z ⋖ y` we conclude that `x ⋖ y` , then `Relation.TransGen.single`. -/
  · 

Proof state:
case neg
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
hzy : z ⋖ y
hxz : ¬x < z
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
simp only [lt_iff_le_not_le, not_and, not_not] at hxz
set_option linter.unusedVariables false in -- `have` for wf induction triggers linter
lemma transGen_covby_of_lt [Preorder α] [LocallyFiniteOrder α] {x y : α} (hxy : x < y) :
    TransGen (· ⋖ ·) x y := by
  -- We proceed by well-founded induction on the cardinality of `Ico x y`.
  -- It's impossible for the cardinality to be zero since `x < y`
  have h_non : (Ico x y).Nonempty := ⟨x, mem_Ico.mpr ⟨le_rfl, hxy⟩⟩
  -- `Ico x y` is a nonempty finset and so contains a maximal element `z` and
  -- `Ico x z` has cardinality strictly less than the cardinality of `Ico x y`
  obtain ⟨z, z_mem, hz⟩ := (Ico x y).exists_maximal h_non
  have z_card : (Ico x z).card < (Ico x y).card := card_lt_card <| ssubset_iff_of_subset
    (Ico_subset_Ico le_rfl (mem_Ico.mp z_mem).2.le) |>.mpr ⟨z, z_mem, right_not_mem_Ico⟩
  /- Since `z` is maximal in `Ico x y`, `z ⋖ y`. -/
  have hzy : z ⋖ y := by
    refine ⟨(mem_Ico.mp z_mem).2, fun c hc hcy ↦ ?_⟩
    exact hz _ (mem_Ico.mpr ⟨((mem_Ico.mp z_mem).1.trans_lt hc).le, hcy⟩) hc
  by_cases hxz : x < z
  /- when `x < z`, then we may use the induction hypothesis to get a chain
  `Relation.TransGen (· ⋖ ·) x z`, which we can extend with `Relation.TransGen.tail`. -/
  · exact .tail (transGen_covby_of_lt hxz) hzy
  /- when `¬ x < z`, then actually `z ≤ x` (not because it's a linear order, but because
  `x ≤ z`), and since `z ⋖ y` we conclude that `x ⋖ y` , then `Relation.TransGen.single`. -/
  · simp only [lt_iff_le_not_le, not_and, not_not] at hxz
    

Proof state:
case neg
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
hxy : x < y
h_non : Finset.Nonempty (Ico x y)
z : α
z_mem : z ∈ Ico x y
hz : ∀ x_1 ∈ Ico x y, ¬z < x_1
z_card : card (Ico x z) < card (Ico x y)
hzy : z ⋖ y
hxz : x ≤ z → z ≤ x
⊢ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
exact .single (hzy.of_le_of_lt (hxz (mem_Ico.mp z_mem).1) hxy)
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
⊢ x < y ↔ TransGen (fun x x_1 => x ⋖ x_1) x y

Next tactic:
refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
  

Proof state:
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y : α
h : TransGen (fun x x_1 => x ⋖ x_1) x y
⊢ x < y

Next tactic:
induction h with
  | single hx => exact hx.1
  | tail _ hb ih => exact ih.trans hb.1
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
  induction h with
  

Proof state:
case single
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ : α
hx : x ⋖ b✝
⊢ x < b✝

Next tactic:
| single hx => exact hx.1
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
  induction h with
  | single hx => 

Proof state:
case single
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ : α
hx : x ⋖ b✝
⊢ x < b✝

Next tactic:
exact hx.1
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
  induction h with
  | single hx => exact hx.1
  

Proof state:
case tail
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ c✝ : α
a✝ : TransGen (fun x x_1 => x ⋖ x_1) x b✝
hb : b✝ ⋖ c✝
ih : x < b✝
⊢ x < c✝

Next tactic:
| tail _ hb ih => exact ih.trans hb.1
/-- In a locally finite preorder, `<` is the transitive closure of `⋖`. -/
lemma lt_iff_transGen_covby [Preorder α] [LocallyFiniteOrder α] {x y : α} :
    x < y ↔ TransGen (· ⋖ ·) x y := by
  refine ⟨transGen_covby_of_lt, fun h ↦ ?_⟩
  induction h with
  | single hx => exact hx.1
  | tail _ hb ih => 

Proof state:
case tail
ι : Type u_1
α : Type u_2
inst✝¹ : Preorder α
inst✝ : LocallyFiniteOrder α
x y b✝ c✝ : α
a✝ : TransGen (fun x x_1 => x ⋖ x_1) x b✝
hb : b✝ ⋖ c✝
ih : x < b✝
⊢ x < c✝

Next tactic:
exact ih.trans hb.1
/-- A function from a locally finite preorder is monotone if and only if it is monotone when
restricted to pairs satisfying `a ⩿ b`. -/
lemma monotone_iff_forall_wcovby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : Monotone f ↔ ∀ a b : α, a ⩿ b → f a ≤ f b := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
⊢ Monotone f ↔ ∀ (a b : α), a ⩿ b → f a ≤ f b

Next tactic:
refine ⟨fun hf _ _ h ↦ hf h.le, fun h a b hab ↦ ?_⟩
/-- A function from a locally finite preorder is monotone if and only if it is monotone when
restricted to pairs satisfying `a ⩿ b`. -/
lemma monotone_iff_forall_wcovby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : Monotone f ↔ ∀ a b : α, a ⩿ b → f a ≤ f b := by
  refine ⟨fun hf _ _ h ↦ hf h.le, fun h a b hab ↦ ?_⟩
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
h : ∀ (a b : α), a ⩿ b → f a ≤ f b
a b : α
hab : a ≤ b
⊢ f a ≤ f b

Next tactic:
simpa [transGen_eq_self (r := ((· : β) ≤ ·)) transitive_le]
    using TransGen.lift f h <| le_iff_transGen_wcovby.mp hab
/-- A function from a locally finite partial order is monotone if and only if it is monotone when
restricted to pairs satisfying `a ⋖ b`. -/
lemma monotone_iff_forall_covby [PartialOrder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : Monotone f ↔ ∀ a b : α, a ⋖ b → f a ≤ f b := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : PartialOrder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
⊢ Monotone f ↔ ∀ (a b : α), a ⋖ b → f a ≤ f b

Next tactic:
refine ⟨fun hf _ _ h ↦ hf h.le, fun h a b hab ↦ ?_⟩
/-- A function from a locally finite partial order is monotone if and only if it is monotone when
restricted to pairs satisfying `a ⋖ b`. -/
lemma monotone_iff_forall_covby [PartialOrder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : Monotone f ↔ ∀ a b : α, a ⋖ b → f a ≤ f b := by
  refine ⟨fun hf _ _ h ↦ hf h.le, fun h a b hab ↦ ?_⟩
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : PartialOrder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
h : ∀ (a b : α), a ⋖ b → f a ≤ f b
a b : α
hab : a ≤ b
⊢ f a ≤ f b

Next tactic:
simpa [reflTransGen_eq_self (r := ((· : β) ≤ ·)) IsRefl.reflexive transitive_le]
    using ReflTransGen.lift f h <| le_iff_reflTransGen_covby.mp hab
/-- A function from a locally finite preorder is strictly monotone if and only if it is strictly
monotone when restricted to pairs satisfying `a ⋖ b`. -/
lemma strictMono_iff_forall_covby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : StrictMono f ↔ ∀ a b : α, a ⋖ b → f a < f b := by
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
⊢ StrictMono f ↔ ∀ (a b : α), a ⋖ b → f a < f b

Next tactic:
refine ⟨fun hf _ _ h ↦ hf h.lt, fun h a b hab ↦ ?_⟩
/-- A function from a locally finite preorder is strictly monotone if and only if it is strictly
monotone when restricted to pairs satisfying `a ⋖ b`. -/
lemma strictMono_iff_forall_covby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : StrictMono f ↔ ∀ a b : α, a ⋖ b → f a < f b := by
  refine ⟨fun hf _ _ h ↦ hf h.lt, fun h a b hab ↦ ?_⟩
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
h : ∀ (a b : α), a ⋖ b → f a < f b
a b : α
hab : a < b
⊢ f a < f b

Next tactic:
have := Relation.TransGen.lift f h (a := a) (b := b)
/-- A function from a locally finite preorder is strictly monotone if and only if it is strictly
monotone when restricted to pairs satisfying `a ⋖ b`. -/
lemma strictMono_iff_forall_covby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : StrictMono f ↔ ∀ a b : α, a ⋖ b → f a < f b := by
  refine ⟨fun hf _ _ h ↦ hf h.lt, fun h a b hab ↦ ?_⟩
  have := Relation.TransGen.lift f h (a := a) (b := b)
  

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
h : ∀ (a b : α), a ⋖ b → f a < f b
a b : α
hab : a < b
this : TransGen (fun a b => a ⋖ b) a b → TransGen LT.lt (f a) (f b)
⊢ f a < f b

Next tactic:
rw [← lt_iff_transGen_covby, transGen_eq_self (@lt_trans β _)] at this
/-- A function from a locally finite preorder is strictly monotone if and only if it is strictly
monotone when restricted to pairs satisfying `a ⋖ b`. -/
lemma strictMono_iff_forall_covby [Preorder α] [LocallyFiniteOrder α] [Preorder β]
    (f : α → β) : StrictMono f ↔ ∀ a b : α, a ⋖ b → f a < f b := by
  refine ⟨fun hf _ _ h ↦ hf h.lt, fun h a b hab ↦ ?_⟩
  have := Relation.TransGen.lift f h (a := a) (b := b)
  rw [← lt_iff_transGen_covby, transGen_eq_self (@lt_trans β _)] at this
  · 

Proof state:
ι : Type u_1
α : Type u_2
β : Type u_3
inst✝² : Preorder α
inst✝¹ : LocallyFiniteOrder α
inst✝ : Preorder β
f : α → β
h : ∀ (a b : α), a ⋖ b → f a < f b
a b : α
hab : a < b
this : a < b → (fun x y => x < y) (f a) (f b)
⊢ f a < f b

Next tactic:
exact this hab
protected theorem IsTransitive.inter (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∩ y).IsTransitive := fun z hz w hw => by
  

Proof state:
x y z✝ : ZFSet
hx : IsTransitive x
hy : IsTransitive y
z : ZFSet
hz : z ∈ x ∩ y
w : ZFSet
hw : w ∈ z
⊢ w ∈ x ∩ y

Next tactic:
rw [mem_inter] at hz ⊢
protected theorem IsTransitive.inter (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∩ y).IsTransitive := fun z hz w hw => by
  rw [mem_inter] at hz ⊢
  

Proof state:
x y z✝ : ZFSet
hx : IsTransitive x
hy : IsTransitive y
z : ZFSet
hz : z ∈ x ∧ z ∈ y
w : ZFSet
hw : w ∈ z
⊢ w ∈ x ∧ w ∈ y

Next tactic:
exact ⟨hx.mem_trans hw hz.1, hy.mem_trans hw hz.2⟩
protected theorem IsTransitive.sUnion (h : x.IsTransitive) :
    (⋃₀ x : ZFSet).IsTransitive := fun y hy z hz => by
  

Proof state:
x y✝ z✝ : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ∈ ⋃₀ x
z : ZFSet
hz : z ∈ y
⊢ z ∈ ⋃₀ x

Next tactic:
rcases mem_sUnion.1 hy with ⟨w, hw, hw'⟩
protected theorem IsTransitive.sUnion (h : x.IsTransitive) :
    (⋃₀ x : ZFSet).IsTransitive := fun y hy z hz => by
  rcases mem_sUnion.1 hy with ⟨w, hw, hw'⟩
  

Proof state:
case intro.intro
x y✝ z✝ : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ∈ ⋃₀ x
z : ZFSet
hz : z ∈ y
w : ZFSet
hw : w ∈ x
hw' : y ∈ w
⊢ z ∈ ⋃₀ x

Next tactic:
exact mem_sUnion_of_mem hz (h.mem_trans hw' hw)
theorem IsTransitive.sUnion' (H : ∀ y ∈ x, IsTransitive y) :
    (⋃₀ x : ZFSet).IsTransitive := fun y hy z hz => by
  

Proof state:
x y✝ z✝ : ZFSet
H : ∀ y ∈ x, IsTransitive y
y : ZFSet
hy : y ∈ ⋃₀ x
z : ZFSet
hz : z ∈ y
⊢ z ∈ ⋃₀ x

Next tactic:
rcases mem_sUnion.1 hy with ⟨w, hw, hw'⟩
theorem IsTransitive.sUnion' (H : ∀ y ∈ x, IsTransitive y) :
    (⋃₀ x : ZFSet).IsTransitive := fun y hy z hz => by
  rcases mem_sUnion.1 hy with ⟨w, hw, hw'⟩
  

Proof state:
case intro.intro
x y✝ z✝ : ZFSet
H : ∀ y ∈ x, IsTransitive y
y : ZFSet
hy : y ∈ ⋃₀ x
z : ZFSet
hz : z ∈ y
w : ZFSet
hw : w ∈ x
hw' : y ∈ w
⊢ z ∈ ⋃₀ x

Next tactic:
exact mem_sUnion_of_mem ((H w hw).mem_trans hz hw') hw
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  

Proof state:
x y z : ZFSet
hx : IsTransitive x
hy : IsTransitive y
⊢ IsTransitive (x ∪ y)

Next tactic:
rw [← sUnion_pair]
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  rw [← sUnion_pair]
  

Proof state:
x y z : ZFSet
hx : IsTransitive x
hy : IsTransitive y
⊢ IsTransitive (⋃₀ {x, y})

Next tactic:
apply IsTransitive.sUnion' fun z => _
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  rw [← sUnion_pair]
  apply IsTransitive.sUnion' fun z => _
  

Proof state:
x y z : ZFSet
hx : IsTransitive x
hy : IsTransitive y
⊢ ∀ z ∈ {x, y}, IsTransitive z

Next tactic:
intro
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  rw [← sUnion_pair]
  apply IsTransitive.sUnion' fun z => _
  intro
  

Proof state:
x y z : ZFSet
hx : IsTransitive x
hy : IsTransitive y
z✝ : ZFSet
⊢ z✝ ∈ {x, y} → IsTransitive z✝

Next tactic:
rw [mem_pair]
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  rw [← sUnion_pair]
  apply IsTransitive.sUnion' fun z => _
  intro
  rw [mem_pair]
  

Proof state:
x y z : ZFSet
hx : IsTransitive x
hy : IsTransitive y
z✝ : ZFSet
⊢ z✝ = x ∨ z✝ = y → IsTransitive z✝

Next tactic:
rintro (rfl | rfl)
protected theorem IsTransitive.union (hx : x.IsTransitive) (hy : y.IsTransitive) :
    (x ∪ y).IsTransitive := by
  rw [← sUnion_pair]
  apply IsTransitive.sUnion' fun z => _
  intro
  rw [mem_pair]
  rintro (rfl | rfl)
  

Proof state:
case inl
y z : ZFSet
hy : IsTransitive y
z✝ : ZFSet
hx : IsTransitive z✝
⊢ IsTransitive z✝
case inr x z : ZFSet hx : IsTransitive x z✝ : ZFSet hy : IsTransitive z✝ ⊢ IsTransitive z✝

Next tactic:
assumption'
protected theorem IsTransitive.powerset (h : x.IsTransitive) : (powerset x).IsTransitive :=
  fun y hy z hz => by
  

Proof state:
x y✝ z✝ : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ∈ powerset x
z : ZFSet
hz : z ∈ y
⊢ z ∈ powerset x

Next tactic:
rw [mem_powerset] at hy ⊢
protected theorem IsTransitive.powerset (h : x.IsTransitive) : (powerset x).IsTransitive :=
  fun y hy z hz => by
  rw [mem_powerset] at hy ⊢
  

Proof state:
x y✝ z✝ : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ⊆ x
z : ZFSet
hz : z ∈ y
⊢ z ⊆ x

Next tactic:
exact h.subset_of_mem (hy hz)
theorem isTransitive_iff_sUnion_subset : x.IsTransitive ↔ (⋃₀ x : ZFSet) ⊆ x :=
  ⟨fun h y hy => by
    

Proof state:
x y✝ z : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ∈ ⋃₀ x
⊢ y ∈ x

Next tactic:
rcases mem_sUnion.1 hy with ⟨z, hz, hz'⟩
theorem isTransitive_iff_sUnion_subset : x.IsTransitive ↔ (⋃₀ x : ZFSet) ⊆ x :=
  ⟨fun h y hy => by
    rcases mem_sUnion.1 hy with ⟨z, hz, hz'⟩
    

Proof state:
case intro.intro
x y✝ z✝ : ZFSet
h : IsTransitive x
y : ZFSet
hy : y ∈ ⋃₀ x
z : ZFSet
hz : z ∈ x
hz' : y ∈ z
⊢ y ∈ x

Next tactic:
exact h.mem_trans hz' hz
/-- If `X` and `Y` are closed then `X ⊗ Y` is.
This isn't an instance because it's not usually how we want to construct internal homs,
we'll usually prove all objects are closed uniformly.
-/
def tensorClosed {X Y : C} (hX : Closed X) (hY : Closed Y) : Closed (X ⊗ Y) where
  isAdj := by
    

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))

Next tactic:
haveI := hX.isAdj
/-- If `X` and `Y` are closed then `X ⊗ Y` is.
This isn't an instance because it's not usually how we want to construct internal homs,
we'll usually prove all objects are closed uniformly.
-/
def tensorClosed {X Y : C} (hX : Closed X) (hY : Closed Y) : Closed (X ⊗ Y) where
  isAdj := by
    haveI := hX.isAdj
    

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
this : IsLeftAdjoint (tensorLeft X)
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))

Next tactic:
haveI := hY.isAdj
/-- If `X` and `Y` are closed then `X ⊗ Y` is.
This isn't an instance because it's not usually how we want to construct internal homs,
we'll usually prove all objects are closed uniformly.
-/
def tensorClosed {X Y : C} (hX : Closed X) (hY : Closed Y) : Closed (X ⊗ Y) where
  isAdj := by
    haveI := hX.isAdj
    haveI := hY.isAdj
    

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X Y : C
hX : Closed X
hY : Closed Y
this✝ : IsLeftAdjoint (tensorLeft X)
this : IsLeftAdjoint (tensorLeft Y)
⊢ IsLeftAdjoint (tensorLeft (X ⊗ Y))

Next tactic:
exact Adjunction.leftAdjointOfNatIso (MonoidalCategory.tensorLeftTensor _ _).symm
/-- The unit object is always closed.
This isn't an instance because most of the time we'll prove closedness for all objects at once,
rather than just for this one.
-/
def unitClosed : Closed (𝟙_ C) where
  isAdj :=
    { right := 𝟭 C
      adj :=
        Adjunction.mkOfHomEquiv
          { homEquiv := fun X _ =>
              { toFun := fun a => (leftUnitor X).inv ≫ a
                invFun := fun a => (leftUnitor X).hom ≫ a
                left_inv := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X x✝ : C
⊢ Function.LeftInverse (fun a => (λ_ X).hom ≫ a) fun a => (λ_ X).inv ≫ a

Next tactic:
aesop_cat
/-- The unit object is always closed.
This isn't an instance because most of the time we'll prove closedness for all objects at once,
rather than just for this one.
-/
def unitClosed : Closed (𝟙_ C) where
  isAdj :=
    { right := 𝟭 C
      adj :=
        Adjunction.mkOfHomEquiv
          { homEquiv := fun X _ =>
              { toFun := fun a => (leftUnitor X).inv ≫ a
                invFun := fun a => (leftUnitor X).hom ≫ a
                left_inv := by aesop_cat
                right_inv := by 

Proof state:
C : Type u
inst✝¹ : Category.{v, u} C
inst✝ : MonoidalCategory C
X x✝ : C
⊢ Function.RightInverse (fun a => (λ_ X).hom ≫ a) fun a => (λ_ X).inv ≫ a

Next tactic:
aesop_cat