l3lab/ntp-mathlib huggingface dataset:
instance model_preorder [Preorder M] : M ⊨ Language.order.preorderTheory := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
⊢ M ⊨ preorderTheory Language.order

Next tactic:
simp only [preorderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, forall_eq,
    Relations.realize_transitive]
instance model_preorder [Preorder M] : M ⊨ Language.order.preorderTheory := by
  simp only [preorderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, forall_eq,
    Relations.realize_transitive]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
⊢ (Reflexive fun x y => x ≤ y) ∧ Transitive fun x y => x ≤ y

Next tactic:
exact ⟨le_refl, fun _ _ _ => le_trans⟩
instance model_partialOrder [PartialOrder M] : M ⊨ Language.order.partialOrderTheory := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : PartialOrder M
⊢ M ⊨ partialOrderTheory Language.order

Next tactic:
simp only [partialOrderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, Relations.realize_antisymmetric,
    forall_eq, Relations.realize_transitive]
instance model_partialOrder [PartialOrder M] : M ⊨ Language.order.partialOrderTheory := by
  simp only [partialOrderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, Relations.realize_antisymmetric,
    forall_eq, Relations.realize_transitive]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : PartialOrder M
⊢ (Reflexive fun x y => x ≤ y) ∧ (AntiSymmetric fun x y => x ≤ y) ∧ Transitive fun x y => x ≤ y

Next tactic:
exact ⟨le_refl, fun _ _ => le_antisymm, fun _ _ _ => le_trans⟩
instance model_linearOrder [LinearOrder M] : M ⊨ Language.order.linearOrderTheory := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LinearOrder M
⊢ M ⊨ linearOrderTheory Language.order

Next tactic:
simp only [linearOrderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, Relations.realize_antisymmetric,
    Relations.realize_transitive, forall_eq, Relations.realize_total]
instance model_linearOrder [LinearOrder M] : M ⊨ Language.order.linearOrderTheory := by
  simp only [linearOrderTheory, Theory.model_iff, Set.mem_insert_iff, Set.mem_singleton_iff,
    forall_eq_or_imp, Relations.realize_reflexive, relMap_apply₂, Relations.realize_antisymmetric,
    Relations.realize_transitive, forall_eq, Relations.realize_total]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LinearOrder M
⊢ (Reflexive fun x y => x ≤ y) ∧
    (AntiSymmetric fun x y => x ≤ y) ∧ (Transitive fun x y => x ≤ y) ∧ Total fun x y => x ≤ y

Next tactic:
exact ⟨le_refl, fun _ _ => le_antisymm, fun _ _ _ => le_trans, le_total⟩
@[simp]
theorem relMap_leSymb [LE M] [L.OrderedStructure M] {a b : M} :
    RelMap (leSymb : L.Relations 2) ![a, b] ↔ a ≤ b := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : IsOrdered L
inst✝² : Structure L M
inst✝¹ : LE M
inst✝ : OrderedStructure L M
a b : M
⊢ RelMap leSymb ![a, b] ↔ a ≤ b

Next tactic:
rw [← orderLHom_leSymb, LHom.map_onRelation]
@[simp]
theorem relMap_leSymb [LE M] [L.OrderedStructure M] {a b : M} :
    RelMap (leSymb : L.Relations 2) ![a, b] ↔ a ≤ b := by
  rw [← orderLHom_leSymb, LHom.map_onRelation]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : IsOrdered L
inst✝² : Structure L M
inst✝¹ : LE M
inst✝ : OrderedStructure L M
a b : M
⊢ RelMap leSymb ![a, b] ↔ a ≤ b

Next tactic:
rfl
@[simp]
theorem Term.realize_le [LE M] [L.OrderedStructure M] {t₁ t₂ : L.Term (Sum α (Fin n))} {v : α → M}
    {xs : Fin n → M} :
    (t₁.le t₂).Realize v xs ↔ t₁.realize (Sum.elim v xs) ≤ t₂.realize (Sum.elim v xs) := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : IsOrdered L
inst✝² : Structure L M
inst✝¹ : LE M
inst✝ : OrderedStructure L M
t₁ t₂ : Term L (α ⊕ Fin n)
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize (le t₁ t₂) v xs ↔ realize (Sum.elim v xs) t₁ ≤ realize (Sum.elim v xs) t₂

Next tactic:
simp [Term.le]
@[simp]
theorem Term.realize_lt [Preorder M] [L.OrderedStructure M] {t₁ t₂ : L.Term (Sum α (Fin n))}
    {v : α → M} {xs : Fin n → M} :
    (t₁.lt t₂).Realize v xs ↔ t₁.realize (Sum.elim v xs) < t₂.realize (Sum.elim v xs) := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : IsOrdered L
inst✝² : Structure L M
inst✝¹ : Preorder M
inst✝ : OrderedStructure L M
t₁ t₂ : Term L (α ⊕ Fin n)
v : α → M
xs : Fin n → M
⊢ BoundedFormula.Realize (lt t₁ t₂) v xs ↔ realize (Sum.elim v xs) t₁ < realize (Sum.elim v xs) t₂

Next tactic:
simp [Term.lt, lt_iff_le_not_le]
theorem realize_noTopOrder_iff : M ⊨ Language.order.noTopOrderSentence ↔ NoTopOrder M := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ M ⊨ noTopOrderSentence Language.order ↔ NoTopOrder M

Next tactic:
simp only [noTopOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
theorem realize_noTopOrder_iff : M ⊨ Language.order.noTopOrderSentence ↔ NoTopOrder M := by
  simp only [noTopOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ (∀ (a : M), ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 1 ≤ Fin.snoc (Fin.snoc default a) a_1 0) ↔ NoTopOrder M

Next tactic:
refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
theorem realize_noTopOrder_iff : M ⊨ Language.order.noTopOrderSentence ↔ NoTopOrder M := by
  simp only [noTopOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ NoTopOrder M → ∀ (a : M), ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 1 ≤ Fin.snoc (Fin.snoc default a) a_1 0

Next tactic:
intro h a
theorem realize_noTopOrder_iff : M ⊨ Language.order.noTopOrderSentence ↔ NoTopOrder M := by
  simp only [noTopOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
  intro h a
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
h : NoTopOrder M
a : M
⊢ ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 1 ≤ Fin.snoc (Fin.snoc default a) a_1 0

Next tactic:
exact exists_not_le a
theorem realize_noBotOrder_iff : M ⊨ Language.order.noBotOrderSentence ↔ NoBotOrder M := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ M ⊨ noBotOrderSentence Language.order ↔ NoBotOrder M

Next tactic:
simp only [noBotOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
theorem realize_noBotOrder_iff : M ⊨ Language.order.noBotOrderSentence ↔ NoBotOrder M := by
  simp only [noBotOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ (∀ (a : M), ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 0 ≤ Fin.snoc (Fin.snoc default a) a_1 1) ↔ NoBotOrder M

Next tactic:
refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
theorem realize_noBotOrder_iff : M ⊨ Language.order.noBotOrderSentence ↔ NoBotOrder M := by
  simp only [noBotOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
⊢ NoBotOrder M → ∀ (a : M), ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 0 ≤ Fin.snoc (Fin.snoc default a) a_1 1

Next tactic:
intro h a
theorem realize_noBotOrder_iff : M ⊨ Language.order.noBotOrderSentence ↔ NoBotOrder M := by
  simp only [noBotOrderSentence, Sentence.Realize, Formula.Realize, BoundedFormula.realize_all,
    BoundedFormula.realize_ex, BoundedFormula.realize_not, Term.realize, Term.realize_le,
    Sum.elim_inr]
  refine' ⟨fun h => ⟨fun a => h a⟩, _⟩
  intro h a
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : LE M
h : NoBotOrder M
a : M
⊢ ∃ a_1, ¬Fin.snoc (Fin.snoc default a) a_1 0 ≤ Fin.snoc (Fin.snoc default a) a_1 1

Next tactic:
exact exists_not_ge a
theorem realize_denselyOrdered_iff [Preorder M] :
    M ⊨ Language.order.denselyOrderedSentence ↔ DenselyOrdered M := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
⊢ M ⊨ denselyOrderedSentence Language.order ↔ DenselyOrdered M

Next tactic:
simp only [denselyOrderedSentence, Sentence.Realize, Formula.Realize,
    BoundedFormula.realize_imp, BoundedFormula.realize_all, Term.realize, Term.realize_lt,
    Sum.elim_inr, BoundedFormula.realize_ex, BoundedFormula.realize_inf]
theorem realize_denselyOrdered_iff [Preorder M] :
    M ⊨ Language.order.denselyOrderedSentence ↔ DenselyOrdered M := by
  simp only [denselyOrderedSentence, Sentence.Realize, Formula.Realize,
    BoundedFormula.realize_imp, BoundedFormula.realize_all, Term.realize, Term.realize_lt,
    Sum.elim_inr, BoundedFormula.realize_ex, BoundedFormula.realize_inf]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
⊢ (∀ (a a_1 : M),
      Fin.snoc (Fin.snoc default a) a_1 0 < Fin.snoc (Fin.snoc default a) a_1 1 →
        ∃ a_3,
          Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 0 < Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 2 ∧
            Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 2 < Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 1) ↔
    DenselyOrdered M

Next tactic:
refine' ⟨fun h => ⟨fun a b ab => h a b ab⟩, _⟩
theorem realize_denselyOrdered_iff [Preorder M] :
    M ⊨ Language.order.denselyOrderedSentence ↔ DenselyOrdered M := by
  simp only [denselyOrderedSentence, Sentence.Realize, Formula.Realize,
    BoundedFormula.realize_imp, BoundedFormula.realize_all, Term.realize, Term.realize_lt,
    Sum.elim_inr, BoundedFormula.realize_ex, BoundedFormula.realize_inf]
  refine' ⟨fun h => ⟨fun a b ab => h a b ab⟩, _⟩
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
⊢ DenselyOrdered M →
    ∀ (a a_1 : M),
      Fin.snoc (Fin.snoc default a) a_1 0 < Fin.snoc (Fin.snoc default a) a_1 1 →
        ∃ a_3,
          Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 0 < Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 2 ∧
            Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 2 < Fin.snoc (Fin.snoc (Fin.snoc default a) a_1) a_3 1

Next tactic:
intro h a b ab
theorem realize_denselyOrdered_iff [Preorder M] :
    M ⊨ Language.order.denselyOrderedSentence ↔ DenselyOrdered M := by
  simp only [denselyOrderedSentence, Sentence.Realize, Formula.Realize,
    BoundedFormula.realize_imp, BoundedFormula.realize_all, Term.realize, Term.realize_lt,
    Sum.elim_inr, BoundedFormula.realize_ex, BoundedFormula.realize_inf]
  refine' ⟨fun h => ⟨fun a b ab => h a b ab⟩, _⟩
  intro h a b ab
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝ : Preorder M
h : DenselyOrdered M
a b : M
ab : Fin.snoc (Fin.snoc default a) b 0 < Fin.snoc (Fin.snoc default a) b 1
⊢ ∃ a_1,
    Fin.snoc (Fin.snoc (Fin.snoc default a) b) a_1 0 < Fin.snoc (Fin.snoc (Fin.snoc default a) b) a_1 2 ∧
      Fin.snoc (Fin.snoc (Fin.snoc default a) b) a_1 2 < Fin.snoc (Fin.snoc (Fin.snoc default a) b) a_1 1

Next tactic:
exact exists_between ab
instance model_dlo [LinearOrder M] [DenselyOrdered M] [NoTopOrder M] [NoBotOrder M] :
    M ⊨ Language.order.dlo := by
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : LinearOrder M
inst✝² : DenselyOrdered M
inst✝¹ : NoTopOrder M
inst✝ : NoBotOrder M
⊢ M ⊨ dlo Language.order

Next tactic:
simp only [dlo, Set.union_insert, Set.union_singleton, Theory.model_iff, Set.mem_insert_iff,
    forall_eq_or_imp, realize_noTopOrder, realize_noBotOrder, realize_denselyOrdered,
    true_and_iff]
instance model_dlo [LinearOrder M] [DenselyOrdered M] [NoTopOrder M] [NoBotOrder M] :
    M ⊨ Language.order.dlo := by
  simp only [dlo, Set.union_insert, Set.union_singleton, Theory.model_iff, Set.mem_insert_iff,
    forall_eq_or_imp, realize_noTopOrder, realize_noBotOrder, realize_denselyOrdered,
    true_and_iff]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : LinearOrder M
inst✝² : DenselyOrdered M
inst✝¹ : NoTopOrder M
inst✝ : NoBotOrder M
⊢ ∀ a ∈ linearOrderTheory Language.order, M ⊨ a

Next tactic:
rw [← Theory.model_iff]
instance model_dlo [LinearOrder M] [DenselyOrdered M] [NoTopOrder M] [NoBotOrder M] :
    M ⊨ Language.order.dlo := by
  simp only [dlo, Set.union_insert, Set.union_singleton, Theory.model_iff, Set.mem_insert_iff,
    forall_eq_or_imp, realize_noTopOrder, realize_noBotOrder, realize_denselyOrdered,
    true_and_iff]
  rw [← Theory.model_iff]
  

Proof state:
L : Language
α : Type w
M : Type w'
n : ℕ
inst✝³ : LinearOrder M
inst✝² : DenselyOrdered M
inst✝¹ : NoTopOrder M
inst✝ : NoBotOrder M
⊢ M ⊨ linearOrderTheory Language.order

Next tactic:
infer_instance
@[simp]
theorem mem_dom (f : α →. β) (x : α) : x ∈ Dom f ↔ ∃ y, y ∈ f x := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β
x : α
⊢ x ∈ Dom f ↔ ∃ y, y ∈ f x

Next tactic:
simp [Dom, Part.dom_iff_mem]
/-- The type of partial functions `α →. β` is equivalent to
the type of pairs `(p : α → Prop, f : Subtype p → β)`. -/
def equivSubtype : (α →. β) ≃ Σp : α → Prop, Subtype p → β :=
  ⟨fun f => ⟨fun a => (f a).Dom, asSubtype f⟩, fun f x => ⟨f.1 x, fun h => f.2 ⟨x, h⟩⟩, fun f =>
    funext fun a => Part.eta _, fun ⟨p, f⟩ => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
x✝ : (p : α → Prop) × (Subtype p → β)
p : α → Prop
f : Subtype p → β
⊢ (fun f => { fst := fun a => (f a).Dom, snd := asSubtype f })
      ((fun f x => { Dom := Sigma.fst f x, get := fun h => Sigma.snd f { val := x, property := h } })
        { fst := p, snd := f }) =
    { fst := p, snd := f }

Next tactic:
dsimp
/-- The type of partial functions `α →. β` is equivalent to
the type of pairs `(p : α → Prop, f : Subtype p → β)`. -/
def equivSubtype : (α →. β) ≃ Σp : α → Prop, Subtype p → β :=
  ⟨fun f => ⟨fun a => (f a).Dom, asSubtype f⟩, fun f x => ⟨f.1 x, fun h => f.2 ⟨x, h⟩⟩, fun f =>
    funext fun a => Part.eta _, fun ⟨p, f⟩ => by dsimp; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
x✝ : (p : α → Prop) × (Subtype p → β)
p : α → Prop
f : Subtype p → β
⊢ { fst := fun a => p a, snd := asSubtype fun x => { Dom := p x, get := fun h => f { val := x, property := h } } } =
    { fst := p, snd := f }

Next tactic:
congr
@[simp]
theorem mem_restrict {f : α →. β} {s : Set α} (h : s ⊆ f.Dom) (a : α) (b : β) :
    b ∈ f.restrict h a ↔ a ∈ s ∧ b ∈ f a := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β
s : Set α
h : s ⊆ Dom f
a : α
b : β
⊢ b ∈ restrict f h a ↔ a ∈ s ∧ b ∈ f a

Next tactic:
simp [restrict]
theorem mem_res (f : α → β) (s : Set α) (a : α) (b : β) : b ∈ res f s a ↔ a ∈ s ∧ f a = b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α → β
s : Set α
a : α
b : β
⊢ b ∈ res f s a ↔ a ∈ s ∧ f a = b

Next tactic:
simp [res, @eq_comm _ b]
theorem lift_graph {f : α → β} {a b} : (a, b) ∈ (f : α →. β).graph ↔ f a = b :=
  show (∃ _ : True, f a = b) ↔ f a = b by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α → β
a : α
b : β
⊢ (∃ (_ : True), f a = b) ↔ f a = b

Next tactic:
simp
instance lawfulMonad : LawfulMonad (PFun α) := LawfulMonad.mk'
  (bind_pure_comp := fun f x => funext fun a => Part.bind_some_eq_map _ _)
  (id_map := fun f => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
α✝ : Type ?u.16849
f : α →. α✝
⊢ id <$> f = f

Next tactic:
funext a
instance lawfulMonad : LawfulMonad (PFun α) := LawfulMonad.mk'
  (bind_pure_comp := fun f x => funext fun a => Part.bind_some_eq_map _ _)
  (id_map := fun f => by funext a; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
α✝ : Type ?u.16849
f : α →. α✝
a : α
⊢ (id <$> f) a = f a

Next tactic:
dsimp [Functor.map, PFun.map]
instance lawfulMonad : LawfulMonad (PFun α) := LawfulMonad.mk'
  (bind_pure_comp := fun f x => funext fun a => Part.bind_some_eq_map _ _)
  (id_map := fun f => by funext a; dsimp [Functor.map, PFun.map]; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
α✝ : Type ?u.16849
f : α →. α✝
a : α
⊢ Part.map id (f a) = f a

Next tactic:
cases f a
instance lawfulMonad : LawfulMonad (PFun α) := LawfulMonad.mk'
  (bind_pure_comp := fun f x => funext fun a => Part.bind_some_eq_map _ _)
  (id_map := fun f => by funext a; dsimp [Functor.map, PFun.map]; cases f a; 

Proof state:
case h.mk
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
α✝ : Type ?u.16849
f : α →. α✝
a : α
Dom✝ : Prop
get✝ : Dom✝ → α✝
⊢ Part.map id { Dom := Dom✝, get := get✝ } = { Dom := Dom✝, get := get✝ }

Next tactic:
rfl
theorem dom_of_mem_fix {f : α →. Sum β α} {a : α} {b : β} (h : b ∈ f.fix a) : (f a).Dom := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
⊢ (f a).Dom

Next tactic:
let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
theorem dom_of_mem_fix {f : α →. Sum β α} {a : α} {b : β} (h : b ∈ f.fix a) : (f a).Dom := by
  let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ :
  b ∈
    WellFounded.fixF
      (fun a IH =>
        Part.assert (f a).Dom fun hf =>
          match e : Part.get (f a) hf with
          | Sum.inl b => Part.some b
          | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
      a h₁
⊢ (f a).Dom

Next tactic:
rw [WellFounded.fixFEq] at h₂
theorem dom_of_mem_fix {f : α →. Sum β α} {a : α} {b : β} (h : b ∈ f.fix a) : (f a).Dom := by
  let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
  rw [WellFounded.fixFEq] at h₂; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ :
  b ∈
    Part.assert (f a).Dom fun hf =>
      match e : Part.get (f a) hf with
      | Sum.inl b => Part.some b
      | Sum.inr a' =>
        (fun y p =>
            WellFounded.fixF
              (fun a IH =>
                Part.assert (f a).Dom fun hf =>
                  match e : Part.get (f a) hf with
                  | Sum.inl b => Part.some b
                  | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
              y (_ : Acc (fun y x => Sum.inr y ∈ f x) y))
          a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a')
⊢ (f a).Dom

Next tactic:
exact h₂.fst.fst
theorem mem_fix_iff {f : α →. Sum β α} {a : α} {b : β} :
    b ∈ f.fix a ↔ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ f.fix a' :=
  ⟨fun h => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
⊢ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ fix f a'

Next tactic:
let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
theorem mem_fix_iff {f : α →. Sum β α} {a : α} {b : β} :
    b ∈ f.fix a ↔ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ f.fix a' :=
  ⟨fun h => by
    let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ :
  b ∈
    WellFounded.fixF
      (fun a IH =>
        Part.assert (f a).Dom fun hf =>
          match e : Part.get (f a) hf with
          | Sum.inl b => Part.some b
          | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
      a h₁
⊢ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ fix f a'

Next tactic:
rw [WellFounded.fixFEq] at h₂
theorem mem_fix_iff {f : α →. Sum β α} {a : α} {b : β} :
    b ∈ f.fix a ↔ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ f.fix a' :=
  ⟨fun h => by
    let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
    rw [WellFounded.fixFEq] at h₂
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ :
  b ∈
    Part.assert (f a).Dom fun hf =>
      match e : Part.get (f a) hf with
      | Sum.inl b => Part.some b
      | Sum.inr a' =>
        (fun y p =>
            WellFounded.fixF
              (fun a IH =>
                Part.assert (f a).Dom fun hf =>
                  match e : Part.get (f a) hf with
                  | Sum.inl b => Part.some b
                  | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
              y (_ : Acc (fun y x => Sum.inr y ∈ f x) y))
          a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a')
⊢ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ fix f a'

Next tactic:
simp only [Part.mem_assert_iff] at h₂
theorem mem_fix_iff {f : α →. Sum β α} {a : α} {b : β} :
    b ∈ f.fix a ↔ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ f.fix a' :=
  ⟨fun h => by
    let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
    rw [WellFounded.fixFEq] at h₂
    simp only [Part.mem_assert_iff] at h₂
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ :
  ∃ (h : (f a).Dom),
    b ∈
      match e : Part.get (f a) h with
      | Sum.inl b => Part.some b
      | Sum.inr a' =>
        WellFounded.fixF
          (fun a IH =>
            Part.assert (f a).Dom fun hf =>
              match e : Part.get (f a) hf with
              | Sum.inl b => Part.some b
              | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
          a' (_ : Acc (fun y x => Sum.inr y ∈ f x) a')
⊢ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ fix f a'

Next tactic:
cases' h₂ with h₂ h₃
theorem mem_fix_iff {f : α →. Sum β α} {a : α} {b : β} :
    b ∈ f.fix a ↔ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ f.fix a' :=
  ⟨fun h => by
    let ⟨h₁, h₂⟩ := Part.mem_assert_iff.1 h
    rw [WellFounded.fixFEq] at h₂
    simp only [Part.mem_assert_iff] at h₂
    cases' h₂ with h₂ h₃
    

Proof state:
case intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β ⊕ α
a : α
b : β
h : b ∈ fix f a
h₁ : Acc (fun x y => Sum.inr x ∈ f y) a
h₂ : (f a).Dom
h₃ :
  b ∈
    match e : Part.get (f a) h₂ with
    | Sum.inl b => Part.some b
    | Sum.inr a' =>
      WellFounded.fixF
        (fun a IH =>
          Part.assert (f a).Dom fun hf =>
            match e : Part.get (f a) hf with
            | Sum.inl b => Part.some b
            | Sum.inr a' => IH a' (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'))
        a' (_ : Acc (fun y x => Sum.inr y ∈ f x) a')
⊢ Sum.inl b ∈ f a ∨ ∃ a', Sum.inr a' ∈ f a ∧ b ∈ fix f a'

Next tactic:
split at h₃