Skip to content

Commit 3ff9e18

Browse files
committed
chore(AlgebraicTopology): making SimplexCategory a one-field structure (#37734)
1 parent 49586f3 commit 3ff9e18

11 files changed

Lines changed: 30 additions & 61 deletions

File tree

Mathlib/AlgebraicTopology/CechNerve.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ def cechNerveEquiv (X : SimplicialObject.Augmented C) (F : Arrow C) :
152152
ext x : 2
153153
· refine WidePullback.hom_ext _ _ _ (fun j => ?_) ?_
154154
· simp
155-
rfl
156155
· simpa using congr_app A.w.symm x
157156
· simp
158157

Mathlib/AlgebraicTopology/DoldKan/NCompGamma.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ theorem PInfty_comp_map_mono_eq_zero (X : SimplicialObject C) {n : ℕ} {Δ' : S
4444
obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_lt (len_lt_of_mono i fun h => by
4545
rw [← h] at h₁
4646
exact h₁ rfl)
47-
simp only [len_mk] at hk
4847
rcases k with _ | k
4948
· change n = m + 1 at hk
5049
subst hk
@@ -97,7 +96,6 @@ theorem Γ₀_obj_termwise_mapMono_comp_PInfty (X : SimplicialObject C) {Δ Δ'
9796
· have h' : n' = n + 1 := hi.left
9897
subst h'
9998
simp only [Γ₀.Obj.Termwise.mapMono_δ₀' _ i hi]
100-
dsimp
10199
rw [← PInfty.comm _ n, AlternatingFaceMapComplex.obj_d_eq]
102100
simp only [Preadditive.comp_sum]
103101
rw [Finset.sum_eq_single (0 : Fin (n + 2))]

Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ theorem δ_comp_σ_self {n} {i : Fin (n + 1)} :
303303
δ (Fin.castSucc i) ≫ σ i = 𝟙 ⦋n⦌ := by
304304
rcases i with ⟨i, hi⟩
305305
ext ⟨j, hj⟩
306-
simp? at hj says simp only [len_mk] at hj
307306
dsimp [σ, δ, Fin.predAbove, Fin.succAbove]
308307
simp only [Fin.lt_def, Fin.dite_val, Fin.ite_val, Fin.val_pred]
309308
split_ifs
@@ -728,10 +727,8 @@ theorem iso_eq_iso_refl {x : SimplexCategory} (e : x ≅ x) : e = Iso.refl x :=
728727
have eq₁ := Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso e) i)
729728
have eq₂ :=
730729
Finset.orderEmbOfFin_unique' h fun i => Finset.mem_univ ((orderIsoOfIso (Iso.refl x)) i)
731-
ext : 2
732-
convert congr_arg (fun φ => (OrderEmbedding.toOrderHom φ)) (eq₁.trans eq₂.symm)
733-
ext i : 2
734-
rfl
730+
ext : 4
731+
exact DFunLike.congr_fun (eq₁.trans eq₂.symm) _
735732

736733
theorem eq_id_of_isIso {x : SimplexCategory} (f : x ⟶ x) [IsIso f] : f = 𝟙 _ :=
737734
congr_arg (fun φ : _ ≅ _ => φ.hom) (iso_eq_iso_refl (asIso f))

Mathlib/AlgebraicTopology/SimplexCategory/Defs.lean

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ public import Mathlib.Util.Superscript
1212

1313
/-! # The simplex category
1414
15-
We construct a skeletal model of the simplex category, with objects `ℕ` and the
16-
morphisms `nm` being the monotone maps from `Fin (n + 1)` to `Fin (m + 1)`.
15+
We construct a skeletal model of the simplex category, with an object `⦋n⦌` for each `n : ℕ`, and
16+
morphisms `⦋n⦌⦋m⦌` identify to monotone maps from `Fin (n + 1)` to `Fin (m + 1)`.
1717
1818
In `Mathlib/AlgebraicTopology/SimplexCategory/Basic.lean`, we show that this category
1919
is equivalent to `NonemptyFinLinOrd`.
2020
2121
## Remarks
2222
23-
The definitions `SimplexCategory` and `SimplexCategory.Hom` are marked as irreducible.
24-
2523
We provide the following functions to work with these objects:
2624
1. `SimplexCategory.mk` creates an object of `SimplexCategory` out of a natural number.
2725
Use the notation `⦋n⦌` in the `Simplicial` locale.
@@ -46,47 +44,29 @@ universe v
4644
open CategoryTheory
4745

4846
/-- The simplex category:
49-
* objects are natural numbers `n : ℕ`
50-
* morphisms from `n` to `m` are monotone functions `Fin (n+1) → Fin (m+1)`
47+
* for each `n : ℕ`, there is an object `⦋n⦌`;
48+
* morphisms `⦋n⦌ ⟶ ⦋m⦌` are monotone functions `Fin (n+1) → Fin (m+1)`
5149
-/
52-
def SimplexCategory :=
53-
50+
@[ext]
51+
structure SimplexCategory : Type where
52+
/-- Constructor `ℕ → SimplexCategory`. -/
53+
mk ::
54+
/-- The length of an object in `SimplexCategory` -/
55+
len : ℕ
5456

5557
namespace SimplexCategory
5658

57-
-- The definition of `SimplexCategory` is made irreducible below.
58-
/-- Interpret a natural number as an object of the simplex category. -/
59-
def mk (n : ℕ) : SimplexCategory :=
60-
n
61-
6259
/-- the `n`-dimensional simplex can be denoted `⦋n⦌` -/
6360
scoped[Simplicial] notation "⦋" n "⦌" => SimplexCategory.mk n
6461

65-
-- TODO: Make `len` irreducible.
66-
/-- The length of an object of `SimplexCategory`. -/
67-
def len (n : SimplexCategory) : ℕ :=
68-
n
69-
70-
@[ext]
71-
theorem ext (a b : SimplexCategory) : a.len = b.len → a = b :=
72-
id
73-
74-
attribute [irreducible] SimplexCategory
75-
7662
open Simplicial
7763

78-
@[simp]
79-
theorem len_mk (n : ℕ) : ⦋n⦌.len = n :=
80-
rfl
64+
theorem len_mk (n : ℕ) : ⦋n⦌.len = n := rfl
8165

8266
@[simp]
8367
theorem mk_len (n : SimplexCategory) : ⦋n.len⦌ = n :=
8468
rfl
8569

86-
/-- A recursor for `SimplexCategory`. Use it as `induction Δ using SimplexCategory.rec`. -/
87-
protected def rec {F : SimplexCategory → Sort*} (h : ∀ n : ℕ, F ⦋n⦌) : ∀ X, F X := fun n =>
88-
h n.len
89-
9070
/-- Morphisms in the `SimplexCategory`. -/
9171
protected def Hom (a b : SimplexCategory) :=
9272
Fin (a.len + 1) →o Fin (b.len + 1)
@@ -106,8 +86,6 @@ theorem ext' {a b : SimplexCategory} (f g : SimplexCategory.Hom a b) :
10686
f.toOrderHom = g.toOrderHom → f = g :=
10787
id
10888

109-
attribute [irreducible] SimplexCategory.Hom
110-
11189
@[simp]
11290
theorem mk_toOrderHom {a b : SimplexCategory} (f : SimplexCategory.Hom a b) : mk f.toOrderHom = f :=
11391
rfl
@@ -134,6 +112,8 @@ def comp {a b c : SimplexCategory} (f : SimplexCategory.Hom b c) (g : SimplexCat
134112

135113
end Hom
136114

115+
attribute [irreducible] SimplexCategory.Hom
116+
137117
instance smallCategory : SmallCategory.{0} SimplexCategory where
138118
Hom n m := SimplexCategory.Hom n m
139119
id _ := SimplexCategory.Hom.id _

Mathlib/AlgebraicTopology/SimplexCategory/Rev.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ lemma rev_map_σ {n : ℕ} (i : Fin (n + 1)) :
6262
set_option backward.isDefEq.respectTransparency false in
6363
/-- The functor `SimplexCategory.rev : SimplexCategory ⥤ SimplexCategory`
6464
is a covariant involution. -/
65-
@[simps!]
65+
@[simps! hom_app inv_app]
6666
def revCompRevIso : rev ⋙ rev ≅ 𝟭 _ :=
6767
NatIso.ofComponents (fun _ ↦ Iso.refl _)
6868

Mathlib/AlgebraicTopology/SimplicialObject/ChainHomotopy.lean

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,26 @@ private lemma comm_succ (n : ℕ) :
118118
grind
119119
have h₃ : Disjoint (Finset.disjUnion _ _ h₂) {(0, 0), (Fin.last _, Fin.last _)} := by
120120
rw [Finset.disjoint_iff_ne]
121+
simp only [Finset.mem_insert, forall_eq_or_imp, Prod.forall]
122+
rintro ⟨a, _⟩ ⟨b, _⟩
123+
simp
121124
grind
122125
have h₄ : Disjoint (Finset.disjUnion _ _ h₁) (Finset.disjUnion _ _ h₃) := by
123126
rw [Finset.disjoint_iff_ne]
124127
simp only [Finset.compl_filter, not_lt, Finset.disjUnion_eq_union, Finset.mem_union,
125128
Finset.mem_image, Finset.mem_filter, Finset.mem_univ, true_and, Prod.exists, ne_eq,
126129
Finset.mem_insert, Finset.mem_singleton, Prod.forall, Prod.mk.injEq, not_and,
127130
S, γ₁, γ₂, γ₃, γ₄]
128-
rintro _ _ (⟨⟨j, _⟩, ⟨k, _⟩, h₁, h₂, h₃⟩ | ⟨⟨j, _⟩, ⟨k, _⟩, h₁, h₂, h₃⟩) _ _
131+
rintro ⟨a, _⟩ ⟨b, _⟩ (⟨⟨j, _⟩, ⟨k, _⟩, h₁, h₂, h₃⟩ | ⟨⟨j, _⟩, ⟨k, _⟩, h₁, h₂, h₃⟩) _ _
129132
((⟨⟨i, _⟩, h₄, h₅⟩ | ⟨⟨i, _⟩, h₄, h₅⟩) | (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩)) <;>
130-
simp at h₁ h₂ h₃ <;> grind
133+
simp [Fin.ext_iff] at h₁ h₂ h₃ <;> grind
131134
have H : (Finset.disjUnion _ _ h₁)ᶜ = Finset.disjUnion _ _ h₃ :=
132135
Finset.compl_eq_of_disjoint_of_card_add_eq h₄ (by
133136
rw [Finset.card_disjUnion, Finset.card_disjUnion, Finset.card_disjUnion,
134137
Finset.card_image_of_injective _ hγ₁, Finset.card_image_of_injective _ hγ₂,
135138
Finset.card_image_of_injective _ hγ₃, Finset.card_image_of_injective _ hγ₄]
136-
simp only [Finset.card_compl_add_card, Fintype.card_prod, Fintype.card_fin,
137-
Finset.card_univ]
138-
grind)
139+
simp
140+
lia)
139141
rw [eq₁, eq₂, ← S.sum_add_sum_compl, eq₃, eq₄,
140142
neg_add_rev, neg_neg, neg_neg, ← Finset.sum_disjUnion h₁,
141143
← (Finset.disjUnion _ _ h₁).sum_add_sum_compl, neg_add,

Mathlib/AlgebraicTopology/SimplicialSet/NerveAdjunction.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ lemma hσ'₁ (x : X _⦋1⦌₂) :
137137

138138
/-- Auxiliary definition for `SSet.Truncated.liftOfStrictSegal`. -/
139139
def app (n : (SimplexCategory.Truncated 2)ᵒᵖ) : X.obj n ⟶ Y.obj n := by
140-
obtain ⟨n, hn⟩ := n
141-
induction n using SimplexCategory.rec with | _ n
140+
obtain ⟨⟨n⟩, hn⟩ := n
142141
match n with
143142
| 0 => exact f₀
144143
| 1 => exact f₁

Mathlib/AlgebraicTopology/SimplicialSet/NerveNondegenerate.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ lemma mem_range_nerve_σ_iff (s : (nerve X) _⦋n + 1⦌) (i : Fin (n + 1)) :
4242
rw [Fin.predAbove_of_castSucc_lt _ _ h₁, Fin.pred_succ,
4343
Fin.succAbove_of_le_castSucc _ _ (Fin.le_castSucc_iff.2 h₁)]
4444
· simp only [not_lt] at h₁
45-
grind [SimplexCategory.len_mk, → Fin.succAbove_of_castSucc_lt,
45+
grind [→ Fin.succAbove_of_castSucc_lt,
4646
→ Fin.predAbove_of_le_castSucc, Fin.castSucc_castPred, Fin.castPred_castSucc,
4747
Fin.succAbove_castSucc_self, → LE.le.lt_or_eq]
4848

@@ -64,7 +64,7 @@ lemma mem_nerve_nonDegenerate_iff_strictMono (s : (nerve X) _⦋n⦌) :
6464
apply exists_congr
6565
intro i
6666
have := s.monotone i.castSucc_le_succ
67-
grind [SimplexCategory.len_mk, lt_self_iff_false, LE.le.lt_or_eq]
67+
grind [lt_self_iff_false, LE.le.lt_or_eq]
6868

6969
lemma mem_nerve_nonDegenerate_iff_injective (s : (nerve X) _⦋n⦌) :
7070
s ∈ (nerve X).nonDegenerate n ↔ Function.Injective s.obj := by

Mathlib/AlgebraicTopology/SimplicialSet/ProdStdSimplex.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ variable (p q) in
7575
/-- The binary product `Δ[p] ⊗ Δ[q]` identifies to the nerve
7676
of `ULift (Fin (p + 1) × Fin (q + 1))`. -/
7777
def isoNerve : Δ[p] ⊗ Δ[q] ≅ nerve (ULift.{u} (Fin (p + 1) × Fin (q + 1))) :=
78-
NatIso.ofComponents (fun d ↦ Equiv.toIso (by
79-
obtain ⟨d⟩ := d
80-
induction d using SimplexCategory.rec with | _ d
81-
exact objEquiv.trans
78+
NatIso.ofComponents (fun ⟨⟨d⟩⟩ ↦ Equiv.toIso (objEquiv.trans
8279
{ toFun f := (ULift.orderIso.symm.monotone.comp f.monotone).functor
8380
invFun s := ULift.orderIso.toOrderEmbedding.toOrderHom.comp ⟨_, s.monotone⟩ }))
8481

Mathlib/AlgebraicTopology/SimplicialSet/ProdStdSimplexOne.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ noncomputable def nonDegenerateEquiv₁ :
5959
obtain ⟨i, rfl⟩ := Fin.eq_succ_of_ne_zero (i := i) (by
6060
rintro rfl
6161
have := DFunLike.congr_fun hs 0
62-
simp only [orderHomOfSimplex_coe, OrderHom.id_coe, id_eq, Fin.ext_iff,
62+
simp only [orderHomOfSimplex_coe,
6363
stdSimplex.objMk₁_of_le_castSucc (0 : Fin (p + 3)) 0 (by simp)] at this
64-
lia)
64+
simp at this)
6565
obtain ⟨i, rfl⟩ | rfl := i.eq_castSucc_or_eq_last
6666
· exact ⟨i, nonDegenerate_ext₂ rfl rfl⟩
6767
· have := DFunLike.congr_fun hs (Fin.last _)

0 commit comments

Comments
 (0)