l3lab/ntp-mathlib huggingface dataset:
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
m : ℕ
a' : α
am : Sum.inr a' ∈ F a m
ba : b ∈ PFun.fix f a'
⊢ b ∈ PFun.fix f a

Next tactic:
induction' m with m IH generalizing a'
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> 

Proof state:
case zero
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
a' : α
am : Sum.inr a' ∈ F a Nat.zero
ba : b ∈ PFun.fix f a'
⊢ b ∈ PFun.fix f a

Next tactic:
simp at am
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> 

Proof state:
case succ
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
m : ℕ
IH : ∀ (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
a' : α
am : Sum.inr a' ∈ F a (Nat.succ m)
ba : b ∈ PFun.fix f a'
⊢ b ∈ PFun.fix f a

Next tactic:
simp at am
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · 

Proof state:
case zero
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
a' : α
ba : b ∈ PFun.fix f a'
am : a' = a
⊢ b ∈ PFun.fix f a

Next tactic:
rwa [← am]
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      

Proof state:
case succ
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
m : ℕ
IH : ∀ (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
a' : α
ba : b ∈ PFun.fix f a'
am :
  ∃ b,
    Sum.inr b ∈
        Nat.rec (Part.some (Sum.inr a))
          (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) m ∧
      Sum.inr a' ∈ f b
⊢ b ∈ PFun.fix f a

Next tactic:
rcases am with ⟨a₂, am₂, fa₂⟩
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      

Proof state:
case succ.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
m : ℕ
IH : ∀ (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
a' : α
ba : b ∈ PFun.fix f a'
a₂ : α
am₂ :
  Sum.inr a₂ ∈
    Nat.rec (Part.some (Sum.inr a))
      (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) m
fa₂ : Sum.inr a' ∈ f a₂
⊢ b ∈ PFun.fix f a

Next tactic:
exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    

Proof state:
case refine'_1.intro.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
n : ℕ
h₂ : Sum.inl b ∈ F a n
_x : ∃ b', Sum.inl b' ∈ F a n
h₁ : ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
⊢ b ∈ PFun.fix f a

Next tactic:
cases n
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> 

Proof state:
case refine'_1.intro.intro.intro.zero
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
h₂ : Sum.inl b ∈ F a Nat.zero
_x : ∃ b', Sum.inl b' ∈ F a Nat.zero
h₁ : ∀ {m : ℕ}, m < Nat.zero → ∃ b, Sum.inr b ∈ F a m
⊢ b ∈ PFun.fix f a

Next tactic:
simp at h₂
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> 

Proof state:
case refine'_1.intro.intro.intro.succ
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
n✝ : ℕ
h₂ : Sum.inl b ∈ F a (Nat.succ n✝)
_x : ∃ b', Sum.inl b' ∈ F a (Nat.succ n✝)
h₁ : ∀ {m : ℕ}, m < Nat.succ n✝ → ∃ b, Sum.inr b ∈ F a m
⊢ b ∈ PFun.fix f a

Next tactic:
simp at h₂
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    

Proof state:
case refine'_1.intro.intro.intro.succ
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
n✝ : ℕ
_x : ∃ b', Sum.inl b' ∈ F a (Nat.succ n✝)
h₁ : ∀ {m : ℕ}, m < Nat.succ n✝ → ∃ b, Sum.inr b ∈ F a m
h₂ :
  Sum.inl b ∈
      Nat.rec (Part.some (Sum.inr a))
        (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) n✝ ∨
    ∃ b_1,
      Sum.inr b_1 ∈
          Nat.rec (Part.some (Sum.inr a))
            (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) n✝ ∧
        Sum.inl b ∈ f b_1
⊢ b ∈ PFun.fix f a

Next tactic:
rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · 

Proof state:
case refine'_1.intro.intro.intro.succ.inl
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
n✝ : ℕ
_x : ∃ b', Sum.inl b' ∈ F a (Nat.succ n✝)
h₁ : ∀ {m : ℕ}, m < Nat.succ n✝ → ∃ b, Sum.inr b ∈ F a m
h₂ :
  Sum.inl b ∈
    Nat.rec (Part.some (Sum.inr a))
      (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) n✝
⊢ b ∈ PFun.fix f a

Next tactic:
cases' h₁ (Nat.lt_succ_self _) with a' h
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · cases' h₁ (Nat.lt_succ_self _) with a' h
      

Proof state:
case refine'_1.intro.intro.intro.succ.inl.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
n✝ : ℕ
_x : ∃ b', Sum.inl b' ∈ F a (Nat.succ n✝)
h₁ : ∀ {m : ℕ}, m < Nat.succ n✝ → ∃ b, Sum.inr b ∈ F a m
h₂ :
  Sum.inl b ∈
    Nat.rec (Part.some (Sum.inr a))
      (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) n✝
a' : α
h : Sum.inr a' ∈ F a n✝
⊢ b ∈ PFun.fix f a

Next tactic:
injection mem_unique h h₂
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · cases' h₁ (Nat.lt_succ_self _) with a' h
      injection mem_unique h h₂
    · 

Proof state:
case refine'_1.intro.intro.intro.succ.inr.intro.intro
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
this : ∀ (m : ℕ) (a' : α), Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a
n✝ : ℕ
_x : ∃ b', Sum.inl b' ∈ F a (Nat.succ n✝)
h₁ : ∀ {m : ℕ}, m < Nat.succ n✝ → ∃ b, Sum.inr b ∈ F a m
a' : α
am' :
  Sum.inr a' ∈
    Nat.rec (Part.some (Sum.inr a))
      (fun x IH => Part.bind IH fun s => Sum.rec (fun val => Part.some s) (fun val => f val) s) n✝
fa' : Sum.inl b ∈ f a'
⊢ b ∈ PFun.fix f a

Next tactic:
exact this _ _ am' (PFun.mem_fix_iff.2 (Or.inl fa'))
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · cases' h₁ (Nat.lt_succ_self _) with a' h
      injection mem_unique h h₂
    · exact this _ _ am' (PFun.mem_fix_iff.2 (Or.inl fa'))
  · 

Proof state:
case refine'_2
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
h : b ∈ PFun.fix f a
⊢ ∃ n, ((∃ b', Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m) ∧ Sum.inl b ∈ F a n

Next tactic:
suffices
      ∀ (a') (_ : b ∈ PFun.fix f a') (k) (_ : Sum.inr a' ∈ F a k),
        ∃ n, Sum.inl b ∈ F a n ∧ ∀ m < n, ∀ (_ : k ≤ m), ∃ a₂, Sum.inr a₂ ∈ F a m by
      rcases this _ h 0 (by simp) with ⟨n, hn₁, hn₂⟩
      exact ⟨_, ⟨⟨_, hn₁⟩, fun {m} mn => hn₂ m mn (Nat.zero_le _)⟩, hn₁⟩
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · cases' h₁ (Nat.lt_succ_self _) with a' h
      injection mem_unique h h₂
    · exact this _ _ am' (PFun.mem_fix_iff.2 (Or.inl fa'))
  · suffices
      ∀ (a') (_ : b ∈ PFun.fix f a') (k) (_ : Sum.inr a' ∈ F a k),
        ∃ n, Sum.inl b ∈ F a n ∧ ∀ m < n, ∀ (_ : k ≤ m), ∃ a₂, Sum.inr a₂ ∈ F a m by
      

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
h : b ∈ PFun.fix f a
this :
  ∀ (a' : α),
    b ∈ PFun.fix f a' →
      ∀ (k : ℕ), Sum.inr a' ∈ F a k → ∃ n, Sum.inl b ∈ F a n ∧ ∀ m < n, k ≤ m → ∃ a₂, Sum.inr a₂ ∈ F a m
⊢ ∃ n, ((∃ b', Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b, Sum.inr b ∈ F a m) ∧ Sum.inl b ∈ F a n

Next tactic:
rcases this _ h 0 (by simp) with ⟨n, hn₁, hn₂⟩
theorem fix_aux {α σ} (f : α →. Sum σ α) (a : α) (b : σ) :
    let F : α → ℕ →. Sum σ α := fun a n =>
      n.rec (some (Sum.inr a)) fun _ IH => IH.bind fun s => Sum.casesOn s (fun _ => Part.some s) f
    (∃ n : ℕ,
        ((∃ b' : σ, Sum.inl b' ∈ F a n) ∧ ∀ {m : ℕ}, m < n → ∃ b : α, Sum.inr b ∈ F a m) ∧
          Sum.inl b ∈ F a n) ↔
      b ∈ PFun.fix f a := by
  intro F; refine' ⟨fun h => _, fun h => _⟩
  · rcases h with ⟨n, ⟨_x, h₁⟩, h₂⟩
    have : ∀ m a', Sum.inr a' ∈ F a m → b ∈ PFun.fix f a' → b ∈ PFun.fix f a := by
      intro m a' am ba
      induction' m with m IH generalizing a' <;> simp at am
      · rwa [← am]
      rcases am with ⟨a₂, am₂, fa₂⟩
      exact IH _ am₂ (PFun.mem_fix_iff.2 (Or.inr ⟨_, fa₂, ba⟩))
    cases n <;> simp at h₂
    rcases h₂ with (h₂ | ⟨a', am', fa'⟩)
    · cases' h₁ (Nat.lt_succ_self _) with a' h
      injection mem_unique h h₂
    · exact this _ _ am' (PFun.mem_fix_iff.2 (Or.inl fa'))
  · suffices
      ∀ (a') (_ : b ∈ PFun.fix f a') (k) (_ : Sum.inr a' ∈ F a k),
        ∃ n, Sum.inl b ∈ F a n ∧ ∀ m < n, ∀ (_ : k ≤ m), ∃ a₂, Sum.inr a₂ ∈ F a m by
      rcases this _ h 0 (by 

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
σ✝ : Type u_4
inst✝³ : Primcodable α✝
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ✝
α : Type u_5
σ : Type u_6
f : α →. σ ⊕ α
a : α
b : σ
F : α → ℕ →. σ ⊕ α :=
  fun a n =>
    Nat.rec (Part.some (Sum.inr a)) (fun x IH => Part.bind IH fun s => Sum.casesOn s (fun x => Part.some s) f) n
h : b ∈ PFun.fix f a
this :
  ∀ (a' : α),
    b ∈ PFun.fix f a' →
      ∀ (k : ℕ), Sum.inr a' ∈ F a k → ∃ n, Sum.inl b ∈ F a n ∧ ∀ m < n, k ≤ m → ∃ a₂, Sum.inr a₂ ∈ F a m
⊢ Sum.inr a ∈ F a 0

Next tactic:
simp