l3lab/ntp-mathlib huggingface dataset:
/-- 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
  have f_surj : Function.Surjective f.toOrderHom.toFun := epi_iff_surjective.1 hyp_f_epi
  

Proof state:
x y : SimplexCategory
f : x ⟶ y
hyp_f_epi : Epi f
f_surj : Function.Surjective (Hom.toOrderHom f).toFun
⊢ len y ≤ len x

Next tactic:
simpa using Fintype.card_le_of_surjective f.toOrderHom.toFun f_surj
instance {n : ℕ} {i : Fin (n + 2)} : Mono (δ i) := by
  

Proof state:
n : ℕ
i : Fin (n + 2)
⊢ Mono (δ i)

Next tactic:
rw [mono_iff_injective]
instance {n : ℕ} {i : Fin (n + 2)} : Mono (δ i) := by
  rw [mono_iff_injective]
  

Proof state:
n : ℕ
i : Fin (n + 2)
⊢ Function.Injective ⇑(Hom.toOrderHom (δ i))

Next tactic:
exact Fin.succAbove_right_injective
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  

Proof state:
n : ℕ
i : Fin (n + 1)
⊢ Epi (σ i)

Next tactic:
rw [epi_iff_surjective]
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  

Proof state:
n : ℕ
i : Fin (n + 1)
⊢ Function.Surjective ⇑(Hom.toOrderHom (σ i))

Next tactic:
intro b
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
⊢ ∃ a, (Hom.toOrderHom (σ i)) a = b

Next tactic:
simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
⊢ ∃ a, { toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } a = b

Next tactic:
by_cases h : b ≤ i
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · 

Proof state:
case pos
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : b ≤ i
⊢ ∃ a, { toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } a = b

Next tactic:
use b
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    

Proof state:
case h
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : b ≤ i
⊢ { toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } ↑↑b = b

Next tactic:
dsimp
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    

Proof state:
case h
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : b ≤ i
⊢ Fin.predAbove i ↑↑b = b

Next tactic:
rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by 

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : b ≤ i
⊢ ↑↑b ≤ Fin.castSucc i

Next tactic:
simpa only [Fin.coe_eq_castSucc] using h
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    

Proof state:
case h
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : b ≤ i
⊢ Fin.castPred ↑↑b = b

Next tactic:
simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · 

Proof state:
case neg
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : ¬b ≤ i
⊢ ∃ a, { toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } a = b

Next tactic:
use b.succ
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · use b.succ
    -- This was not needed before leanprover/lean4#2644
    

Proof state:
case h
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : ¬b ≤ i
⊢ { toFun := Fin.predAbove i, monotone' := (_ : Monotone (Fin.predAbove i)) } (Fin.succ b) = b

Next tactic:
dsimp
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · use b.succ
    -- This was not needed before leanprover/lean4#2644
    dsimp
    

Proof state:
case h
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : ¬b ≤ i
⊢ Fin.predAbove i (Fin.succ b) = b

Next tactic:
rw [Fin.predAbove_above i b.succ _, Fin.pred_succ]
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · use b.succ
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_above i b.succ _, Fin.pred_succ]
    

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : ¬b ≤ i
⊢ Fin.castSucc i < Fin.succ b
n : ℕ i : Fin (n + 1) b : Fin (len [n] + 1) h : ¬b ≤ i ⊢ Fin.castSucc i < Fin.succ b

Next tactic:
rw [not_le] at h
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · use b.succ
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_above i b.succ _, Fin.pred_succ]
    rw [not_le] at h
    

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : i < b
⊢ Fin.castSucc i < Fin.succ b

Next tactic:
rw [Fin.lt_iff_val_lt_val] at h ⊢
instance {n : ℕ} {i : Fin (n + 1)} : Epi (σ i) := by
  rw [epi_iff_surjective]
  intro b
  simp only [σ, mkHom, Hom.toOrderHom_mk, OrderHom.coe_mk]
  by_cases h : b ≤ i
  · use b
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_below i b (by simpa only [Fin.coe_eq_castSucc] using h)]
    simp only [len_mk, Fin.coe_eq_castSucc, Fin.castPred_castSucc]
  · use b.succ
    -- This was not needed before leanprover/lean4#2644
    dsimp
    rw [Fin.predAbove_above i b.succ _, Fin.pred_succ]
    rw [not_le] at h
    rw [Fin.lt_iff_val_lt_val] at h ⊢
    

Proof state:
n : ℕ
i : Fin (n + 1)
b : Fin (len [n] + 1)
h : ↑i < ↑b
⊢ ↑(Fin.castSucc i) < ↑(Fin.succ b)

Next tactic:
simpa only [Fin.val_succ, Fin.coe_castSucc] using Nat.lt.step h
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                

Proof state:
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
⊢ inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂

Next tactic:
by_cases h' : y₁ < y₂
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · 

Proof state:
case pos
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
⊢ inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂

Next tactic:
by_contra h''
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  

Proof state:
case pos
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ False

Next tactic:
apply not_le.mpr h'
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  

Proof state:
case pos
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ y₂ ≤ y₁

Next tactic:
convert f.toOrderHom.monotone (le_of_not_ge h'')
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  

Proof state:
case h.e'_3
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ y₂ = (Hom.toOrderHom f) (inv ((forget SimplexCategory).map f) y₂)
case h.e'_4
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ y₁ = (Hom.toOrderHom f) (inv ((forget SimplexCategory).map f) y₁)

Next tactic:
all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    

Proof state:
case h.e'_3
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ y₂ = (Hom.toOrderHom f) (inv ((forget SimplexCategory).map f) y₂)

Next tactic:
exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    

Proof state:
case h.e'_4
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : y₁ < y₂
h'' : ¬inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂
⊢ y₁ = (Hom.toOrderHom f) (inv ((forget SimplexCategory).map f) y₁)

Next tactic:
exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · 

Proof state:
case neg
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
y₁ y₂ : Fin (len B✝ + 1)
h : y₁ ≤ y₂
h' : ¬y₁ < y₂
⊢ inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂

Next tactic:
rw [eq_of_le_of_not_lt h h']
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          

Proof state:
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ f ≫
      Hom.mk
        { toFun := inv ((forget SimplexCategory).map f),
          monotone' :=
            (_ :
              ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) } =
    𝟙 A✝

Next tactic:
ext1
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          ext1
          

Proof state:
case a
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ Hom.toOrderHom
      (f ≫
        Hom.mk
          { toFun := inv ((forget SimplexCategory).map f),
            monotone' :=
              (_ :
                ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                  y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) }) =
    Hom.toOrderHom (𝟙 A✝)

Next tactic:
ext1
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          ext1
          ext1
          

Proof state:
case a.h
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ ⇑(Hom.toOrderHom
        (f ≫
          Hom.mk
            { toFun := inv ((forget SimplexCategory).map f),
              monotone' :=
                (_ :
                  ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                    y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) })) =
    ⇑(Hom.toOrderHom (𝟙 A✝))

Next tactic:
exact Iso.hom_inv_id (asIso ((forget _).map f))
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          ext1
          ext1
          exact Iso.hom_inv_id (asIso ((forget _).map f))
        inv_hom_id := by
          

Proof state:
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ Hom.mk
        { toFun := inv ((forget SimplexCategory).map f),
          monotone' :=
            (_ :
              ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) } ≫
      f =
    𝟙 B✝

Next tactic:
ext1
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          ext1
          ext1
          exact Iso.hom_inv_id (asIso ((forget _).map f))
        inv_hom_id := by
          ext1
          

Proof state:
case a
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ Hom.toOrderHom
      (Hom.mk
          { toFun := inv ((forget SimplexCategory).map f),
            monotone' :=
              (_ :
                ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                  y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) } ≫
        f) =
    Hom.toOrderHom (𝟙 B✝)

Next tactic:
ext1
instance : ReflectsIsomorphisms (forget SimplexCategory) :=
  ⟨fun f hf =>
    IsIso.of_iso
      { hom := f
        inv := Hom.mk
            { toFun := inv ((forget SimplexCategory).map f)
              monotone' := fun y₁ y₂ h => by
                by_cases h' : y₁ < y₂
                · by_contra h''
                  apply not_le.mpr h'
                  convert f.toOrderHom.monotone (le_of_not_ge h'')
                  all_goals
                    exact (congr_hom (Iso.inv_hom_id
                      (asIso ((forget SimplexCategory).map f))) _).symm
                · rw [eq_of_le_of_not_lt h h'] }
        hom_inv_id := by
          ext1
          ext1
          exact Iso.hom_inv_id (asIso ((forget _).map f))
        inv_hom_id := by
          ext1
          ext1
          

Proof state:
case a.h
A✝ B✝ : SimplexCategory
f : A✝ ⟶ B✝
hf : IsIso ((forget SimplexCategory).map f)
⊢ ⇑(Hom.toOrderHom
        (Hom.mk
            { toFun := inv ((forget SimplexCategory).map f),
              monotone' :=
                (_ :
                  ∀ (y₁ y₂ : Fin (len B✝ + 1)),
                    y₁ ≤ y₂ → inv ((forget SimplexCategory).map f) y₁ ≤ inv ((forget SimplexCategory).map f) y₂) } ≫
          f)) =
    ⇑(Hom.toOrderHom (𝟙 B✝))

Next tactic:
exact Iso.inv_hom_id (asIso ((forget _).map f))
/-- An isomorphism in `SimplexCategory` induces an `OrderIso`. -/
@[simp]
def orderIsoOfIso {x y : SimplexCategory} (e : x ≅ y) : Fin (x.len + 1) ≃o Fin (y.len + 1) :=
  Equiv.toOrderIso
    { toFun := e.hom.toOrderHom
      invFun := e.inv.toOrderHom
      left_inv := fun i => by
        

Proof state:
x y : SimplexCategory
e : x ≅ y
i : Fin (len x + 1)
⊢ (Hom.toOrderHom e.inv) ((Hom.toOrderHom e.hom) i) = i

Next tactic:
simpa only using congr_arg (fun φ => (Hom.toOrderHom φ) i) e.hom_inv_id
/-- An isomorphism in `SimplexCategory` induces an `OrderIso`. -/
@[simp]
def orderIsoOfIso {x y : SimplexCategory} (e : x ≅ y) : Fin (x.len + 1) ≃o Fin (y.len + 1) :=
  Equiv.toOrderIso
    { toFun := e.hom.toOrderHom
      invFun := e.inv.toOrderHom
      left_inv := fun i => by
        simpa only using congr_arg (fun φ => (Hom.toOrderHom φ) i) e.hom_inv_id
      right_inv := fun i => by
        

Proof state:
x y : SimplexCategory
e : x ≅ y
i : Fin (len y + 1)
⊢ (Hom.toOrderHom e.hom) ((Hom.toOrderHom e.inv) i) = i

Next tactic:
simpa only using congr_arg (fun φ => (Hom.toOrderHom φ) i) e.inv_hom_id
theorem iso_eq_iso_refl {x : SimplexCategory} (e : x ≅ x) : e = Iso.refl x := by
  

Proof state:
x : SimplexCategory
e : x ≅ x
⊢ e = Iso.refl x

Next tactic:
have h : (Finset.univ : Finset (Fin (x.len + 1))).card = x.len + 1 := Finset.card_fin (x.len + 1)
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)
  

Proof state:
x : SimplexCategory
e : x ≅ x
h : Finset.card Finset.univ = len x + 1
⊢ e = Iso.refl x

Next tactic:
have eq₁ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
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)
  

Proof state:
x : SimplexCategory
e : x ≅ x
h : Finset.card Finset.univ = len x + 1
eq₁ : RelIso.toRelEmbedding (orderIsoOfIso e) = Finset.orderEmbOfFin Finset.univ h
⊢ e = Iso.refl x

Next tactic:
have eq₂ :=
    Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
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.
  

Proof state:
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
⊢ e = Iso.refl x

Next tactic:
ext x