l3lab/ntp-mathlib huggingface dataset:
theorem Prefunctor.pathStar_injective (hφ : ∀ u, Injective (φ.star u)) (u : U) :
    Injective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v₁, p₁⟩
  induction' p₁ with x₁ y₁ p₁ e₁ ih <;>
    rintro ⟨y₂, p₂⟩ <;>
    cases' p₂ with x₂ _ p₂ e₂ <;>
    intro h <;>
    -- Porting note: added `Sigma.mk.inj_iff`
    simp only [Prefunctor.pathStar_apply, Prefunctor.mapPath_nil, Prefunctor.mapPath_cons,
      Sigma.mk.inj_iff] at h
  · -- Porting note: goal not present in lean3.
    rfl
  · exfalso
    cases' h with h h'
    rw [← Path.eq_cast_iff_heq rfl h.symm, Path.cast_cons] at h'
    exact (Path.nil_ne_cons _ _) h'
  · exfalso
    cases' h with h h'
    rw [← Path.cast_eq_iff_heq rfl h, Path.cast_cons] at h'
    exact (Path.cons_ne_nil _ _) h'
  · cases' h with hφy h'
    rw [← Path.cast_eq_iff_heq rfl hφy, Path.cast_cons, Path.cast_rfl_rfl] at h'
    have hφx := Path.obj_eq_of_cons_eq_cons h'
    have hφp := Path.heq_of_cons_eq_cons h'
    have hφe := HEq.trans (Hom.cast_heq rfl hφy _).symm (Path.hom_heq_of_cons_eq_cons h')
    have h_path_star : φ.pathStar u ⟨x₁, p₁⟩ = φ.pathStar u ⟨x₂, p₂⟩ := by
      simp only [Prefunctor.pathStar_apply, Sigma.mk.inj_iff]; exact ⟨hφx, hφp⟩
    cases ih h_path_star
    have h_star : φ.star x₁ ⟨y₁, e₁⟩ = φ.star x₁ ⟨y₂, e₂⟩ := by
      simp only [Prefunctor.star_apply, Sigma.mk.inj_iff]; exact ⟨hφy, hφe⟩
    

Proof state:
case mk.cons.mk.cons.intro.refl
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.13176
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Injective (star φ u)
u v₁ x₁ y₁ : U
p₁ : Path u x₁
e₁ : x₁ ⟶ y₁
ih :
  ∀ ⦃a₂ : PathStar u⦄,
    (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) { fst := x₁, snd := p₁ } =
        (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a₂ →
      { fst := x₁, snd := p₁ } = a₂
y₂ : U
hφy : φ.obj y₁ = φ.obj y₂
e₂ : x₁ ⟶ y₂
hφx : φ.obj x₁ = φ.obj x₁
hφe : HEq (φ.map e₁) (φ.map e₂)
h' : Path.cons (mapPath φ p₁) (Hom.cast (_ : φ.obj x₁ = φ.obj x₁) hφy (φ.map e₁)) = Path.cons (mapPath φ p₁) (φ.map e₂)
hφp : HEq (mapPath φ p₁) (mapPath φ p₁)
h_path_star : pathStar φ u { fst := x₁, snd := p₁ } = pathStar φ u { fst := x₁, snd := p₁ }
h_star : star φ x₁ { fst := y₁, snd := e₁ } = star φ x₁ { fst := y₂, snd := e₂ }
⊢ { fst := y₁, snd := Path.cons p₁ e₁ } = { fst := y₂, snd := Path.cons p₁ e₂ }

Next tactic:
cases hφ x₁ h_star
theorem Prefunctor.pathStar_injective (hφ : ∀ u, Injective (φ.star u)) (u : U) :
    Injective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v₁, p₁⟩
  induction' p₁ with x₁ y₁ p₁ e₁ ih <;>
    rintro ⟨y₂, p₂⟩ <;>
    cases' p₂ with x₂ _ p₂ e₂ <;>
    intro h <;>
    -- Porting note: added `Sigma.mk.inj_iff`
    simp only [Prefunctor.pathStar_apply, Prefunctor.mapPath_nil, Prefunctor.mapPath_cons,
      Sigma.mk.inj_iff] at h
  · -- Porting note: goal not present in lean3.
    rfl
  · exfalso
    cases' h with h h'
    rw [← Path.eq_cast_iff_heq rfl h.symm, Path.cast_cons] at h'
    exact (Path.nil_ne_cons _ _) h'
  · exfalso
    cases' h with h h'
    rw [← Path.cast_eq_iff_heq rfl h, Path.cast_cons] at h'
    exact (Path.cons_ne_nil _ _) h'
  · cases' h with hφy h'
    rw [← Path.cast_eq_iff_heq rfl hφy, Path.cast_cons, Path.cast_rfl_rfl] at h'
    have hφx := Path.obj_eq_of_cons_eq_cons h'
    have hφp := Path.heq_of_cons_eq_cons h'
    have hφe := HEq.trans (Hom.cast_heq rfl hφy _).symm (Path.hom_heq_of_cons_eq_cons h')
    have h_path_star : φ.pathStar u ⟨x₁, p₁⟩ = φ.pathStar u ⟨x₂, p₂⟩ := by
      simp only [Prefunctor.pathStar_apply, Sigma.mk.inj_iff]; exact ⟨hφx, hφp⟩
    cases ih h_path_star
    have h_star : φ.star x₁ ⟨y₁, e₁⟩ = φ.star x₁ ⟨y₂, e₂⟩ := by
      simp only [Prefunctor.star_apply, Sigma.mk.inj_iff]; exact ⟨hφy, hφe⟩
    cases hφ x₁ h_star
    

Proof state:
case mk.cons.mk.cons.intro.refl.refl
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.13176
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Injective (star φ u)
u v₁ x₁ y₁ : U
p₁ : Path u x₁
e₁ : x₁ ⟶ y₁
ih :
  ∀ ⦃a₂ : PathStar u⦄,
    (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) { fst := x₁, snd := p₁ } =
        (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a₂ →
      { fst := x₁, snd := p₁ } = a₂
hφx : φ.obj x₁ = φ.obj x₁
hφp : HEq (mapPath φ p₁) (mapPath φ p₁)
h_path_star : pathStar φ u { fst := x₁, snd := p₁ } = pathStar φ u { fst := x₁, snd := p₁ }
hφy : φ.obj y₁ = φ.obj y₁
hφe : HEq (φ.map e₁) (φ.map e₁)
h' : Path.cons (mapPath φ p₁) (Hom.cast (_ : φ.obj x₁ = φ.obj x₁) hφy (φ.map e₁)) = Path.cons (mapPath φ p₁) (φ.map e₁)
h_star : star φ x₁ { fst := y₁, snd := e₁ } = star φ x₁ { fst := y₁, snd := e₁ }
⊢ { fst := y₁, snd := Path.cons p₁ e₁ } = { fst := y₁, snd := Path.cons p₁ e₁ }

Next tactic:
rfl
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  

Proof state:
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
⊢ Surjective (pathStar φ u)

Next tactic:
dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  

Proof state:
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
⊢ Surjective fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }

Next tactic:
rintro ⟨v, p⟩
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  

Proof state:
case mk
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
p : Path (φ.obj u) v
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v, snd := p }

Next tactic:
induction' p with v' v'' p' ev ih
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · 

Proof state:
case mk.nil
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := φ.obj u, snd := Path.nil }

Next tactic:
use ⟨u, Path.nil⟩
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    

Proof state:
case h
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
⊢ (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) { fst := u, snd := Path.nil } =
    { fst := φ.obj u, snd := Path.nil }

Next tactic:
simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · 

Proof state:
case mk.cons
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v' v'' : V
p' : Path (φ.obj u) v'
ev : v' ⟶ v''
ih : ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v', snd := p' }
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons p' ev }

Next tactic:
obtain ⟨⟨u', q'⟩, h⟩ := ih
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    

Proof state:
case mk.cons.intro.mk
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v' v'' : V
p' : Path (φ.obj u) v'
ev : v' ⟶ v''
u' : U
q' : Path u u'
h : (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) { fst := u', snd := q' } = { fst := v', snd := p' }
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons p' ev }

Next tactic:
simp only at h
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    

Proof state:
case mk.cons.intro.mk
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v' v'' : V
p' : Path (φ.obj u) v'
ev : v' ⟶ v''
u' : U
q' : Path u u'
h : { fst := φ.obj u', snd := mapPath φ q' } = { fst := v', snd := p' }
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons p' ev }

Next tactic:
obtain ⟨rfl, rfl⟩ := h
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    

Proof state:
case mk.cons.intro.mk.refl
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v'' : V
u' : U
q' : Path u u'
ev : φ.obj u' ⟶ v''
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons (mapPath φ q') ev }

Next tactic:
obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    

Proof state:
case mk.cons.intro.mk.refl.intro.mk
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v'' : V
u' : U
q' : Path u u'
ev : φ.obj u' ⟶ v''
u'' : U
eu : u' ⟶ u''
k : star φ u' { fst := u'', snd := eu } = { fst := v'', snd := ev }
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons (mapPath φ q') ev }

Next tactic:
simp only [star_apply, Sigma.mk.inj_iff] at k
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    simp only [star_apply, Sigma.mk.inj_iff] at k
    -- Porting note: was `obtain ⟨rfl, rfl⟩ := k`
    

Proof state:
case mk.cons.intro.mk.refl.intro.mk
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v v'' : V
u' : U
q' : Path u u'
ev : φ.obj u' ⟶ v''
u'' : U
eu : u' ⟶ u''
k : φ.obj u'' = v'' ∧ HEq (φ.map eu) ev
⊢ ∃ a, (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a = { fst := v'', snd := Path.cons (mapPath φ q') ev }

Next tactic:
obtain ⟨rfl, k⟩ := k
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    simp only [star_apply, Sigma.mk.inj_iff] at k
    -- Porting note: was `obtain ⟨rfl, rfl⟩ := k`
    obtain ⟨rfl, k⟩ := k
    

Proof state:
case mk.cons.intro.mk.refl.intro.mk.intro
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
u' : U
q' : Path u u'
u'' : U
eu : u' ⟶ u''
ev : φ.obj u' ⟶ φ.obj u''
k : HEq (φ.map eu) ev
⊢ ∃ a,
    (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a =
      { fst := φ.obj u'', snd := Path.cons (mapPath φ q') ev }

Next tactic:
simp only [heq_eq_eq] at k
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    simp only [star_apply, Sigma.mk.inj_iff] at k
    -- Porting note: was `obtain ⟨rfl, rfl⟩ := k`
    obtain ⟨rfl, k⟩ := k
    simp only [heq_eq_eq] at k
    

Proof state:
case mk.cons.intro.mk.refl.intro.mk.intro
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
u' : U
q' : Path u u'
u'' : U
eu : u' ⟶ u''
ev : φ.obj u' ⟶ φ.obj u''
k : φ.map eu = ev
⊢ ∃ a,
    (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a =
      { fst := φ.obj u'', snd := Path.cons (mapPath φ q') ev }

Next tactic:
subst k
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    simp only [star_apply, Sigma.mk.inj_iff] at k
    -- Porting note: was `obtain ⟨rfl, rfl⟩ := k`
    obtain ⟨rfl, k⟩ := k
    simp only [heq_eq_eq] at k
    subst k
    

Proof state:
case mk.cons.intro.mk.refl.intro.mk.intro
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
u' : U
q' : Path u u'
u'' : U
eu : u' ⟶ u''
⊢ ∃ a,
    (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) a =
      { fst := φ.obj u'', snd := Path.cons (mapPath φ q') (φ.map eu) }

Next tactic:
use ⟨_, q'.cons eu⟩
theorem Prefunctor.pathStar_surjective (hφ : ∀ u, Surjective (φ.star u)) (u : U) :
    Surjective (φ.pathStar u) := by
  dsimp (config := { unfoldPartialApp := true }) [Prefunctor.pathStar, Quiver.PathStar.mk]
  rintro ⟨v, p⟩
  induction' p with v' v'' p' ev ih
  · use ⟨u, Path.nil⟩
    simp only [Prefunctor.mapPath_nil, eq_self_iff_true, heq_iff_eq, and_self_iff]
  · obtain ⟨⟨u', q'⟩, h⟩ := ih
    simp only at h
    obtain ⟨rfl, rfl⟩ := h
    obtain ⟨⟨u'', eu⟩, k⟩ := hφ u' ⟨_, ev⟩
    simp only [star_apply, Sigma.mk.inj_iff] at k
    -- Porting note: was `obtain ⟨rfl, rfl⟩ := k`
    obtain ⟨rfl, k⟩ := k
    simp only [heq_eq_eq] at k
    subst k
    use ⟨_, q'.cons eu⟩
    

Proof state:
case h
U : Type u_1
inst✝² : Quiver U
V : Type u_2
inst✝¹ : Quiver V
φ : U ⥤q V
W : Type ?u.16304
inst✝ : Quiver W
ψ : V ⥤q W
hφ : ∀ (u : U), Surjective (star φ u)
u : U
v : V
u' : U
q' : Path u u'
u'' : U
eu : u' ⟶ u''
⊢ (fun p => { fst := φ.obj p.fst, snd := mapPath φ p.snd }) { fst := u'', snd := Path.cons q' eu } =
    { fst := φ.obj u'', snd := Path.cons (mapPath φ q') (φ.map eu) }

Next tactic:
simp only [Prefunctor.mapPath_cons, eq_self_iff_true, heq_iff_eq, and_self_iff]
/-- In a quiver with involutive inverses, the star and costar at every vertex are equivalent.
This map is induced by `Quiver.reverse`. -/
@[simps]
def Quiver.starEquivCostar (u : U) : Quiver.Star u ≃ Quiver.Costar u where
  toFun e := ⟨e.1, reverse e.2⟩
  invFun e := ⟨e.1, reverse e.2⟩
  left_inv e := by 

Proof state:
U : Type ?u.18316
inst✝⁵ : Quiver U
V : Type ?u.18322
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.18344
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : Prefunctor.MapReverse φ
u : U
e : Star u
⊢ (fun e => { fst := e.fst, snd := reverse e.snd }) ((fun e => { fst := e.fst, snd := reverse e.snd }) e) = e

Next tactic:
simp [Sigma.ext_iff]
/-- In a quiver with involutive inverses, the star and costar at every vertex are equivalent.
This map is induced by `Quiver.reverse`. -/
@[simps]
def Quiver.starEquivCostar (u : U) : Quiver.Star u ≃ Quiver.Costar u where
  toFun e := ⟨e.1, reverse e.2⟩
  invFun e := ⟨e.1, reverse e.2⟩
  left_inv e := by simp [Sigma.ext_iff]
  right_inv e := by 

Proof state:
U : Type ?u.18316
inst✝⁵ : Quiver U
V : Type ?u.18322
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.18344
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : Prefunctor.MapReverse φ
u : U
e : Costar u
⊢ (fun e => { fst := e.fst, snd := reverse e.snd }) ((fun e => { fst := e.fst, snd := reverse e.snd }) e) = e

Next tactic:
simp [Sigma.ext_iff]
theorem Prefunctor.costar_conj_star (u : U) :
    φ.costar u = Quiver.starEquivCostar (φ.obj u) ∘ φ.star u ∘ (Quiver.starEquivCostar u).symm := by
  

Proof state:
U : Type u_1
inst✝⁵ : Quiver U
V : Type u_2
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.20054
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : MapReverse φ
u : U
⊢ costar φ u = ⇑(starEquivCostar (φ.obj u)) ∘ star φ u ∘ ⇑(starEquivCostar u).symm

Next tactic:
ext ⟨v, f⟩
theorem Prefunctor.costar_conj_star (u : U) :
    φ.costar u = Quiver.starEquivCostar (φ.obj u) ∘ φ.star u ∘ (Quiver.starEquivCostar u).symm := by
  ext ⟨v, f⟩ <;> 

Proof state:
case h.mk.a
U : Type u_1
inst✝⁵ : Quiver U
V : Type u_2
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.20054
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : MapReverse φ
u v : U
f : v ⟶ u
⊢ (costar φ u { fst := v, snd := f }).fst =
    ((⇑(starEquivCostar (φ.obj u)) ∘ star φ u ∘ ⇑(starEquivCostar u).symm) { fst := v, snd := f }).fst

Next tactic:
simp
theorem Prefunctor.costar_conj_star (u : U) :
    φ.costar u = Quiver.starEquivCostar (φ.obj u) ∘ φ.star u ∘ (Quiver.starEquivCostar u).symm := by
  ext ⟨v, f⟩ <;> 

Proof state:
case h.mk.a
U : Type u_1
inst✝⁵ : Quiver U
V : Type u_2
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.20054
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : MapReverse φ
u v : U
f : v ⟶ u
⊢ HEq (costar φ u { fst := v, snd := f }).snd
    ((⇑(starEquivCostar (φ.obj u)) ∘ star φ u ∘ ⇑(starEquivCostar u).symm) { fst := v, snd := f }).snd

Next tactic:
simp
theorem Prefunctor.bijective_costar_iff_bijective_star (u : U) :
    Bijective (φ.costar u) ↔ Bijective (φ.star u) := by
  

Proof state:
U : Type u_1
inst✝⁵ : Quiver U
V : Type u_2
inst✝⁴ : Quiver V
φ : U ⥤q V
W : Type ?u.21560
inst✝³ : Quiver W
ψ : V ⥤q W
inst✝² : HasInvolutiveReverse U
inst✝¹ : HasInvolutiveReverse V
inst✝ : MapReverse φ
u : U
⊢ Bijective (costar φ u) ↔ Bijective (star φ u)

Next tactic:
rw [Prefunctor.costar_conj_star, EquivLike.comp_bijective, EquivLike.bijective_comp]
theorem quotientRel_r_def {x y : M} : @Setoid.r _ p.quotientRel x y ↔ x - y ∈ p :=
  Iff.trans
    (by
      

Proof state:
R : Type u_1
M : Type u_2
r : R
x✝ y✝ : M
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : Submodule R M
x y : M
⊢ Setoid.r x y ↔ -(x - y) ∈ p

Next tactic:
rw [leftRel_apply, sub_eq_add_neg, neg_add, neg_neg]
theorem quotientRel_r_def {x y : M} : @Setoid.r _ p.quotientRel x y ↔ x - y ∈ p :=
  Iff.trans
    (by
      rw [leftRel_apply, sub_eq_add_neg, neg_add, neg_neg]
      

Proof state:
R : Type u_1
M : Type u_2
r : R
x✝ y✝ : M
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : Submodule R M
x y : M
⊢ -x + y ∈ toAddSubgroup p ↔ -x + y ∈ p

Next tactic:
rfl
@[simp]
theorem mk_eq_zero : (mk x : M ⧸ p) = 0 ↔ x ∈ p := by 

Proof state:
R : Type u_1
M : Type u_2
r : R
x y : M
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : Submodule R M
⊢ mk x = 0 ↔ x ∈ p

Next tactic:
simpa using (Quotient.eq' p : mk x = 0 ↔ _)
instance instSMul' : SMul S (M ⧸ P) :=
  ⟨fun a =>
    Quotient.map' (a • ·) fun x y h =>
      leftRel_apply.mpr <| by 

Proof state:
R : Type u_1
M : Type u_2
r : R
x✝ y✝ : M
inst✝⁵ : Ring R
inst✝⁴ : AddCommGroup M
inst✝³ : Module R M
p p' : Submodule R M
S : Type u_3
inst✝² : SMul S R
inst✝¹ : SMul S M
inst✝ : IsScalarTower S R M
P : Submodule R M
a : S
x y : M
h : Setoid.r x y
⊢ -(fun x => a • x) x + (fun x => a • x) y ∈ toAddSubgroup P

Next tactic:
simpa using Submodule.smul_mem P (a • (1 : R)) (leftRel_apply.mp h)
instance module' [Semiring S] [SMul S R] [Module S M] [IsScalarTower S R M] (P : Submodule R M) :
    Module S (M ⧸ P) :=
  { Function.Surjective.module _ {toFun := mk, map_zero' := by 

Proof state:
R : Type u_1
M : Type u_2
r : R
x y : M
inst✝⁶ : Ring R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
p p' : Submodule R M
S : Type u_3
inst✝³ : Semiring S
inst✝² : SMul S R
inst✝¹ : Module S M
inst✝ : IsScalarTower S R M
P : Submodule R M
⊢ mk 0 = 0

Next tactic:
rfl
instance module' [Semiring S] [SMul S R] [Module S M] [IsScalarTower S R M] (P : Submodule R M) :
    Module S (M ⧸ P) :=
  { Function.Surjective.module _ {toFun := mk, map_zero' := by rfl, map_add' := fun _ _ => by 

Proof state:
R : Type u_1
M : Type u_2
r : R
x y : M
inst✝⁶ : Ring R
inst✝⁵ : AddCommGroup M
inst✝⁴ : Module R M
p p' : Submodule R M
S : Type u_3
inst✝³ : Semiring S
inst✝² : SMul S R
inst✝¹ : Module S M
inst✝ : IsScalarTower S R M
P : Submodule R M
x✝¹ x✝ : M
⊢ ZeroHom.toFun { toFun := mk, map_zero' := (_ : mk 0 = mk 0) } (x✝¹ + x✝) =
    ZeroHom.toFun { toFun := mk, map_zero' := (_ : mk 0 = mk 0) } x✝¹ +
      ZeroHom.toFun { toFun := mk, map_zero' := (_ : mk 0 = mk 0) } x✝

Next tactic:
rfl
theorem mk_surjective : Function.Surjective (@mk _ _ _ _ _ p) := by
  

Proof state:
R : Type u_1
M : Type u_2
r : R
x y : M
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
p p' : Submodule R M
⊢ Function.Surjective mk

Next tactic:
rintro ⟨x⟩