Model categories in Lean

33
Model categories in Lean Reid Barton Lean Together, January 2019

Transcript of Model categories in Lean

Page 1: Model categories in Lean

Model categories in Lean

Reid Barton

Lean Together, January 2019

Page 2: Model categories in Lean

Source code

I https://github.com/rwbarton/lean-model-categories

Branch top-dev (under construction!)

I https://github.com/rwbarton/lean-homotopy-theory

Page 3: Model categories in Lean

What is a model category?

I (Quillen, Homotopical Algebra, 1967)A model category is a category M equipped with three classesof morphismsI weak equivalences (W )I cofibrations (C )I fibrations (F )

satisfying axioms M1, M2, M3, M4, M5.

I A model category is one kind of presentation of an underlying“homotopy theory” (or (∞, 1)-category) LWM, whichdepends only on the weak equivalences W .

I The extra structure on M allows us to do certain calculationsin LWM within the framework of ordinary categories.

Page 4: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)

I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 5: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)

I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 6: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 7: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 8: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 9: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories]

(23 questions containing the word “perfectoid”)

Page 10: Model categories in Lean

Examples

I Classical homotopy theory of spacesI Topological spaces (TopQuillen)I Simplicial sets (sSetQuillen)I . . .

I Chain complexes (homological algebra)I Ch(RMod)proj, Ch(RMod)inj

I Stable homotopy theory

I Equivariant homotopy theory

I Higher category theory, e.g., (∞, 1)-categories

I A1-homotopy theory

I . . .

468 questions on MathOverflow with tag [model-categories](23 questions containing the word “perfectoid”)

Page 11: Model categories in Lean

Project goals

I Formalize the definition of a model category (easy)I Construct some of the central examples (hard)

I Current focus: topological spaces (TopQuillen)I Future aims: combinatorial model categories, simplicial sets

Page 12: Model categories in Lean

Definition: preliminaries

universe u

variables (M : Type (u+1)) [large_category M]

def morphism_class : Type* :=

Π {{a b : M}}, (a → b) -> Prop

instance : has_subset (morphism_class M) :=

{ subset := λ I J,

∀ {{a b : M}} {{f : a → b}}, I f -> J f }

instance : has_inter (morphism_class M) :=

{ inter := λ I J, λ a b f, I f ∧ J f }

Page 13: Model categories in Lean

Definition: weak equivalences

structure is_weq (W : morphism_class M) : Prop :=

(weq_of_iso : ∀ {x y} (i : iso x y), W i.hom)

(weq_comp : ∀ {x y z} {f : x → y} {g : y → z},

W f -> W g -> W (f � g))

(weq_cancel_left : ∀ {x y z} {f : x → y} {g : y → z},

W f -> W (f � g) -> W g)

(weq_cancel_right : ∀ {x y z} {f : x → y} {g : y → z},

W g -> W (f � g) -> W f)

The last three conditions together are the“two-out-of-three property”.

X Z

Yf

f�g

g

In TopQuillen, W = maps inducing isomorphisms on π∗.

Page 14: Model categories in Lean

Definition: lifting property

def lp {a b x y : M} (f : a → b) (g : x → y) : Prop :=

∀ (h : a → x) (k : b → y), h � g = f � k ->

∃ (l : b → x), f � l = h ∧ l � g = k

def llp (R : morphism_class M) : morphism_class M :=

λ a b f, ∀ {{x y}} {{g : x → y}}, R g -> lp f g

def rlp (L : morphism_class M) : morphism_class M :=

λ x y g, ∀ {{a b}} {{f : a → b}}, L f -> lp f g

lp(f , g) ⇐⇒A X

B Y

f

h

g

k

∃l

Page 15: Model categories in Lean

Definition: weak factorization system

structure is_wfs (L R : morphism_class M) : Prop :=

(llp : L = llp R)

(rlp : R = rlp L)

(fact : ∀ {x y} (g : x → y),

∃ z (l : x → z) (r : z → y), L l ∧ R r ∧ l � r = g)

Factorization axiom: Any g : X → Y can be written as a

composition Xl−→ Z

r−→ Y with l ∈ L and r ∈ R.

Page 16: Model categories in Lean

Definition: model category

class model_category (M : Type (u+1)) [large_category M] :=

(complete : has_limits M)

(cocomplete : has_colimits M)

(W C F : morphism_class M)

(weq : is_weq W)

(caf : is_wfs C (F ∩ W))

(acf : is_wfs (C ∩ W) F)

Page 17: Model categories in Lean

Constructing model categories

Construction of a model category structure on a category Musually proceeds along the following lines.

I Write down a class of weak equivalences W on M and checkthat W satisfies the two-out-of-three property.

I Construct two weak factorization systems (C ,AF ) and(AC ,F ) on M. There is a standard procedure for this calledthe small object argument.

I Verify that AC = C ∩W and AF = F ∩W . This stepgenerally requires some specialized argument.

Here, we’ll focus exclusively on the second step.

Page 18: Model categories in Lean

Constructing weak factorization systems

I Recall that a weak factorization system (L,R) is required tosatisfy L = llp(R) and R = rlp(L).

I Easy lemma: rlp(llp(rlp(I ))) = rlp(I ).(Same as constructive proof of ¬¬¬P ⇐⇒ ¬P.)

I Thus, we can choose any collection of morphisms I and setL = llp(rlp(I )) and R = rlp(I ), and then the conditionsL = llp(R) and R = rlp(L) will be satisfied. We say that(L,R) is “cofibrantly generated” by I .

For TopQuillen, we will takeI (C ,AF ) to be generated by I = { ∂Dn → Dn | n ≥ 0 }I (AC ,F ) to be generated by

J = {Dn × {0} → Dn × [0, 1] | n ≥ 0 }

Page 19: Model categories in Lean

Constructing weak factorization systems

However, we still need to verify the last condition for a weakfactorization system, namely that every morphism g can befactored as a morphism of L followed by a morphism of R.

We’ll specialize to this situation:

I M = Top

I I = { ∂Dn → Dn | n ≥ 0 }I Y = ∗ (so g : X → ∗)

Need to express g as a composition of j : X → X ′ and g ′ : X ′ → ∗with j ∈ llp(rlp(I )) and g ′ ∈ rlp(I ).

Page 20: Model categories in Lean

The small object argument

I Suppose g already has the property that every map ∂Dn → Xadmits an extension to Dn.

∂Dn X

Dn ∗

Then g ∈ rlp(I ) and we can factor g as the identity followedby g .

I In general, this will not be the case. Idea: replace g : X → ∗with a new map g ′ : X ′ → ∗ which is “closer” to having thisproperty.

Page 21: Model categories in Lean

The small object argument

I Form X ′ by attaching a cell Dn along every possible attachingmap ∂Dn → X . This yields a factorization of g : X → ∗ as

X X ′ ∗j g ′

By construction, any map ∂Dn → X admits an extensionlanding in X ′:

∂Dn X X ′

Dn ∗g

j

g ′∃

I General fact: j ∈ llp(rlp(I )) = L.

I Done?

Page 22: Model categories in Lean

The small object argument

I There will be new maps ∂Dn → X ′, so that g ′ /∈ rlp(I ).

I Repeat! Set Xi+1 = X ′i , obtaining a sequence

X = X0 X1 X2 · · ·j0 j1 j2

I Define Xω = colimi Xi .

I General fact: the composition j : X → Xω still belongs tollp(rlp(I )) = L.

Page 23: Model categories in Lean

The small object argument

I Fact (not general!): Any map ∂Dn → Xω factors through Xi

for some i < ω.

I That means any lifting problem for gω : Xω → ∗ factorsthrough gi : Xi → ∗ for some i , and therefore we attached asolution to this lifting problem at stage i + 1.

∂Dn Xi Xi+1 Xω

Dn ∗gi

ji

gi+1 gω∃

I Therefore, gω ∈ rlp(I ) = R and we’re done.

Page 24: Model categories in Lean

The transfinite case

I In general, countably many steps may not be sufficient.I We can extend this construction transfinitely:

I At a successor stage, construct Xα+1 from Xα as before.I At a limit stage, define Xβ to be the colimit of the entire

sequence (Xα)α<β defined so far.

I In broad generality, one can show that there exists an ordinalγ such that every map Ai → Xγ factors through Xα for someα < γ. Then we can end the construction at stage γ.

Page 25: Model categories in Lean

Formalizing the small object argument

I We need to construct the transfinite sequenceX0 → X1 → · · · → Xω → Xω+1 · · · → Xγ .

I Obvious idea: some kind of recursive construction.

I Choose a well-ordered type α with order type γ + 1.I def well_founded.fix {α : Sort u} {C : α -> Sort v}

{r : α -> α -> Prop} (hwf : well_founded r)

(F : Π x, (Π y, r y x -> C y) -> C x)

(x : α) : C x

I How to choose C? Maybe take C i to be the type of sequencesX0 → X1 → · · · → Xi?

Page 26: Model categories in Lean

Formalizing the small object argument

I At a limit stage β, we need to form the “union” (Xα)α<β ofall the sequences defined earlier, so that we can define Xβ tobe its colimit. In order to make sense of this union, we mustknow that each sequence extends the earlier ones.

I However, the induction hypothesis Π y, y < x -> C y ofwell_founded.fix does not give us any information abouthow the previous values were defined.

I If we could perform this recursive construction, then we coulduse the defining equations for well_founded.fix to provethat each sequence extends the earlier ones. . .

Page 27: Model categories in Lean

Recursive constructions with roption

I Idea: Recursively construct a sequence of values, each ofwhich is either the desired thing, or an “undefined” value.

structure roption (α : Type u) : Type u :=

(dom : Prop)

(get : dom -> α)

Classically, dom is either true, in which case get provides avalue of type α, or false, in which case get providesnothing. So roption α is isomorphic to option α.

I After constructing these roption values recursively, prove byinduction that all the dom fields are actually true.

Page 28: Model categories in Lean

General setup

parameters {α : Type u} {r : α -> α -> Prop}

(hwf : well_founded r)

local infix `<` := r

parameters {C : α -> Type u}

parameters (q : Π {{i j}}, C i -> C j -> Prop)

local infix `∼` := q

parameters

(F : Π (a : α) (f : Π (i : α), i < a -> C i)

(hf : ∀ i j ria rja, i < j -> f i ria ∼ f j rja),

{x : C a // ∀ i (ria : i < a), f i ria ∼ x})

I C is the major premise, i.e., what we want to construct ateach step.

I q is a compatibility condition on the values of C at each pairof steps i, j with i < j.

I F describes how to perform each inductive step.

Page 29: Model categories in Lean

The recursive definition

def crec_core : Π (a : α), roption (C a) :=

hwf.fix $ λ a I,

{ dom := ∃ (t : ∀ i (ria : i < a), (I i ria).dom),

∀ i j ria rja, i < j ->

(I i ria).get (t i ria) ∼ (I j rja).get (t j rja),

get := λ h,

F a (λ i ria, (I i ria).get (h.fst i ria)) h.snd }

I The value at step a is defined if the values at all steps i < a

are defined and consistent.

I In that case, we can use the inductive step F to produce thenew value.

Page 30: Model categories in Lean

The definition is actually total

lemma crec_lemma : ∀ (a : α),∃ (t : (crec_core a).dom)

(t' : ∀ i (ria : i < a), (crec_core i).dom)

(hq : ∀ {{i j ria rja}} {{rij : i < j}},

(crec_core i).get (t' i ria) ∼(crec_core j).get (t' j rja)),

(crec_core a).get t =

(F a (λ m rma, (crec_core m).get (t' m rma)) hq).val ∧∀ i (ria : i < a),

(crec_core i).get (t' i ria) ∼ (crec_core a).get t :=

...

I Straightforward inductive argument.

I Key point: (t : (crec_core a).dom), so crec_core a

has a value.

Page 31: Model categories in Lean

Extracting the value

def crec (a : α) : C a :=

(crec_core a).get (crec_lemma a).fst

lemma crec_consistent {i j} (h : i < j) :

crec i ∼ crec j :=

by apply (crec_lemma j).snd.snd.snd.right; exact h

Generic way to carry out an inductive construction whilemaintaining a consistency invariant.

Page 32: Model categories in Lean

Current status of TopQuillen

axiom A : rlp serre_I = rlp serre_J ∩ @is_weak_equivalence

def quillen_serre : model_category.{1 0} Top.{0} :=

model_category.mk' W_is_weq serre_caf serre_acf A AC_sub_W

Page 33: Model categories in Lean

Thank you!