l3lab/ntp-mathlib huggingface dataset:
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals 

Proof state:
case neg
n k : ℕ
hk : k < n + 1 + 1 + 1
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
h✝² : i < k
h✝¹ : j < k - 1
h✝ : ¬j + 1 < k
⊢ k - 1 - 1 = k - 1

Next tactic:
cases k
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> 

Proof state:
case neg.zero
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
hk : Nat.zero < n + 1 + 1 + 1
h✝² : i < Nat.zero
h✝¹ : j < Nat.zero - 1
h✝ : ¬j + 1 < Nat.zero
⊢ Nat.zero - 1 - 1 = Nat.zero - 1

Next tactic:
simp at *
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> 

Proof state:
case neg.succ
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
n✝ : ℕ
hk : Nat.succ n✝ < n + 1 + 1 + 1
h✝² : i < Nat.succ n✝
h✝¹ : j < Nat.succ n✝ - 1
h✝ : ¬j + 1 < Nat.succ n✝
⊢ Nat.succ n✝ - 1 - 1 = Nat.succ n✝ - 1

Next tactic:
simp at *
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> simp at *; 

Proof state:
case neg.succ
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
n✝ : ℕ
hk : Nat.succ n✝ < n + 1 + 1 + 1
h✝² : i < Nat.succ n✝
h✝¹ : j < n✝
h✝ : Nat.succ n✝ ≤ j + 1
⊢ n✝ - 1 = n✝

Next tactic:
linarith
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals 

Proof state:
case pos
n k : ℕ
hk : k < n + 1 + 1 + 1
i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
h✝³ : i < k
h✝² : ¬j < k - 1
h✝¹ : j + 1 < k
h✝ : i < k - 1
⊢ k - 1 = k - 1 - 1

Next tactic:
cases k
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> 

Proof state:
case pos.zero
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
hk : Nat.zero < n + 1 + 1 + 1
h✝³ : i < Nat.zero
h✝² : ¬j < Nat.zero - 1
h✝¹ : j + 1 < Nat.zero
h✝ : i < Nat.zero - 1
⊢ Nat.zero - 1 = Nat.zero - 1 - 1

Next tactic:
simp at *
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> 

Proof state:
case pos.succ
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
n✝ : ℕ
hk : Nat.succ n✝ < n + 1 + 1 + 1
h✝³ : i < Nat.succ n✝
h✝² : ¬j < Nat.succ n✝ - 1
h✝¹ : j + 1 < Nat.succ n✝
h✝ : i < Nat.succ n✝ - 1
⊢ Nat.succ n✝ - 1 = Nat.succ n✝ - 1 - 1

Next tactic:
simp at *
/-- The fifth simplicial identity -/
@[reassoc]
theorem σ_comp_σ {n} {i j : Fin (n + 1)} (H : i ≤ j) :
    σ (Fin.castSucc i) ≫ σ j = σ j.succ ≫ σ i := by
  ext ⟨k, hk⟩
  rcases i with ⟨i, hi⟩
  rcases j with ⟨j, hj⟩
  simp? at H hk says simp only [Fin.mk_le_mk, len_mk] at H hk
  dsimp [σ, Fin.predAbove]
  simp only [Fin.lt_iff_val_lt_val, Fin.ite_val, Fin.coe_pred, ge_iff_le, dite_eq_ite,
    Fin.coe_castLT]
  split_ifs
  all_goals try linarith
  all_goals cases k <;> simp at *; 

Proof state:
case pos.succ
n i : ℕ
hi : i < n + 1
j : ℕ
hj : j < n + 1
H : i ≤ j
n✝ : ℕ
hk : Nat.succ n✝ < n + 1 + 1 + 1
h✝³ : i < Nat.succ n✝
h✝² : j + 1 < Nat.succ n✝
h✝¹ : n✝ ≤ j
h✝ : i < n✝
⊢ n✝ = n✝ - 1

Next tactic:
linarith
theorem skeletal : Skeletal SimplexCategory := fun X Y ⟨I⟩ => by
  

Proof state:
X Y : SimplexCategory
x✝ : IsIsomorphic X Y
I : X ≅ Y
⊢ X = Y

Next tactic:
suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
    ext
    simpa
theorem skeletal : Skeletal SimplexCategory := fun X Y ⟨I⟩ => by
  suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
    

Proof state:
X Y : SimplexCategory
x✝ : IsIsomorphic X Y
I : X ≅ Y
this : Fintype.card (Fin (len X + 1)) = Fintype.card (Fin (len Y + 1))
⊢ X = Y

Next tactic:
ext
theorem skeletal : Skeletal SimplexCategory := fun X Y ⟨I⟩ => by
  suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
    ext
    

Proof state:
case a
X Y : SimplexCategory
x✝ : IsIsomorphic X Y
I : X ≅ Y
this : Fintype.card (Fin (len X + 1)) = Fintype.card (Fin (len Y + 1))
⊢ len X = len Y

Next tactic:
simpa
theorem skeletal : Skeletal SimplexCategory := fun X Y ⟨I⟩ => by
  suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
    ext
    simpa
  

Proof state:
X Y : SimplexCategory
x✝ : IsIsomorphic X Y
I : X ≅ Y
⊢ Fintype.card (Fin (len X + 1)) = Fintype.card (Fin (len Y + 1))

Next tactic:
apply Fintype.card_congr
theorem skeletal : Skeletal SimplexCategory := fun X Y ⟨I⟩ => by
  suffices Fintype.card (Fin (X.len + 1)) = Fintype.card (Fin (Y.len + 1)) by
    ext
    simpa
  apply Fintype.card_congr
  

Proof state:
case f
X Y : SimplexCategory
x✝ : IsIsomorphic X Y
I : X ≅ Y
⊢ Fin (len X + 1) ≃ Fin (len Y + 1)

Next tactic:
exact ((skeletalFunctor ⋙ forget NonemptyFinLinOrd).mapIso I).toEquiv
instance : Faithful skeletalFunctor where
  map_injective {_ _ f g} h := by
    

Proof state:
x✝¹ x✝ : SimplexCategory
f g : x✝¹ ⟶ x✝
h : skeletalFunctor.map f = skeletalFunctor.map g
⊢ f = g

Next tactic:
ext1
instance : Faithful skeletalFunctor where
  map_injective {_ _ f g} h := by
    ext1
    

Proof state:
case a
x✝¹ x✝ : SimplexCategory
f g : x✝¹ ⟶ x✝
h : skeletalFunctor.map f = skeletalFunctor.map g
⊢ Hom.toOrderHom f = Hom.toOrderHom g

Next tactic:
exact h
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        

Proof state:
X : NonemptyFinLinOrd
⊢ skeletalFunctor.obj [Fintype.card ↑X - 1] ≅ X

Next tactic:
have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
⊢ skeletalFunctor.obj [Fintype.card ↑X - 1] ≅ X

Next tactic:
let f := monoEquivOfFin X aux
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
⊢ skeletalFunctor.obj [Fintype.card ↑X - 1] ≅ X

Next tactic:
have hf := (Finset.univ.orderEmbOfFin aux).strictMono
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
⊢ skeletalFunctor.obj [Fintype.card ↑X - 1] ≅ X

Next tactic:
refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by 

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
⊢ { toFun := ⇑f, monotone' := (_ : Monotone ⇑(Finset.orderEmbOfFin Finset.univ aux)) } ≫
      { toFun := ⇑(OrderIso.symm f), monotone' := ?m.667663 } =
    𝟙 (skeletalFunctor.obj [Fintype.card ↑X - 1])

Next tactic:
ext1
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; 

Proof state:
case w
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
x✝ : (forget NonemptyFinLinOrd).obj (skeletalFunctor.obj [Fintype.card ↑X - 1])
⊢ ({ toFun := ⇑f, monotone' := (_ : Monotone ⇑(Finset.orderEmbOfFin Finset.univ aux)) } ≫
        { toFun := ⇑(OrderIso.symm f), monotone' := ?m.667663 })
      x✝ =
    (𝟙 (skeletalFunctor.obj [Fintype.card ↑X - 1])) x✝

Next tactic:
apply f.symm_apply_apply
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by 

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
⊢ { toFun := ⇑(OrderIso.symm f), monotone' := ?m.667663 } ≫
      { toFun := ⇑f, monotone' := (_ : Monotone ⇑(Finset.orderEmbOfFin Finset.univ aux)) } =
    𝟙 X

Next tactic:
ext1
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; 

Proof state:
case w
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
x✝ : (forget NonemptyFinLinOrd).obj X
⊢ ({ toFun := ⇑(OrderIso.symm f), monotone' := ?m.667663 } ≫
        { toFun := ⇑f, monotone' := (_ : Monotone ⇑(Finset.orderEmbOfFin Finset.univ aux)) })
      x✝ =
    (𝟙 X) x✝

Next tactic:
apply f.apply_symm_apply
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
⊢ Monotone ⇑(OrderIso.symm f)

Next tactic:
intro i j h
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
        intro i j h
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
i j : ↑X
h : i ≤ j
⊢ (OrderIso.symm f) i ≤ (OrderIso.symm f) j

Next tactic:
show f.symm i ≤ f.symm j
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
        intro i j h
        show f.symm i ≤ f.symm j
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
i j : ↑X
h : i ≤ j
⊢ (OrderIso.symm f) i ≤ (OrderIso.symm f) j

Next tactic:
rw [← hf.le_iff_le]
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
        intro i j h
        show f.symm i ≤ f.symm j
        rw [← hf.le_iff_le]
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
i j : ↑X
h : i ≤ j
⊢ (Finset.orderEmbOfFin Finset.univ aux) ((OrderIso.symm f) i) ≤
    (Finset.orderEmbOfFin Finset.univ aux) ((OrderIso.symm f) j)

Next tactic:
show f (f.symm i) ≤ f (f.symm j)
instance : EssSurj skeletalFunctor where
  mem_essImage X :=
    ⟨mk (Fintype.card X - 1 : ℕ),
      ⟨by
        have aux : Fintype.card X = Fintype.card X - 1 + 1 :=
          (Nat.succ_pred_eq_of_pos <| Fintype.card_pos_iff.mpr ⟨⊥⟩).symm
        let f := monoEquivOfFin X aux
        have hf := (Finset.univ.orderEmbOfFin aux).strictMono
        refine'
          { hom := ⟨f, hf.monotone⟩
            inv := ⟨f.symm, _⟩
            hom_inv_id := by ext1; apply f.symm_apply_apply
            inv_hom_id := by ext1; apply f.apply_symm_apply }
        intro i j h
        show f.symm i ≤ f.symm j
        rw [← hf.le_iff_le]
        show f (f.symm i) ≤ f (f.symm j)
        

Proof state:
X : NonemptyFinLinOrd
aux : Fintype.card ↑X = Fintype.card ↑X - 1 + 1
f : Fin (Fintype.card ↑X - 1 + 1) ≃o ↑X := monoEquivOfFin (↑X) aux
hf : StrictMono ⇑(Finset.orderEmbOfFin Finset.univ aux)
i j : ↑X
h : i ≤ j
⊢ f ((OrderIso.symm f) i) ≤ f ((OrderIso.symm f) j)

Next tactic:
simpa only [OrderIso.apply_symm_apply]
instance {n} : Inhabited (Truncated n) :=
  ⟨⟨[0], by 

Proof state:
n : ℕ
⊢ len [0] ≤ n

Next tactic:
simp
instance : ConcreteCategory.{0} SimplexCategory where
  forget :=
    { obj := fun i => Fin (i.len + 1)
      map := fun f => f.toOrderHom }
  forget_faithful := ⟨fun h => by 

Proof state:
X✝ Y✝ : SimplexCategory
a₁✝ a₂✝ : X✝ ⟶ Y✝
h :
  (CategoryTheory.Functor.mk { obj := fun i => Fin (len i + 1), map := fun {X Y} f => ⇑(Hom.toOrderHom f) }).map a₁✝ =
    (CategoryTheory.Functor.mk { obj := fun i => Fin (len i + 1), map := fun {X Y} f => ⇑(Hom.toOrderHom f) }).map a₂✝
⊢ a₁✝ = a₂✝

Next tactic:
ext : 2
instance : ConcreteCategory.{0} SimplexCategory where
  forget :=
    { obj := fun i => Fin (i.len + 1)
      map := fun f => f.toOrderHom }
  forget_faithful := ⟨fun h => by ext : 2; 

Proof state:
case a.h
X✝ Y✝ : SimplexCategory
a₁✝ a₂✝ : X✝ ⟶ Y✝
h :
  (CategoryTheory.Functor.mk { obj := fun i => Fin (len i + 1), map := fun {X Y} f => ⇑(Hom.toOrderHom f) }).map a₁✝ =
    (CategoryTheory.Functor.mk { obj := fun i => Fin (len i + 1), map := fun {X Y} f => ⇑(Hom.toOrderHom f) }).map a₂✝
⊢ ⇑(Hom.toOrderHom a₁✝) = ⇑(Hom.toOrderHom a₂✝)

Next tactic:
exact h
/-- A morphism in `SimplexCategory` is a monomorphism precisely when it is an injective function
-/
theorem mono_iff_injective {n m : SimplexCategory} {f : n ⟶ m} :
    Mono f ↔ Function.Injective f.toOrderHom := by
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Mono f ↔ Function.Injective ⇑(Hom.toOrderHom f)

Next tactic:
rw [← Functor.mono_map_iff_mono skeletalEquivalence.functor]
/-- A morphism in `SimplexCategory` is a monomorphism precisely when it is an injective function
-/
theorem mono_iff_injective {n m : SimplexCategory} {f : n ⟶ m} :
    Mono f ↔ Function.Injective f.toOrderHom := by
  rw [← Functor.mono_map_iff_mono skeletalEquivalence.functor]
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Mono (skeletalEquivalence.functor.map f) ↔ Function.Injective ⇑(Hom.toOrderHom f)

Next tactic:
dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
/-- A morphism in `SimplexCategory` is a monomorphism precisely when it is an injective function
-/
theorem mono_iff_injective {n m : SimplexCategory} {f : n ⟶ m} :
    Mono f ↔ Function.Injective f.toOrderHom := by
  rw [← Functor.mono_map_iff_mono skeletalEquivalence.functor]
  dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Mono (skeletalFunctor.map f) ↔ Function.Injective ⇑(Hom.toOrderHom f)

Next tactic:
simp only [skeletalFunctor_obj, skeletalFunctor_map,
    NonemptyFinLinOrd.mono_iff_injective, NonemptyFinLinOrd.coe_of]
/-- A morphism in `SimplexCategory` is an epimorphism if and only if it is a surjective function
-/
theorem epi_iff_surjective {n m : SimplexCategory} {f : n ⟶ m} :
    Epi f ↔ Function.Surjective f.toOrderHom := by
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Epi f ↔ Function.Surjective ⇑(Hom.toOrderHom f)

Next tactic:
rw [← Functor.epi_map_iff_epi skeletalEquivalence.functor]
/-- A morphism in `SimplexCategory` is an epimorphism if and only if it is a surjective function
-/
theorem epi_iff_surjective {n m : SimplexCategory} {f : n ⟶ m} :
    Epi f ↔ Function.Surjective f.toOrderHom := by
  rw [← Functor.epi_map_iff_epi skeletalEquivalence.functor]
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Epi (skeletalEquivalence.functor.map f) ↔ Function.Surjective ⇑(Hom.toOrderHom f)

Next tactic:
dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
/-- A morphism in `SimplexCategory` is an epimorphism if and only if it is a surjective function
-/
theorem epi_iff_surjective {n m : SimplexCategory} {f : n ⟶ m} :
    Epi f ↔ Function.Surjective f.toOrderHom := by
  rw [← Functor.epi_map_iff_epi skeletalEquivalence.functor]
  dsimp only [skeletalEquivalence, Functor.asEquivalence_functor]
  

Proof state:
n m : SimplexCategory
f : n ⟶ m
⊢ Epi (skeletalFunctor.map f) ↔ Function.Surjective ⇑(Hom.toOrderHom f)

Next tactic:
simp only [skeletalFunctor_obj, skeletalFunctor_map,
    NonemptyFinLinOrd.epi_iff_surjective, NonemptyFinLinOrd.coe_of]
/-- A monomorphism in `SimplexCategory` must increase lengths-/
theorem len_le_of_mono {x y : SimplexCategory} {f : x ⟶ y} : Mono f → x.len ≤ y.len := by
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
⊢ Mono f → len x ≤ len y

Next tactic:
intro hyp_f_mono
/-- A monomorphism in `SimplexCategory` must increase lengths-/
theorem len_le_of_mono {x y : SimplexCategory} {f : x ⟶ y} : Mono f → x.len ≤ y.len := by
  intro hyp_f_mono
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
hyp_f_mono : Mono f
⊢ len x ≤ len y

Next tactic:
have f_inj : Function.Injective f.toOrderHom.toFun := mono_iff_injective.1 hyp_f_mono
/-- A monomorphism in `SimplexCategory` must increase lengths-/
theorem len_le_of_mono {x y : SimplexCategory} {f : x ⟶ y} : Mono f → x.len ≤ y.len := by
  intro hyp_f_mono
  have f_inj : Function.Injective f.toOrderHom.toFun := mono_iff_injective.1 hyp_f_mono
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
hyp_f_mono : Mono f
f_inj : Function.Injective (Hom.toOrderHom f).toFun
⊢ len x ≤ len y

Next tactic:
simpa using Fintype.card_le_of_injective f.toOrderHom.toFun f_inj
/-- An epimorphism in `SimplexCategory` must decrease lengths-/
theorem len_le_of_epi {x y : SimplexCategory} {f : x ⟶ y} : Epi f → y.len ≤ x.len := by
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
⊢ Epi f → len y ≤ len x

Next tactic:
intro hyp_f_epi
/-- An epimorphism in `SimplexCategory` must decrease lengths-/
theorem len_le_of_epi {x y : SimplexCategory} {f : x ⟶ y} : Epi f → y.len ≤ x.len := by
  intro hyp_f_epi
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
hyp_f_epi : Epi f
⊢ len y ≤ len x

Next tactic:
have f_surj : Function.Surjective f.toOrderHom.toFun := epi_iff_surjective.1 hyp_f_epi