l3lab/ntp-mathlib huggingface dataset:
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
    conv_rhs => 

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
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 θ)
    ((Hom.toOrderHom (δ (Fin.succ i)))
      ({ toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } (Fin.succ y)))

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 [δ]
    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
    conv_rhs => dsimp
    

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))) (Fin.predAbove i (Fin.succ (Fin.pred x (_ : x = 0 → False)))))

Next tactic:
rw [Fin.predAbove_above i y.succ h', Fin.pred_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 ≫ θ
  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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    

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))) y)

Next tactic:
by_cases h'' : y = 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
    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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · 

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'✝ : 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
h'' : y = i
⊢ (Hom.toOrderHom θ) (Fin.succ y) = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) y)

Next tactic:
rw [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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [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'✝ : 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
h'' : y = i
⊢ (Hom.toOrderHom θ) (Fin.succ i) = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) i)

Next tactic:
refine hi.symm.trans ?_
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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      

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'✝ : 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
h'' : y = i
⊢ (Hom.toOrderHom θ) (Fin.castSucc i) = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) i)

Next tactic:
congr 1
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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      

Proof state:
case pos.h.e_6.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)
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
h'' : y = i
⊢ Fin.castSucc i = (Hom.toOrderHom (δ (Fin.succ i))) i

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 [δ]
    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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      

Proof state:
case pos.h.e_6.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)
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
h'' : y = i
⊢ Fin.castSucc i = Fin.succAbove (Fin.succ i) i

Next tactic:
erw [Fin.succAbove_below 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 ≫ θ
  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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      

Proof state:
case pos.h.e_6.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)
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
h'' : y = i
⊢ Fin.castSucc i < Fin.succ i

Next tactic:
exact Fin.lt_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 ≫ θ
  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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      exact Fin.lt_succ
    · 

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
h'' : ¬y = i
⊢ (Hom.toOrderHom θ) (Fin.succ y) = (Hom.toOrderHom θ) ((Hom.toOrderHom (δ (Fin.succ i))) y)

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 [δ]
    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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      exact Fin.lt_succ
    · dsimp [δ]
      

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
h'' : ¬y = i
⊢ (Hom.toOrderHom θ) (Fin.succ (Fin.pred x (_ : x = 0 → False))) =
    (Hom.toOrderHom θ) (Fin.succAbove (Fin.succ i) (Fin.pred x (_ : x = 0 → False)))

Next tactic:
erw [Fin.succAbove_above 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 ≫ θ
  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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      exact Fin.lt_succ
    · dsimp [δ]
      erw [Fin.succAbove_above i.succ _]
      

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
h'' : ¬y = i
⊢ Fin.succ i ≤ Fin.castSucc (Fin.pred x (_ : x = 0 → False))

Next tactic:
simp only [Fin.lt_iff_val_lt_val, Fin.le_iff_val_le_val, Fin.val_succ, Fin.coe_castSucc,
        Nat.lt_succ_iff, Fin.ext_iff] at h' 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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      exact Fin.lt_succ
    · dsimp [δ]
      erw [Fin.succAbove_above i.succ _]
      simp only [Fin.lt_iff_val_lt_val, Fin.le_iff_val_le_val, Fin.val_succ, Fin.coe_castSucc,
        Nat.lt_succ_iff, Fin.ext_iff] at h' 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)
hy : x = Fin.succ y
h' : ↑i ≤ ↑(Fin.pred x (_ : x = 0 → False))
h'' : ¬↑(Fin.pred x (_ : x = 0 → False)) = ↑i
⊢ ↑i + 1 ≤ ↑(Fin.pred x (_ : x = 0 → False))

Next tactic:
cases' Nat.le.dest h' with c hc
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
    conv_rhs => dsimp
    rw [Fin.predAbove_above i y.succ h', Fin.pred_succ]
    by_cases h'' : y = i
    · rw [h'']
      refine hi.symm.trans ?_
      congr 1
      dsimp [δ]
      erw [Fin.succAbove_below i.succ]
      exact Fin.lt_succ
    · dsimp [δ]
      erw [Fin.succAbove_above i.succ _]
      simp only [Fin.lt_iff_val_lt_val, Fin.le_iff_val_le_val, Fin.val_succ, Fin.coe_castSucc,
        Nat.lt_succ_iff, Fin.ext_iff] at h' h'' ⊢
      cases' Nat.le.dest h' with c hc
      

Proof state:
case neg.intro
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
h' : ↑i ≤ ↑(Fin.pred x (_ : x = 0 → False))
h'' : ¬↑(Fin.pred x (_ : x = 0 → False)) = ↑i
c : ℕ
hc : ↑i + c = ↑(Fin.pred x (_ : x = 0 → False))
⊢ ↑i + 1 ≤ ↑(Fin.pred x (_ : x = 0 → False))

Next tactic:
cases c