l3lab/ntp-mathlib huggingface dataset:
theorem iso_eq_iso_refl {x : SimplexCategory} (e : x ≅ x) : e = Iso.refl x := by
  have h : (Finset.univ : Finset (Fin (x.len + 1))).card = x.len + 1 := Finset.card_fin (x.len + 1)
  have eq₁ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
  have eq₂ :=
    Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
  -- Porting note: the proof was rewritten from this point in #3414 (reenableeta)
  -- It could be investigated again to see if the original can be restored.
  ext x
  

Proof state:
case w.a.h.h.h
x✝ : SimplexCategory
e : x✝ ≅ x✝
h : Finset.card Finset.univ = len x✝ + 1
eq₁ : RelIso.toRelEmbedding (orderIsoOfIso e) = Finset.orderEmbOfFin Finset.univ h
eq₂ : RelIso.toRelEmbedding (orderIsoOfIso (Iso.refl x✝)) = Finset.orderEmbOfFin Finset.univ h
x : Fin (len x✝ + 1)
⊢ ↑((Hom.toOrderHom e.hom) x) = ↑((Hom.toOrderHom (Iso.refl x✝).hom) x)

Next tactic:
replace eq₁ := congr_arg (· x) eq₁
theorem iso_eq_iso_refl {x : SimplexCategory} (e : x ≅ x) : e = Iso.refl x := by
  have h : (Finset.univ : Finset (Fin (x.len + 1))).card = x.len + 1 := Finset.card_fin (x.len + 1)
  have eq₁ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
  have eq₂ :=
    Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
  -- Porting note: the proof was rewritten from this point in #3414 (reenableeta)
  -- It could be investigated again to see if the original can be restored.
  ext x
  replace eq₁ := congr_arg (· x) eq₁
  

Proof state:
case w.a.h.h.h
x✝ : SimplexCategory
e : x✝ ≅ x✝
h : Finset.card Finset.univ = len x✝ + 1
eq₂ : RelIso.toRelEmbedding (orderIsoOfIso (Iso.refl x✝)) = Finset.orderEmbOfFin Finset.univ h
x : Fin (len x✝ + 1)
eq₁ :
  (fun x_1 => x_1 x) (RelIso.toRelEmbedding (orderIsoOfIso e)) = (fun x_1 => x_1 x) (Finset.orderEmbOfFin Finset.univ h)
⊢ ↑((Hom.toOrderHom e.hom) x) = ↑((Hom.toOrderHom (Iso.refl x✝).hom) x)

Next tactic:
replace eq₂ := congr_arg (· x) eq₂.symm
theorem iso_eq_iso_refl {x : SimplexCategory} (e : x ≅ x) : e = Iso.refl x := by
  have h : (Finset.univ : Finset (Fin (x.len + 1))).card = x.len + 1 := Finset.card_fin (x.len + 1)
  have eq₁ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
  have eq₂ :=
    Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
  -- Porting note: the proof was rewritten from this point in #3414 (reenableeta)
  -- It could be investigated again to see if the original can be restored.
  ext x
  replace eq₁ := congr_arg (· x) eq₁
  replace eq₂ := congr_arg (· x) eq₂.symm
  

Proof state:
case w.a.h.h.h
x✝ : SimplexCategory
e : x✝ ≅ x✝
h : Finset.card Finset.univ = len x✝ + 1
x : Fin (len x✝ + 1)
eq₁ :
  (fun x_1 => x_1 x) (RelIso.toRelEmbedding (orderIsoOfIso e)) = (fun x_1 => x_1 x) (Finset.orderEmbOfFin Finset.univ h)
eq₂ :
  (fun x_1 => x_1 x) (Finset.orderEmbOfFin Finset.univ h) =
    (fun x_1 => x_1 x) (RelIso.toRelEmbedding (orderIsoOfIso (Iso.refl x✝)))
⊢ ↑((Hom.toOrderHom e.hom) x) = ↑((Hom.toOrderHom (Iso.refl x✝).hom) x)

Next tactic:
simp_all
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  

Proof state:
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
⊢ ∃ θ', θ = σ i ≫ θ'

Next tactic:
use δ i.succ ≫ θ
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  

Proof state:
case h
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
⊢ θ = σ i ≫ δ (Fin.succ i) ≫ θ

Next tactic:
ext1
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; 

Proof state:
case h.a
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
⊢ Hom.toOrderHom θ = Hom.toOrderHom (σ i ≫ δ (Fin.succ i) ≫ θ)

Next tactic:
ext1
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; 

Proof state:
case h.a.h
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
⊢ ⇑(Hom.toOrderHom θ) = ⇑(Hom.toOrderHom (σ i ≫ δ (Fin.succ i) ≫ θ))

Next tactic:
ext1 x
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  

Proof state:
case h.a.h.h
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom (σ i ≫ δ (Fin.succ i) ≫ θ)) x

Next tactic:
simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  

Proof state:
case h.a.h.h
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
by_cases h' : x ≤ Fin.castSucc i
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
dsimp
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) (Fin.predAbove i x))

Next tactic:
rw [Fin.predAbove_below i x h']
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) (Fin.castPred x))

Next tactic:
have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) (Fin.castPred x))

Next tactic:
dsimp [δ]
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) (Fin.succAbove (Fin.succ i) (Fin.castPred x))

Next tactic:
erw [Fin.succAbove_below i.succ x.castPred _]
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) (Fin.castSucc (Fin.castPred x))
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ Fin.castSucc (Fin.castPred x) < Fin.succ i

Next tactic:
swap
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · 

Proof state:
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ Fin.castSucc (Fin.castPred x) < Fin.succ i

Next tactic:
rwa [eq, ← Fin.le_castSucc_iff]
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    

Proof state:
case pos
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : x ≤ Fin.castSucc i
eq : Fin.castSucc (Fin.castPred x) = x
⊢ (Hom.toOrderHom θ) x = (Hom.toOrderHom θ) (Fin.castSucc (Fin.castPred x))

Next tactic:
rw [eq]
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · 

Proof state:
case neg
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : ¬x ≤ Fin.castSucc i
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
simp only [not_le] at h'
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    

Proof state:
case neg
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : Fin.castSucc i < x
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
let y := x.pred <| by rintro (rfl : x = 0); simp at h'
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    let y := x.pred <| by 

Proof state:
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : Fin.castSucc i < x
⊢ x ≠ 0

Next tactic:
rintro (rfl : x = 0)
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    let y := x.pred <| by rintro (rfl : x = 0); 

Proof state:
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
h' : Fin.castSucc i < 0
⊢ False

Next tactic:
simp at h'
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    let y := x.pred <| by rintro (rfl : x = 0); simp at h'
    

Proof state:
case neg
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : Fin.castSucc i < x
y : Fin (len [n + 1]) := Fin.pred x (_ : x = 0 → False)
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
have hy : x = y.succ := (Fin.succ_pred x _).symm
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    let y := x.pred <| by rintro (rfl : x = 0); simp at h'
    have hy : x = y.succ := (Fin.succ_pred x _).symm
    

Proof state:
case neg
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h' : Fin.castSucc i < x
y : Fin (len [n + 1]) := Fin.pred x (_ : x = 0 → False)
hy : x = Fin.succ y
⊢ (Hom.toOrderHom θ) x =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } x))

Next tactic:
rw [hy] at h' ⊢
theorem eq_σ_comp_of_not_injective' {n : ℕ} {Δ' : SimplexCategory} (θ : mk (n + 1) ⟶ Δ')
    (i : Fin (n + 1)) (hi : θ.toOrderHom (Fin.castSucc i) = θ.toOrderHom i.succ) :
    ∃ θ' : mk n ⟶ Δ', θ = σ i ≫ θ' := by
  use δ i.succ ≫ θ
  ext1; ext1; ext1 x
  simp only [Hom.toOrderHom_mk, Function.comp_apply, OrderHom.comp_coe, Hom.comp,
    smallCategory_comp, σ, mkHom, OrderHom.coe_mk]
  by_cases h' : x ≤ Fin.castSucc i
  · -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i x h']
    have eq := Fin.castSucc_castPred (gt_of_gt_of_ge (Fin.castSucc_lt_last i) h')
    dsimp [δ]
    erw [Fin.succAbove_below i.succ x.castPred _]
    swap
    · rwa [eq, ← Fin.le_castSucc_iff]
    rw [eq]
  · simp only [not_le] at h'
    let y := x.pred <| by rintro (rfl : x = 0); simp at h'
    have hy : x = y.succ := (Fin.succ_pred x _).symm
    rw [hy] at h' ⊢
    -- This was not needed before leanprover/lean4#2644
    

Proof state:
case neg
n : ℕ
Δ' : SimplexCategory
θ : [n + 1] ⟶ Δ'
i : Fin (n + 1)
hi : (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) (Fin.succ i)
x : Fin (len [n + 1] + 1)
h'✝ : Fin.castSucc i < x
y : Fin (len [n + 1]) := Fin.pred x (_ : x = 0 → False)
h' : Fin.castSucc i < Fin.succ y
hy : x = Fin.succ y
⊢ (Hom.toOrderHom θ) (Fin.succ y) =
    (Hom.toOrderHom θ)
      ((Hom.toOrderHom (δ (Fin.succ i)))
        ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } (Fin.succ y)))

Next tactic:
conv_rhs => dsimp