l3lab/ntp-mathlib huggingface dataset:
/-- Another induction lemma for `b ∈ f.fix a` which allows one to prove a predicate `P` holds for
`a` given that `f a` inherits `P` from `a` and `P` holds for preimages of `b`.
-/
@[elab_as_elim]
def fixInduction' {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α}
    (h : b ∈ f.fix a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) : C a := by
  refine' fixInduction h fun a' h ih => _
  rcases e : (f a').get (dom_of_mem_fix h) with b' | a'' <;> replace e : _ ∈ f a' := ⟨_, e⟩
  · 

Proof state:
case inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h✝ : b ∈ fix f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
a' : α
h : b ∈ fix f a'
ih : (a'' : α) → Sum.inr a'' ∈ f a' → C a''
b' : β
e : Sum.inl b' ∈ f a'
⊢ C a'

Next tactic:
apply hbase
/-- Another induction lemma for `b ∈ f.fix a` which allows one to prove a predicate `P` holds for
`a` given that `f a` inherits `P` from `a` and `P` holds for preimages of `b`.
-/
@[elab_as_elim]
def fixInduction' {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α}
    (h : b ∈ f.fix a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) : C a := by
  refine' fixInduction h fun a' h ih => _
  rcases e : (f a').get (dom_of_mem_fix h) with b' | a'' <;> replace e : _ ∈ f a' := ⟨_, e⟩
  · apply hbase
    

Proof state:
case inl.a
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h✝ : b ∈ fix f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
a' : α
h : b ∈ fix f a'
ih : (a'' : α) → Sum.inr a'' ∈ f a' → C a''
b' : β
e : Sum.inl b' ∈ f a'
⊢ Sum.inl b ∈ f a'

Next tactic:
convert e
/-- Another induction lemma for `b ∈ f.fix a` which allows one to prove a predicate `P` holds for
`a` given that `f a` inherits `P` from `a` and `P` holds for preimages of `b`.
-/
@[elab_as_elim]
def fixInduction' {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α}
    (h : b ∈ f.fix a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) : C a := by
  refine' fixInduction h fun a' h ih => _
  rcases e : (f a').get (dom_of_mem_fix h) with b' | a'' <;> replace e : _ ∈ f a' := ⟨_, e⟩
  · apply hbase
    convert e
    

Proof state:
case h.e'_4.h.e'_3
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h✝ : b ∈ fix f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
a' : α
h : b ∈ fix f a'
ih : (a'' : α) → Sum.inr a'' ∈ f a' → C a''
b' : β
e : Sum.inl b' ∈ f a'
⊢ b = b'

Next tactic:
exact Part.mem_unique h (fix_stop e)
/-- Another induction lemma for `b ∈ f.fix a` which allows one to prove a predicate `P` holds for
`a` given that `f a` inherits `P` from `a` and `P` holds for preimages of `b`.
-/
@[elab_as_elim]
def fixInduction' {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α}
    (h : b ∈ f.fix a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) : C a := by
  refine' fixInduction h fun a' h ih => _
  rcases e : (f a').get (dom_of_mem_fix h) with b' | a'' <;> replace e : _ ∈ f a' := ⟨_, e⟩
  · apply hbase
    convert e
    exact Part.mem_unique h (fix_stop e)
  · 

Proof state:
case inr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h✝ : b ∈ fix f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
a' : α
h : b ∈ fix f a'
ih : (a'' : α) → Sum.inr a'' ∈ f a' → C a''
a'' : α
e : Sum.inr a'' ∈ f a'
⊢ C a'

Next tactic:
exact hind _ _ (fix_fwd h e) e (ih _ e)
theorem fixInduction'_stop {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α} (h : b ∈ f.fix a)
    (fa : Sum.inl b ∈ f a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hbase a fa := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h : b ∈ fix f a
fa : Sum.inl b ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ fixInduction' h hbase hind = hbase a fa

Next tactic:
unfold fixInduction'
theorem fixInduction'_stop {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α} (h : b ∈ f.fix a)
    (fa : Sum.inl b ∈ f a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hbase a fa := by
  unfold fixInduction'
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h : b ∈ fix f a
fa : Sum.inl b ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ (fixInduction h fun a' h ih =>
      Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a') (Part.get (f a') (_ : (f a').Dom))
        (fun b' e =>
          let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
          hbase a' (_ : Sum.inl b ∈ f a'))
        (fun a'' e =>
          let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
          hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
        (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom))) =
    hbase a fa

Next tactic:
rw [fixInduction_spec]
theorem fixInduction'_stop {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α} (h : b ∈ f.fix a)
    (fa : Sum.inl b ∈ f a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hbase a fa := by
  unfold fixInduction'
  rw [fixInduction_spec]
  -- Porting note: the explicit motive required because `simp` behaves differently
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h : b ∈ fix f a
fa : Sum.inl b ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ Sum.casesOn (motive := fun x => Part.get (f a) (_ : (f a).Dom) = x → C a) (Part.get (f a) (_ : (f a).Dom))
      (fun b' e =>
        let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inl b');
        hbase a (_ : Sum.inl b ∈ f a))
      (fun a'' e =>
        let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'');
        hind a a'' (_ : b ∈ fix f a'') e
          ((fun a' h' =>
              fixInduction (_ : b ∈ fix f a') fun a' h ih =>
                Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a')
                  (Part.get (f a') (_ : (f a').Dom))
                  (fun b' e =>
                    let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
                    hbase a' (_ : Sum.inl b ∈ f a'))
                  (fun a'' e =>
                    let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
                    hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
                  (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))
            a'' e))
      (_ : Part.get (f a) (_ : (f a).Dom) = Part.get (f a) (_ : (f a).Dom)) =
    hbase a fa

Next tactic:
refine' Eq.rec (motive := fun x e =>
      Sum.casesOn (motive := fun y => (f a).get (dom_of_mem_fix h) = y → C a) x _ _
      (Eq.trans (Part.get_eq_of_mem fa (dom_of_mem_fix h)) e) = hbase a fa) _
    (Part.get_eq_of_mem fa (dom_of_mem_fix h)).symm
theorem fixInduction'_stop {C : α → Sort*} {f : α →. Sum β α} {b : β} {a : α} (h : b ∈ f.fix a)
    (fa : Sum.inl b ∈ f a) (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hbase a fa := by
  unfold fixInduction'
  rw [fixInduction_spec]
  -- Porting note: the explicit motive required because `simp` behaves differently
  refine' Eq.rec (motive := fun x e =>
      Sum.casesOn (motive := fun y => (f a).get (dom_of_mem_fix h) = y → C a) x _ _
      (Eq.trans (Part.get_eq_of_mem fa (dom_of_mem_fix h)) e) = hbase a fa) _
    (Part.get_eq_of_mem fa (dom_of_mem_fix h)).symm
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a : α
h : b ∈ fix f a
fa : Sum.inl b ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ (fun x e =>
      Sum.casesOn (motive := fun y => Part.get (f a) (_ : (f a).Dom) = y → C a) x
          (fun val =>
            (fun b' e =>
                let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inl b');
                hbase a (_ : Sum.inl b ∈ f a))
              val)
          (fun val =>
            (fun a'' e =>
                let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'');
                hind a a'' (_ : b ∈ fix f a'') e
                  ((fun a' h' =>
                      fixInduction (_ : b ∈ fix f a') fun a' h ih =>
                        Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a')
                          (Part.get (f a') (_ : (f a').Dom))
                          (fun b' e =>
                            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
                            hbase a' (_ : Sum.inl b ∈ f a'))
                          (fun a'' e =>
                            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
                            hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
                          (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))
                    a'' e))
              val)
          (_ : Part.get (f a) (_ : (f a).Dom) = x) =
        hbase a fa)
    (Sum.inl b) (_ : Sum.inl b = Sum.inl b)

Next tactic:
simp
theorem fixInduction'_fwd {C : α → Sort*} {f : α →. Sum β α} {b : β} {a a' : α} (h : b ∈ f.fix a)
    (h' : b ∈ f.fix a') (fa : Sum.inr a' ∈ f a)
    (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a a' : α
h : b ∈ fix f a
h' : b ∈ fix f a'
fa : Sum.inr a' ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ fixInduction' h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind)

Next tactic:
unfold fixInduction'
theorem fixInduction'_fwd {C : α → Sort*} {f : α →. Sum β α} {b : β} {a a' : α} (h : b ∈ f.fix a)
    (h' : b ∈ f.fix a') (fa : Sum.inr a' ∈ f a)
    (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind) := by
  unfold fixInduction'
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a a' : α
h : b ∈ fix f a
h' : b ∈ fix f a'
fa : Sum.inr a' ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ (fixInduction h fun a' h ih =>
      Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a') (Part.get (f a') (_ : (f a').Dom))
        (fun b' e =>
          let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
          hbase a' (_ : Sum.inl b ∈ f a'))
        (fun a'' e =>
          let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
          hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
        (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom))) =
    hind a a' h' fa
      (fixInduction h' fun a' h ih =>
        Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → (fun x => C x) a')
          (Part.get (f a') (_ : (f a').Dom))
          (fun b' e =>
            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
            hbase a' (_ : Sum.inl b ∈ f a'))
          (fun a'' e =>
            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
            hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
          (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))

Next tactic:
rw [fixInduction_spec]
theorem fixInduction'_fwd {C : α → Sort*} {f : α →. Sum β α} {b : β} {a a' : α} (h : b ∈ f.fix a)
    (h' : b ∈ f.fix a') (fa : Sum.inr a' ∈ f a)
    (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind) := by
  unfold fixInduction'
  rw [fixInduction_spec]
  -- Porting note: the explicit motive required because `simp` behaves differently
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a a' : α
h : b ∈ fix f a
h' : b ∈ fix f a'
fa : Sum.inr a' ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ Sum.casesOn (motive := fun x => Part.get (f a) (_ : (f a).Dom) = x → C a) (Part.get (f a) (_ : (f a).Dom))
      (fun b' e =>
        let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inl b');
        hbase a (_ : Sum.inl b ∈ f a))
      (fun a'' e =>
        let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'');
        hind a a'' (_ : b ∈ fix f a'') e
          ((fun a' h' =>
              fixInduction (_ : b ∈ fix f a') fun a' h ih =>
                Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a')
                  (Part.get (f a') (_ : (f a').Dom))
                  (fun b' e =>
                    let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
                    hbase a' (_ : Sum.inl b ∈ f a'))
                  (fun a'' e =>
                    let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
                    hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
                  (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))
            a'' e))
      (_ : Part.get (f a) (_ : (f a).Dom) = Part.get (f a) (_ : (f a).Dom)) =
    hind a a' h' fa
      (fixInduction h' fun a' h ih =>
        Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → (fun x => C x) a')
          (Part.get (f a') (_ : (f a').Dom))
          (fun b' e =>
            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
            hbase a' (_ : Sum.inl b ∈ f a'))
          (fun a'' e =>
            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
            hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
          (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))

Next tactic:
refine' Eq.rec (motive := fun x e =>
      Sum.casesOn (motive := fun y => (f a).get (dom_of_mem_fix h) = y → C a) x _ _
      (Eq.trans (Part.get_eq_of_mem fa (dom_of_mem_fix h)) e) = _) _
    (Part.get_eq_of_mem fa (dom_of_mem_fix h)).symm
theorem fixInduction'_fwd {C : α → Sort*} {f : α →. Sum β α} {b : β} {a a' : α} (h : b ∈ f.fix a)
    (h' : b ∈ f.fix a') (fa : Sum.inr a' ∈ f a)
    (hbase : ∀ a_final : α, Sum.inl b ∈ f a_final → C a_final)
    (hind : ∀ a₀ a₁ : α, b ∈ f.fix a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀) :
    @fixInduction' _ _ C _ _ _ h hbase hind = hind a a' h' fa (fixInduction' h' hbase hind) := by
  unfold fixInduction'
  rw [fixInduction_spec]
  -- Porting note: the explicit motive required because `simp` behaves differently
  refine' Eq.rec (motive := fun x e =>
      Sum.casesOn (motive := fun y => (f a).get (dom_of_mem_fix h) = y → C a) x _ _
      (Eq.trans (Part.get_eq_of_mem fa (dom_of_mem_fix h)) e) = _) _
    (Part.get_eq_of_mem fa (dom_of_mem_fix h)).symm
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
C : α → Sort u_7
f : α →. β ⊕ α
b : β
a a' : α
h : b ∈ fix f a
h' : b ∈ fix f a'
fa : Sum.inr a' ∈ f a
hbase : (a_final : α) → Sum.inl b ∈ f a_final → C a_final
hind : (a₀ a₁ : α) → b ∈ fix f a₁ → Sum.inr a₁ ∈ f a₀ → C a₁ → C a₀
⊢ (fun x e =>
      Sum.casesOn (motive := fun y => Part.get (f a) (_ : (f a).Dom) = y → C a) x
          (fun val =>
            (fun b' e =>
                let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inl b');
                hbase a (_ : Sum.inl b ∈ f a))
              val)
          (fun val =>
            (fun a'' e =>
                let_fun e := (_ : ∃ (h : (f a).Dom), Part.get (f a) h = Sum.inr a'');
                hind a a'' (_ : b ∈ fix f a'') e
                  ((fun a' h' =>
                      fixInduction (_ : b ∈ fix f a') fun a' h ih =>
                        Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → C a')
                          (Part.get (f a') (_ : (f a').Dom))
                          (fun b' e =>
                            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
                            hbase a' (_ : Sum.inl b ∈ f a'))
                          (fun a'' e =>
                            let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
                            hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
                          (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom)))
                    a'' e))
              val)
          (_ : Part.get (f a) (_ : (f a).Dom) = x) =
        hind a a' h' fa
          (fixInduction h' fun a' h ih =>
            Sum.casesOn (motive := fun x => Part.get (f a') (_ : (f a').Dom) = x → (fun x => C x) a')
              (Part.get (f a') (_ : (f a').Dom))
              (fun b' e =>
                let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inl b');
                hbase a' (_ : Sum.inl b ∈ f a'))
              (fun a'' e =>
                let_fun e := (_ : ∃ (h : (f a').Dom), Part.get (f a') h = Sum.inr a'');
                hind a' a'' (_ : b ∈ fix f a'') e (ih a'' e))
              (_ : Part.get (f a') (_ : (f a').Dom) = Part.get (f a') (_ : (f a').Dom))))
    (Sum.inr a') (_ : Sum.inr a' = Sum.inr a')

Next tactic:
simp
theorem preimage_univ : f.preimage Set.univ = f.Dom := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β
⊢ preimage f Set.univ = Dom f

Next tactic:
ext
theorem preimage_univ : f.preimage Set.univ = f.Dom := by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f : α →. β
x✝ : α
⊢ x✝ ∈ preimage f Set.univ ↔ x✝ ∈ Dom f

Next tactic:
simp [mem_preimage, mem_dom]
theorem coe_preimage (f : α → β) (s : Set β) : (f : α →. β).preimage s = f ⁻¹' s := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set β
⊢ preimage (↑f) s = f ⁻¹' s

Next tactic:
ext
theorem coe_preimage (f : α → β) (s : Set β) : (f : α →. β).preimage s = f ⁻¹' s := by ext; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set β
x✝ : α
⊢ x✝ ∈ preimage (↑f) s ↔ x✝ ∈ f ⁻¹' s

Next tactic:
simp
theorem mem_core_res (f : α → β) (s : Set α) (t : Set β) (x : α) :
    x ∈ (res f s).core t ↔ x ∈ s → f x ∈ t := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
x : α
⊢ x ∈ core (res f s) t ↔ x ∈ s → f x ∈ t

Next tactic:
simp [mem_core, mem_res]
theorem core_res (f : α → β) (s : Set α) (t : Set β) : (res f s).core t = sᶜ ∪ f ⁻¹' t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
⊢ core (res f s) t = sᶜ ∪ f ⁻¹' t

Next tactic:
ext x
theorem core_res (f : α → β) (s : Set α) (t : Set β) : (res f s).core t = sᶜ ∪ f ⁻¹' t := by
  ext x
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
x : α
⊢ x ∈ core (res f s) t ↔ x ∈ sᶜ ∪ f ⁻¹' t

Next tactic:
rw [mem_core_res]
theorem core_res (f : α → β) (s : Set α) (t : Set β) : (res f s).core t = sᶜ ∪ f ⁻¹' t := by
  ext x
  rw [mem_core_res]
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
x : α
⊢ x ∈ s → f x ∈ t ↔ x ∈ sᶜ ∪ f ⁻¹' t

Next tactic:
by_cases h : x ∈ s
theorem core_res (f : α → β) (s : Set α) (t : Set β) : (res f s).core t = sᶜ ∪ f ⁻¹' t := by
  ext x
  rw [mem_core_res]
  by_cases h : x ∈ s <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
x : α
h : x ∈ s
⊢ x ∈ s → f x ∈ t ↔ x ∈ sᶜ ∪ f ⁻¹' t

Next tactic:
simp [h]
theorem core_res (f : α → β) (s : Set α) (t : Set β) : (res f s).core t = sᶜ ∪ f ⁻¹' t := by
  ext x
  rw [mem_core_res]
  by_cases h : x ∈ s <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set α
t : Set β
x : α
h : x ∉ s
⊢ x ∈ s → f x ∈ t ↔ x ∈ sᶜ ∪ f ⁻¹' t

Next tactic:
simp [h]
theorem core_restrict (f : α → β) (s : Set β) : (f : α →. β).core s = s.preimage f := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set β
⊢ core (↑f) s = f ⁻¹' s

Next tactic:
ext x
theorem core_restrict (f : α → β) (s : Set β) : (f : α →. β).core s = s.preimage f := by
  ext x; 

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ : α →. β
f : α → β
s : Set β
x : α
⊢ x ∈ core (↑f) s ↔ x ∈ f ⁻¹' s

Next tactic:
simp [core_def]
theorem core_eq (f : α →. β) (s : Set β) : f.core s = f.preimage s ∪ f.Domᶜ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ f : α →. β
s : Set β
⊢ core f s = preimage f s ∪ (Dom f)ᶜ

Next tactic:
rw [preimage_eq, Set.union_distrib_right, Set.union_comm (Dom f), Set.compl_union_self,
    Set.inter_univ, Set.union_eq_self_of_subset_right (f.compl_dom_subset_core s)]
theorem preimage_asSubtype (f : α →. β) (s : Set β) :
    f.asSubtype ⁻¹' s = Subtype.val ⁻¹' f.preimage s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ f : α →. β
s : Set β
⊢ asSubtype f ⁻¹' s = Subtype.val ⁻¹' preimage f s

Next tactic:
ext x
theorem preimage_asSubtype (f : α →. β) (s : Set β) :
    f.asSubtype ⁻¹' s = Subtype.val ⁻¹' f.preimage s := by
  ext x
  

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ι : Type u_6
f✝ f : α →. β
s : Set β
x : ↑(Dom f)
⊢ x ∈ asSubtype f ⁻¹' s ↔ x ∈ Subtype.val ⁻¹' preimage f s

Next tactic:
simp only [Set.mem_preimage, Set.mem_setOf_eq, PFun.asSubtype, PFun.mem_preimage]