l3lab/ntp-mathlib huggingface dataset:
instance : LocallyFiniteOrder (Sum α β)
    where
  finsetIcc := sumLift₂ Icc Icc
  finsetIco := sumLift₂ Ico Ico
  finsetIoc := sumLift₂ Ioc Ioc
  finsetIoo := sumLift₂ Ioo Ioo
  finset_mem_Icc := by rintro (a | a) (b | b) (x | x) <;> simp
  finset_mem_Ico := by rintro (a | a) (b | b) (x | x) <;> simp
  finset_mem_Ioc := by rintro (a | a) (b | b) (x | x) <;> simp
  finset_mem_Ioo := by rintro (a | a) (b | b) (x | x) <;> 

Proof state:
case inr.inr.inr
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a b x : β
⊢ inr x ∈ sumLift₂ Ioo Ioo (inr a) (inr b) ↔ inr a < inr x ∧ inr x < inr b

Next tactic:
simp
@[simp, nolint simpNF] -- Porting note: dsimp can not prove this
theorem Ioo_inl_inr : Ioo (inl a₁) (inr b₂) = ∅ := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a₁ a₂ : α
b₁ b₂ : β
a b : α ⊕ β
⊢ Ioo (inl a₁) (inr b₂) = ∅

Next tactic:
rfl
@[simp, nolint simpNF] -- Porting note: dsimp can not prove this
theorem Ioo_inr_inl : Ioo (inr b₁) (inl a₂) = ∅ := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝³ : Preorder α
inst✝² : Preorder β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a₁ a₂ : α
b₁ b₂ : β
a b : α ⊕ β
⊢ Ioo (inr b₁) (inl a₂) = ∅

Next tactic:
rfl
instance locallyFiniteOrder : LocallyFiniteOrder (α ⊕ₗ β) where
  finsetIcc a b :=
    (sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIco a b :=
    (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoc a b :=
    (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoo a b :=
    (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finset_mem_Icc := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
⊢ ∀ (a b x : _root_.Lex (α ⊕ β)),
    x ∈
        (fun a b =>
            map (Equiv.toEmbedding toLex) (sumLexLift Icc Icc (fun a x => Ici a) (fun x => Iic) (ofLex a) (ofLex b)))
          a b ↔
      a ≤ x ∧ x ≤ b

Next tactic:
simp_lex
instance locallyFiniteOrder : LocallyFiniteOrder (α ⊕ₗ β) where
  finsetIcc a b :=
    (sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIco a b :=
    (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoc a b :=
    (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoo a b :=
    (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finset_mem_Icc := by simp_lex
  finset_mem_Ico := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
⊢ ∀ (a b x : _root_.Lex (α ⊕ β)),
    x ∈
        (fun a b =>
            map (Equiv.toEmbedding toLex) (sumLexLift Ico Ico (fun a x => Ici a) (fun x => Iio) (ofLex a) (ofLex b)))
          a b ↔
      a ≤ x ∧ x < b

Next tactic:
simp_lex
instance locallyFiniteOrder : LocallyFiniteOrder (α ⊕ₗ β) where
  finsetIcc a b :=
    (sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIco a b :=
    (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoc a b :=
    (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoo a b :=
    (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finset_mem_Icc := by simp_lex
  finset_mem_Ico := by simp_lex
  finset_mem_Ioc := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
⊢ ∀ (a b x : _root_.Lex (α ⊕ β)),
    x ∈
        (fun a b =>
            map (Equiv.toEmbedding toLex) (sumLexLift Ioc Ioc (fun a x => Ioi a) (fun x => Iic) (ofLex a) (ofLex b)))
          a b ↔
      a < x ∧ x ≤ b

Next tactic:
simp_lex
instance locallyFiniteOrder : LocallyFiniteOrder (α ⊕ₗ β) where
  finsetIcc a b :=
    (sumLexLift Icc Icc (fun a _ => Ici a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIco a b :=
    (sumLexLift Ico Ico (fun a _ => Ici a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoc a b :=
    (sumLexLift Ioc Ioc (fun a _ => Ioi a) (fun _ => Iic) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finsetIoo a b :=
    (sumLexLift Ioo Ioo (fun a _ => Ioi a) (fun _ => Iio) (ofLex a) (ofLex b)).map toLex.toEmbedding
  finset_mem_Icc := by simp_lex
  finset_mem_Ico := by simp_lex
  finset_mem_Ioc := by simp_lex
  finset_mem_Ioo := by 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
⊢ ∀ (a b x : _root_.Lex (α ⊕ β)),
    x ∈
        (fun a b =>
            map (Equiv.toEmbedding toLex) (sumLexLift Ioo Ioo (fun a x => Ioi a) (fun x => Iio) (ofLex a) (ofLex b)))
          a b ↔
      a < x ∧ x < b

Next tactic:
simp_lex
lemma Icc_inl_inl :
    Icc (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Icc a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Icc (inlₗ a₁) (inlₗ a₂) = map (Embedding.trans Embedding.inl (Equiv.toEmbedding toLex)) (Icc a₁ a₂)

Next tactic:
rw [← Finset.map_map]
lemma Icc_inl_inl :
    Icc (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Icc a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Icc (inlₗ a₁) (inlₗ a₂) = map (Equiv.toEmbedding toLex) (map Embedding.inl (Icc a₁ a₂))

Next tactic:
rfl
lemma Ico_inl_inl :
    Ico (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ico a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ico (inlₗ a₁) (inlₗ a₂) = map (Embedding.trans Embedding.inl (Equiv.toEmbedding toLex)) (Ico a₁ a₂)

Next tactic:
rw [← Finset.map_map]
lemma Ico_inl_inl :
    Ico (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ico a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ico (inlₗ a₁) (inlₗ a₂) = map (Equiv.toEmbedding toLex) (map Embedding.inl (Ico a₁ a₂))

Next tactic:
rfl
lemma Ioc_inl_inl :
    Ioc (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ioc a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioc (inlₗ a₁) (inlₗ a₂) = map (Embedding.trans Embedding.inl (Equiv.toEmbedding toLex)) (Ioc a₁ a₂)

Next tactic:
rw [← Finset.map_map]
lemma Ioc_inl_inl :
    Ioc (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ioc a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioc (inlₗ a₁) (inlₗ a₂) = map (Equiv.toEmbedding toLex) (map Embedding.inl (Ioc a₁ a₂))

Next tactic:
rfl
lemma Ioo_inl_inl :
    Ioo (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ioo a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioo (inlₗ a₁) (inlₗ a₂) = map (Embedding.trans Embedding.inl (Equiv.toEmbedding toLex)) (Ioo a₁ a₂)

Next tactic:
rw [← Finset.map_map]
lemma Ioo_inl_inl :
    Ioo (inlₗ a₁ : α ⊕ₗ β) (inlₗ a₂) = (Ioo a₁ a₂).map (Embedding.inl.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioo (inlₗ a₁) (inlₗ a₂) = map (Equiv.toEmbedding toLex) (map Embedding.inl (Ioo a₁ a₂))

Next tactic:
rfl
lemma Icc_inr_inr :
    Icc (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Icc b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Icc (inrₗ b₁) (inrₗ b₂) = map (Embedding.trans Embedding.inr (Equiv.toEmbedding toLex)) (Icc b₁ b₂)

Next tactic:
rw [← Finset.map_map]
lemma Icc_inr_inr :
    Icc (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Icc b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Icc (inrₗ b₁) (inrₗ b₂) = map (Equiv.toEmbedding toLex) (map Embedding.inr (Icc b₁ b₂))

Next tactic:
rfl
lemma Ico_inr_inr :
    Ico (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ico b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ico (inrₗ b₁) (inrₗ b₂) = map (Embedding.trans Embedding.inr (Equiv.toEmbedding toLex)) (Ico b₁ b₂)

Next tactic:
rw [← Finset.map_map]
lemma Ico_inr_inr :
    Ico (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ico b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ico (inrₗ b₁) (inrₗ b₂) = map (Equiv.toEmbedding toLex) (map Embedding.inr (Ico b₁ b₂))

Next tactic:
rfl
lemma Ioc_inr_inr :
    Ioc (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ioc b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioc (inrₗ b₁) (inrₗ b₂) = map (Embedding.trans Embedding.inr (Equiv.toEmbedding toLex)) (Ioc b₁ b₂)

Next tactic:
rw [← Finset.map_map]
lemma Ioc_inr_inr :
    Ioc (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ioc b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioc (inrₗ b₁) (inrₗ b₂) = map (Equiv.toEmbedding toLex) (map Embedding.inr (Ioc b₁ b₂))

Next tactic:
rfl
lemma Ioo_inr_inr :
    Ioo (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ioo b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioo (inrₗ b₁) (inrₗ b₂) = map (Embedding.trans Embedding.inr (Equiv.toEmbedding toLex)) (Ioo b₁ b₂)

Next tactic:
rw [← Finset.map_map]
lemma Ioo_inr_inr :
    Ioo (inrₗ b₁ : α ⊕ₗ β) (inrₗ b₂) = (Ioo b₁ b₂).map (Embedding.inr.trans toLex.toEmbedding) := by
  rw [← Finset.map_map]; 

Proof state:
α : Type u_1
β : Type u_2
inst✝⁵ : Preorder α
inst✝⁴ : Preorder β
inst✝³ : OrderTop α
inst✝² : OrderBot β
inst✝¹ : LocallyFiniteOrder α
inst✝ : LocallyFiniteOrder β
a a₁ a₂ : α
b b₁ b₂ : β
⊢ Ioo (inrₗ b₁) (inrₗ b₂) = map (Equiv.toEmbedding toLex) (map Embedding.inr (Ioo b₁ b₂))

Next tactic:
rfl
protected theorem equiv_of_isEmpty (x y : PSet) [IsEmpty x.Type] [IsEmpty y.Type] : Equiv x y :=
  equiv_iff.2 <| by 

Proof state:
x : PSet
y : PSet
inst✝¹ : IsEmpty (Type x)
inst✝ : IsEmpty (Type y)
⊢ (∀ (i : Type x), ∃ j, Equiv (Func x i) (Func y j)) ∧ ∀ (j : Type y), ∃ i, Equiv (Func x i) (Func y j)

Next tactic:
simp
instance : IsTrans PSet (· ⊆ ·) :=
  ⟨fun x y z hxy hyz a => by
    

Proof state:
x y z : PSet
hxy : x ⊆ y
hyz : y ⊆ z
a : Type x
⊢ ∃ b, Equiv (Func x a) (Func z b)

Next tactic:
cases' hxy a with b hb
instance : IsTrans PSet (· ⊆ ·) :=
  ⟨fun x y z hxy hyz a => by
    cases' hxy a with b hb
    

Proof state:
case intro
x y z : PSet
hxy : x ⊆ y
hyz : y ⊆ z
a : Type x
b : Type y
hb : Equiv (Func x a) (Func y b)
⊢ ∃ b, Equiv (Func x a) (Func z b)

Next tactic:
cases' hyz b with c hc
instance : IsTrans PSet (· ⊆ ·) :=
  ⟨fun x y z hxy hyz a => by
    cases' hxy a with b hb
    cases' hyz b with c hc
    

Proof state:
case intro.intro
x y z : PSet
hxy : x ⊆ y
hyz : y ⊆ z
a : Type x
b : Type y
hb : Equiv (Func x a) (Func y b)
c : Type z
hc : Equiv (Func y b) (Func z c)
⊢ ∃ b, Equiv (Func x a) (Func z b)

Next tactic:
exact ⟨c, hb.trans hc⟩
theorem func_mem (x : PSet) (i : x.Type) : x.Func i ∈ x := by
  

Proof state:
x : PSet
i : Type x
⊢ Func x i ∈ x

Next tactic:
cases x
theorem func_mem (x : PSet) (i : x.Type) : x.Func i ∈ x := by
  cases x
  

Proof state:
case mk
α✝ : Type u_1
A✝ : α✝ → PSet
i : Type (mk α✝ A✝)
⊢ Func (mk α✝ A✝) i ∈ mk α✝ A✝

Next tactic:
apply Mem.mk
private theorem mem_wf_aux : ∀ {x y : PSet.{u}}, Equiv x y → Acc (· ∈ ·) y
  | ⟨α, A⟩, ⟨β, B⟩, H =>
    ⟨_, by
      

Proof state:
α : Type u
A : α → PSet
β : Type u
B : β → PSet
H : Equiv (mk α A) (mk β B)
⊢ ∀ y ∈ mk β B, Acc (fun x x_1 => x ∈ x_1) y

Next tactic:
rintro ⟨γ, C⟩ ⟨b, hc⟩
private theorem mem_wf_aux : ∀ {x y : PSet.{u}}, Equiv x y → Acc (· ∈ ·) y
  | ⟨α, A⟩, ⟨β, B⟩, H =>
    ⟨_, by
      rintro ⟨γ, C⟩ ⟨b, hc⟩
      

Proof state:
case mk.intro
α : Type u
A : α → PSet
β : Type u
B : β → PSet
H : Equiv (mk α A) (mk β B)
γ : Type u
C : γ → PSet
b : Type (mk β B)
hc : Equiv (mk γ C) (Func (mk β B) b)
⊢ Acc (fun x x_1 => x ∈ x_1) (mk γ C)

Next tactic:
cases' H.exists_right b with a ha
private theorem mem_wf_aux : ∀ {x y : PSet.{u}}, Equiv x y → Acc (· ∈ ·) y
  | ⟨α, A⟩, ⟨β, B⟩, H =>
    ⟨_, by
      rintro ⟨γ, C⟩ ⟨b, hc⟩
      cases' H.exists_right b with a ha
      

Proof state:
case mk.intro.intro
α : Type u
A : α → PSet
β : Type u
B : β → PSet
H : Equiv (mk α A) (mk β B)
γ : Type u
C : γ → PSet
b : Type (mk β B)
hc : Equiv (mk γ C) (Func (mk β B) b)
a : Type (mk α A)
ha : Equiv (Func (mk α A) a) (Func (mk β B) b)
⊢ Acc (fun x x_1 => x ∈ x_1) (mk γ C)

Next tactic:
have H := ha.trans hc.symm
private theorem mem_wf_aux : ∀ {x y : PSet.{u}}, Equiv x y → Acc (· ∈ ·) y
  | ⟨α, A⟩, ⟨β, B⟩, H =>
    ⟨_, by
      rintro ⟨γ, C⟩ ⟨b, hc⟩
      cases' H.exists_right b with a ha
      have H := ha.trans hc.symm
      

Proof state:
case mk.intro.intro
α : Type u
A : α → PSet
β : Type u
B : β → PSet
H✝ : Equiv (mk α A) (mk β B)
γ : Type u
C : γ → PSet
b : Type (mk β B)
hc : Equiv (mk γ C) (Func (mk β B) b)
a : Type (mk α A)
ha : Equiv (Func (mk α A) a) (Func (mk β B) b)
H : Equiv (Func (mk α A) a) (mk γ C)
⊢ Acc (fun x x_1 => x ∈ x_1) (mk γ C)

Next tactic:
rw [mk_func] at H
private theorem mem_wf_aux : ∀ {x y : PSet.{u}}, Equiv x y → Acc (· ∈ ·) y
  | ⟨α, A⟩, ⟨β, B⟩, H =>
    ⟨_, by
      rintro ⟨γ, C⟩ ⟨b, hc⟩
      cases' H.exists_right b with a ha
      have H := ha.trans hc.symm
      rw [mk_func] at H
      

Proof state:
case mk.intro.intro
α : Type u
A : α → PSet
β : Type u
B : β → PSet
H✝ : Equiv (mk α A) (mk β B)
γ : Type u
C : γ → PSet
b : Type (mk β B)
hc : Equiv (mk γ C) (Func (mk β B) b)
a : Type (mk α A)
ha : Equiv (Func (mk α A) a) (Func (mk β B) b)
H : Equiv (A a) (mk γ C)
⊢ Acc (fun x x_1 => x ∈ x_1) (mk γ C)

Next tactic:
exact mem_wf_aux H
@[simp]
theorem toSet_empty : toSet ∅ = ∅ := by 

Proof state:
⊢ toSet ∅ = ∅

Next tactic:
simp [toSet]
@[simp]
theorem not_nonempty_empty : ¬PSet.Nonempty ∅ := by 

Proof state:
⊢ ¬PSet.Nonempty ∅

Next tactic:
simp [PSet.Nonempty]
@[simp]
theorem mem_sUnion : ∀ {x y : PSet.{u}}, y ∈ ⋃₀ x ↔ ∃ z ∈ x, y ∈ z
  | ⟨α, A⟩, y =>
    ⟨fun ⟨⟨a, c⟩, (e : Equiv y ((A a).Func c))⟩ =>
      have : Func (A a) c ∈ mk (A a).Type (A a).Func := Mem.mk (A a).Func c
      ⟨_, Mem.mk _ _, (Mem.congr_left e).2 (by 

Proof state:
α : Type u
A : α → PSet
y : PSet
x✝ : y ∈ ⋃₀ mk α A
a : Type (mk α A)
c : Type (Func (mk α A) a)
e : Equiv y (Func (A a) c)
this : Func (A a) c ∈ mk (Type (A a)) (Func (A a))
⊢ Func (A a) c ∈ A (?m.24414 α A y x✝ a c e this)

Next tactic:
rwa [eta] at this
@[simp]
theorem mem_sUnion : ∀ {x y : PSet.{u}}, y ∈ ⋃₀ x ↔ ∃ z ∈ x, y ∈ z
  | ⟨α, A⟩, y =>
    ⟨fun ⟨⟨a, c⟩, (e : Equiv y ((A a).Func c))⟩ =>
      have : Func (A a) c ∈ mk (A a).Type (A a).Func := Mem.mk (A a).Func c
      ⟨_, Mem.mk _ _, (Mem.congr_left e).2 (by rwa [eta] at this)⟩,
      fun ⟨⟨β, B⟩, ⟨a, (e : Equiv (mk β B) (A a))⟩, ⟨b, yb⟩⟩ => by
      

Proof state:
α : Type u
A : α → PSet
y : PSet
x✝ : ∃ z ∈ mk α A, y ∈ z
β : Type u
B : β → PSet
a : Type (mk α A)
e : Equiv (mk β B) (A a)
b : Type (mk β B)
yb : Equiv y (Func (mk β B) b)
⊢ y ∈ ⋃₀ mk α A

Next tactic:
rw [← eta (A a)] at e
@[simp]
theorem mem_sUnion : ∀ {x y : PSet.{u}}, y ∈ ⋃₀ x ↔ ∃ z ∈ x, y ∈ z
  | ⟨α, A⟩, y =>
    ⟨fun ⟨⟨a, c⟩, (e : Equiv y ((A a).Func c))⟩ =>
      have : Func (A a) c ∈ mk (A a).Type (A a).Func := Mem.mk (A a).Func c
      ⟨_, Mem.mk _ _, (Mem.congr_left e).2 (by rwa [eta] at this)⟩,
      fun ⟨⟨β, B⟩, ⟨a, (e : Equiv (mk β B) (A a))⟩, ⟨b, yb⟩⟩ => by
      rw [← eta (A a)] at e
      

Proof state:
α : Type u
A : α → PSet
y : PSet
x✝ : ∃ z ∈ mk α A, y ∈ z
β : Type u
B : β → PSet
a : Type (mk α A)
e : Equiv (mk β B) (mk (Type (A a)) (Func (A a)))
b : Type (mk β B)
yb : Equiv y (Func (mk β B) b)
⊢ y ∈ ⋃₀ mk α A

Next tactic:
exact
        let ⟨βt, _⟩ := e
        let ⟨c, bc⟩ := βt b
        ⟨⟨a, c⟩, yb.trans bc⟩
@[simp]
theorem toSet_sUnion (x : PSet.{u}) : (⋃₀ x).toSet = ⋃₀ (toSet '' x.toSet) := by
  

Proof state:
x : PSet
⊢ toSet (⋃₀ x) = ⋃₀ (toSet '' toSet x)

Next tactic:
ext
@[simp]
theorem toSet_sUnion (x : PSet.{u}) : (⋃₀ x).toSet = ⋃₀ (toSet '' x.toSet) := by
  ext
  

Proof state:
case h
x x✝ : PSet
⊢ x✝ ∈ toSet (⋃₀ x) ↔ x✝ ∈ ⋃₀ (toSet '' toSet x)

Next tactic:
simp
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    

Proof state:
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
⊢ Definable (n + 1) F

Next tactic:
have I := fun x => allDefinable (F x)
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    

Proof state:
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
⊢ Definable (n + 1) F

Next tactic:
refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
    · 

Proof state:
case refine'_1
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
⊢ Arity.Equiv (fun x => ↑(Definable.Resp (F ⟦x⟧))) fun x => ↑(Definable.Resp (F ⟦x⟧))

Next tactic:
dsimp [Arity.Equiv]
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
    · dsimp [Arity.Equiv]
      

Proof state:
case refine'_1
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
⊢ ∀ (x y : PSet), PSet.Equiv x y → Arity.Equiv ↑(Definable.Resp (F ⟦x⟧)) ↑(Definable.Resp (F ⟦y⟧))

Next tactic:
intro x y h
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
    · dsimp [Arity.Equiv]
      intro x y h
      

Proof state:
case refine'_1
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
x y : PSet
h : PSet.Equiv x y
⊢ Arity.Equiv ↑(Definable.Resp (F ⟦x⟧)) ↑(Definable.Resp (F ⟦y⟧))

Next tactic:
rw [@Quotient.sound PSet _ _ _ h]
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
    · dsimp [Arity.Equiv]
      intro x y h
      rw [@Quotient.sound PSet _ _ _ h]
      

Proof state:
case refine'_1
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
x y : PSet
h : PSet.Equiv x y
⊢ Arity.Equiv ↑(Definable.Resp (F ⟦y⟧)) ↑(Definable.Resp (F ⟦y⟧))

Next tactic:
exact (Definable.Resp (F ⟦y⟧)).2
/-- All functions are classically definable. -/
noncomputable def allDefinable : ∀ {n} (F : OfArity ZFSet ZFSet n), Definable n F
  | 0, F =>
    let p := @Quotient.exists_rep PSet _ F
    @Definable.EqMk 0 ⟨choose p, Equiv.rfl⟩ _ (choose_spec p)
  | n + 1, (F : OfArity ZFSet ZFSet (n + 1)) => by
    have I := fun x => allDefinable (F x)
    refine' @Definable.EqMk (n + 1) ⟨fun x : PSet => (@Definable.Resp _ _ (I ⟦x⟧)).1, _⟩ _ _
    · dsimp [Arity.Equiv]
      intro x y h
      rw [@Quotient.sound PSet _ _ _ h]
      exact (Definable.Resp (F ⟦y⟧)).2
    

Proof state:
case refine'_2
n : ℕ
F : OfArity ZFSet ZFSet (n + 1)
I : (x : ZFSet) → Definable (Nat.add n 0) (F x)
⊢ Resp.eval (n + 1)
      { val := fun x => ↑(Definable.Resp (F ⟦x⟧)),
        property := (_ : Arity.Equiv (fun x => ↑(Definable.Resp (F ⟦x⟧))) fun x => ↑(Definable.Resp (F ⟦x⟧))) } =
    F

Next tactic:
refine' funext fun q => Quotient.inductionOn q fun x => _