l3lab/ntp-mathlib huggingface dataset:
@[elab_as_elim]
theorem head_induction_on {P : ∀ a : α, ReflTransGen r a b → Prop} {a : α} (h : ReflTransGen r a b)
    (refl : P b refl)
    (head : ∀ {a c} (h' : r a c) (h : ReflTransGen r c b), P c h → P a (h.head h')) : P a h := by
  induction h
  case refl => exact refl
  case tail b c _ hbc ih =>
  -- Porting note: Lean 3 figured out the motive and `apply ih` worked
  refine @ih (λ {a : α} (hab : ReflTransGen r a b) => P a (ReflTransGen.tail hab hbc)) ?_ ?_
  { exact head hbc _ refl }
  { 

Proof state:
case refine_2
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝¹ b✝ c✝ d a b c : α
a✝ : ReflTransGen r a b
hbc : r b c
ih :
  ∀ {P : (a : α) → ReflTransGen r a b → Prop},
    P b (_ : ReflTransGen r b b) →
      (∀ {a c : α} (h' : r a c) (h : ReflTransGen r c b), P c h → P a (_ : ReflTransGen r a b)) → P a a✝
P : (a : α) → ReflTransGen r a c → Prop
refl : P c (_ : ReflTransGen r c c)
head : ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 c), P c_1 h → P a (_ : ReflTransGen r a c)
⊢ ∀ {a c_1 : α} (h' : r a c_1) (h : ReflTransGen r c_1 b),
    (fun {a} hab => P a (_ : ReflTransGen r a c)) h →
      (fun {a} hab => P a (_ : ReflTransGen r a c)) (_ : ReflTransGen r a b)

Next tactic:
exact fun h1 h2 ↦ head h1 (h2.tail hbc)
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
h : ReflTransGen r a b
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
⊢ P h

Next tactic:
induction h
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
⊢ P (_ : ReflTransGen r a a)
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝² b✝¹ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
b✝ c✝ : α
a✝¹ : ReflTransGen r a b✝
a✝ : r b✝ c✝
a_ih✝ : P a✝¹
⊢ P (_ : ReflTransGen r a c✝)

Next tactic:
case refl => exact ih₁ a
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
⊢ P (_ : ReflTransGen r a a)

Next tactic:
case refl => exact ih₁ a
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  case refl => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
⊢ P (_ : ReflTransGen r a a)

Next tactic:
exact ih₁ a
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  case refl => exact ih₁ a
  

Proof state:
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝² b✝¹ c d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
b✝ c✝ : α
a✝¹ : ReflTransGen r a b✝
a✝ : r b✝ c✝
a_ih✝ : P a✝¹
⊢ P (_ : ReflTransGen r a c✝)

Next tactic:
case tail b c hab hbc ih => exact ih₃ hab (single hbc) ih (ih₂ hbc)
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  case refl => exact ih₁ a
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝¹ c✝ d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b✝ : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
b c : α
hab : ReflTransGen r a b
hbc : r b c
ih : P hab
⊢ P (_ : ReflTransGen r a c)

Next tactic:
case tail b c hab hbc ih => exact ih₃ hab (single hbc) ih (ih₂ hbc)
@[elab_as_elim]
theorem trans_induction_on {P : ∀ {a b : α}, ReflTransGen r a b → Prop} {a b : α}
    (h : ReflTransGen r a b) (ih₁ : ∀ a, @P a a refl) (ih₂ : ∀ {a b} (h : r a b), P (single h))
    (ih₃ : ∀ {a b c} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ →
     P (h₁.trans h₂)) : P h := by
  induction h
  case refl => exact ih₁ a
  case tail b c hab hbc ih => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝¹ c✝ d : α
P : {a b : α} → ReflTransGen r a b → Prop
a b✝ : α
ih₁ : ∀ (a : α), P (_ : ReflTransGen r a a)
ih₂ : ∀ {a b : α} (h : r a b), P (_ : ReflTransGen r a b)
ih₃ : ∀ {a b c : α} (h₁ : ReflTransGen r a b) (h₂ : ReflTransGen r b c), P h₁ → P h₂ → P (_ : ReflTransGen r a c)
b c : α
hab : ReflTransGen r a b
hbc : r b c
ih : P hab
⊢ P (_ : ReflTransGen r a c)

Next tactic:
exact ih₃ hab (single hbc) ih (ih₂ hbc)
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
h : ReflTransGen r a b
⊢ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b

Next tactic:
induction h using Relation.ReflTransGen.head_induction_on
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · 

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
⊢ b = b ∨ ∃ c, r b c ∧ ReflTransGen r c b

Next tactic:
left
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · left
    

Proof state:
case refl.h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
⊢ b = b

Next tactic:
rfl
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · left
    rfl
  · 

Proof state:
case head
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d a✝¹ c✝ : α
h'✝ : r a✝¹ c✝
h✝ : ReflTransGen r c✝ b
a✝ : c✝ = b ∨ ∃ c, r c✝ c ∧ ReflTransGen r c b
⊢ a✝¹ = b ∨ ∃ c, r a✝¹ c ∧ ReflTransGen r c b

Next tactic:
right
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · left
    rfl
  · right
    

Proof state:
case head.h
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d a✝¹ c✝ : α
h'✝ : r a✝¹ c✝
h✝ : ReflTransGen r c✝ b
a✝ : c✝ = b ∨ ∃ c, r c✝ c ∧ ReflTransGen r c b
⊢ ∃ c, r a✝¹ c ∧ ReflTransGen r c b

Next tactic:
exact ⟨_, by assumption, by assumption⟩
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · left
    rfl
  · right
    exact ⟨_, by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d a✝¹ c✝ : α
h'✝ : r a✝¹ c✝
h✝ : ReflTransGen r c✝ b
a✝ : c✝ = b ∨ ∃ c, r c✝ c ∧ ReflTransGen r c b
⊢ r a✝¹ ?m.23175

Next tactic:
assumption
theorem cases_head (h : ReflTransGen r a b) : a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  induction h using Relation.ReflTransGen.head_induction_on
  · left
    rfl
  · right
    exact ⟨_, by assumption, by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d a✝¹ c✝ : α
h'✝ : r a✝¹ c✝
h✝ : ReflTransGen r c✝ b
a✝ : c✝ = b ∨ ∃ c, r c✝ c ∧ ReflTransGen r c b
⊢ ReflTransGen r c✝ b

Next tactic:
assumption
theorem cases_head_iff : ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
⊢ ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b

Next tactic:
use cases_head
theorem cases_head_iff : ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  use cases_head
  

Proof state:
case mpr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
⊢ (a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b) → ReflTransGen r a b

Next tactic:
rintro (rfl | ⟨c, hac, hcb⟩)
theorem cases_head_iff : ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  use cases_head
  rintro (rfl | ⟨c, hac, hcb⟩)
  · 

Proof state:
case mpr.inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a c d : α
⊢ ReflTransGen r a a

Next tactic:
rfl
theorem cases_head_iff : ReflTransGen r a b ↔ a = b ∨ ∃ c, r a c ∧ ReflTransGen r c b := by
  use cases_head
  rintro (rfl | ⟨c, hac, hcb⟩)
  · rfl
  · 

Proof state:
case mpr.inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c✝ d c : α
hac : r a c
hcb : ReflTransGen r c b
⊢ ReflTransGen r a b

Next tactic:
exact head hac hcb
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
U : Relator.RightUnique r
ab : ReflTransGen r a b
ac : ReflTransGen r a c
⊢ ReflTransGen r b c ∨ ReflTransGen r c b

Next tactic:
induction' ab with b d _ bd IH
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · 

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
⊢ ReflTransGen r a c ∨ ReflTransGen r c a

Next tactic:
exact Or.inl ac
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · 

Proof state:
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ c d✝ : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
b d : α
a✝ : ReflTransGen r a b
bd : r b d
IH : ReflTransGen r b c ∨ ReflTransGen r c b
⊢ ReflTransGen r d c ∨ ReflTransGen r c d

Next tactic:
rcases IH with (IH | IH)
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · rcases IH with (IH | IH)
    · 

Proof state:
case tail.inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ c d✝ : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
b d : α
a✝ : ReflTransGen r a b
bd : r b d
IH : ReflTransGen r b c
⊢ ReflTransGen r d c ∨ ReflTransGen r c d

Next tactic:
rcases cases_head IH with (rfl | ⟨e, be, ec⟩)
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · rcases IH with (IH | IH)
    · rcases cases_head IH with (rfl | ⟨e, be, ec⟩)
      · 

Proof state:
case tail.inl.inl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ d✝ : α
U : Relator.RightUnique r
b d : α
a✝ : ReflTransGen r a b
bd : r b d
ac : ReflTransGen r a b
IH : ReflTransGen r b b
⊢ ReflTransGen r d b ∨ ReflTransGen r b d

Next tactic:
exact Or.inr (single bd)
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · rcases IH with (IH | IH)
    · rcases cases_head IH with (rfl | ⟨e, be, ec⟩)
      · exact Or.inr (single bd)
      · 

Proof state:
case tail.inl.inr.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ c d✝ : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
b d : α
a✝ : ReflTransGen r a b
bd : r b d
IH : ReflTransGen r b c
e : α
be : r b e
ec : ReflTransGen r e c
⊢ ReflTransGen r d c ∨ ReflTransGen r c d

Next tactic:
cases U bd be
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · rcases IH with (IH | IH)
    · rcases cases_head IH with (rfl | ⟨e, be, ec⟩)
      · exact Or.inr (single bd)
      · cases U bd be
        

Proof state:
case tail.inl.inr.intro.intro.refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ c d✝ : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
b d : α
a✝ : ReflTransGen r a b
bd : r b d
IH : ReflTransGen r b c
be : r b d
ec : ReflTransGen r d c
⊢ ReflTransGen r d c ∨ ReflTransGen r c d

Next tactic:
exact Or.inl ec
theorem total_of_right_unique (U : Relator.RightUnique r) (ab : ReflTransGen r a b)
    (ac : ReflTransGen r a c) : ReflTransGen r b c ∨ ReflTransGen r c b := by
  induction' ab with b d _ bd IH
  · exact Or.inl ac
  · rcases IH with (IH | IH)
    · rcases cases_head IH with (rfl | ⟨e, be, ec⟩)
      · exact Or.inr (single bd)
      · cases U bd be
        exact Or.inl ec
    · 

Proof state:
case tail.inr
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b✝ c d✝ : α
U : Relator.RightUnique r
ac : ReflTransGen r a c
b d : α
a✝ : ReflTransGen r a b
bd : r b d
IH : ReflTransGen r c b
⊢ ReflTransGen r d c ∨ ReflTransGen r c d

Next tactic:
exact Or.inr (IH.tail bd)
theorem to_reflTransGen {a b} (h : TransGen r a b) : ReflTransGen r a b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝ c d a b : α
h : TransGen r a b
⊢ ReflTransGen r a b

Next tactic:
induction' h with b h b c _ bc ab
theorem to_reflTransGen {a b} (h : TransGen r a b) : ReflTransGen r a b := by
  induction' h with b h b c _ bc ab
  

Proof state:
case single
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b✝¹ c d a b✝ b : α
h : r a b
⊢ ReflTransGen r a b
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝¹ b✝¹ c✝ d a b✝ b c : α
a✝ : TransGen r a b
bc : r b c
ab : ReflTransGen r a b
⊢ ReflTransGen r a c

Next tactic:
exact ReflTransGen.single h
theorem to_reflTransGen {a b} (h : TransGen r a b) : ReflTransGen r a b := by
  induction' h with b h b c _ bc ab
  exact ReflTransGen.single h
  

Proof state:
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝¹ b✝¹ c✝ d a b✝ b c : α
a✝ : TransGen r a b
bc : r b c
ab : ReflTransGen r a b
⊢ ReflTransGen r a c

Next tactic:
exact ReflTransGen.tail ab bc
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
hbc : ReflTransGen r b c
⊢ TransGen r a c

Next tactic:
induction hbc
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
⊢ TransGen r a b
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
b✝ c✝ : α
a✝¹ : ReflTransGen r b b✝
a✝ : r b✝ c✝
a_ih✝ : TransGen r a b✝
⊢ TransGen r a c✝

Next tactic:
case refl => assumption
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
⊢ TransGen r a b

Next tactic:
case refl => assumption
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  case refl => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
⊢ TransGen r a b

Next tactic:
assumption
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  case refl => assumption
  

Proof state:
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : TransGen r a b
b✝ c✝ : α
a✝¹ : ReflTransGen r b b✝
a✝ : r b✝ c✝
a_ih✝ : TransGen r a b✝
⊢ TransGen r a c✝

Next tactic:
case tail c d _ hcd hac => exact hac.tail hcd
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  case refl => assumption
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c✝ d✝ : α
hab : TransGen r a b
c d : α
a✝ : ReflTransGen r b c
hcd : r c d
hac : TransGen r a c
⊢ TransGen r a d

Next tactic:
case tail c d _ hcd hac => exact hac.tail hcd
theorem trans_left (hab : TransGen r a b) (hbc : ReflTransGen r b c) : TransGen r a c := by
  induction hbc
  case refl => assumption
  case tail c d _ hcd hac => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c✝ d✝ : α
hab : TransGen r a b
c d : α
a✝ : ReflTransGen r b c
hcd : r c d
hac : TransGen r a c
⊢ TransGen r a d

Next tactic:
exact hac.tail hcd
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b c d : α
hab : ReflTransGen r a b
hbc : r b c
⊢ TransGen r a c

Next tactic:
induction hab generalizing c
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  

Proof state:
case refl
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d c : α
hbc : r a c
⊢ TransGen r a c
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d b✝ c✝ : α
a✝¹ : ReflTransGen r a b✝
a✝ : r b✝ c✝
a_ih✝ : ∀ {c : α}, r b✝ c → TransGen r a c
c : α
hbc : r c✝ c
⊢ TransGen r a c

Next tactic:
case refl => exact single hbc
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d c : α
hbc : r a c
⊢ TransGen r a c

Next tactic:
case refl => exact single hbc
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  case refl => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d c : α
hbc : r a c
⊢ TransGen r a c

Next tactic:
exact single hbc
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  case refl => exact single hbc
  

Proof state:
case tail
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d b✝ c✝ : α
a✝¹ : ReflTransGen r a b✝
a✝ : r b✝ c✝
a_ih✝ : ∀ {c : α}, r b✝ c → TransGen r a c
c : α
hbc : r c✝ c
⊢ TransGen r a c

Next tactic:
case tail _ _ _ hdb IH => exact tail (IH hdb) hbc
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  case refl => exact single hbc
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d b✝ c✝ : α
a✝ : ReflTransGen r a b✝
hdb : r b✝ c✝
IH : ∀ {c : α}, r b✝ c → TransGen r a c
c : α
hbc : r c✝ c
⊢ TransGen r a c

Next tactic:
case tail _ _ _ hdb IH => exact tail (IH hdb) hbc
theorem tail' (hab : ReflTransGen r a b) (hbc : r b c) : TransGen r a c := by
  induction hab generalizing c
  case refl => exact single hbc
  case tail _ _ _ hdb IH => 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a b d b✝ c✝ : α
a✝ : ReflTransGen r a b✝
hdb : r b✝ c✝
IH : ∀ {c : α}, r b✝ c → TransGen r a c
c : α
hbc : r c✝ c
⊢ TransGen r a c

Next tactic:
exact tail (IH hdb) hbc
@[elab_as_elim]
theorem head_induction_on {P : ∀ a : α, TransGen r a b → Prop} {a : α} (h : TransGen r a b)
    (base : ∀ {a} (h : r a b), P a (single h))
    (ih : ∀ {a c} (h' : r a c) (h : TransGen r c b), P c h → P a (h.head h')) : P a h := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
δ : Type u_4
ε : Type u_5
ζ : Type u_6
r : α → α → Prop
a✝ b c d : α
P : (a : α) → TransGen r a b → Prop
a : α
h : TransGen r a b
base : ∀ {a : α} (h : r a b), P a (_ : TransGen r a b)
ih : ∀ {a c : α} (h' : r a c) (h : TransGen r c b), P c h → P a (_ : TransGen r a b)
⊢ P a h

Next tactic:
induction h