Zulip Chat Archive

Stream: general

Topic: morphisms between objects that are "equal"


Johan Commelin (Jul 27 2020 at 07:55):

I'm looking at complexes again... and I'm hitting the old problem with defeq issues on int.

def graded_object (M : simplicial_module R) : graded_object_with_shift (-1:) (Module R)
| -[1+n] := Module.of R punit -- this should just be 0
| (n:)  := (skeletal.obj M).obj (op n)

def graded_object_d (M : simplicial_module R) :
  M.graded_object  M.graded_object1
| -[1+n]  := 0
| (0:)   := 0
| (n+1:) :=
begin
  refine M.boundary n  _,
  show M.graded_object n  M.graded_object (n+1-1),
  -- aahrg :scream:
end

Johan Commelin (Jul 27 2020 at 07:56):

Because of the way nat.sub is defined, n+1-1 is not defeq to n. And hence we are in trouble.

Johan Commelin (Jul 27 2020 at 07:57):

What is the correct way forward?

Johan Commelin (Jul 27 2020 at 07:58):

If you want to play with this, I suggest leanproject get -b mathlib:sset and then look at topology/simplicial/simplicial_complex

Johan Commelin (Jul 27 2020 at 07:58):

Of course I can congr my way through, but that generated ugly inductions on equality, and I thought those were really evil in category theory.

Johan Commelin (Jul 27 2020 at 07:58):

@Scott Morrison What do you think?

Johan Commelin (Jul 27 2020 at 08:00):

Maybe graded_object should be defined as functors from discrete \b to C?

Johan Commelin (Jul 27 2020 at 08:01):

That way, I could do graded_object.map and reduce this to a morphism in the discrete category.

Johan Commelin (Jul 27 2020 at 08:01):

Over there, eq.rec is less of a problem, I guess.

Scott Morrison (Jul 27 2020 at 08:02):

How is graded_object defined now?

Johan Commelin (Jul 27 2020 at 08:02):

Functions

Scott Morrison (Jul 27 2020 at 08:03):

what's wrong with just composing with an eq_to_hom?

Johan Commelin (Jul 27 2020 at 08:03):

Let me try

Scott Morrison (Jul 27 2020 at 08:03):

I think eq_to_hom is as much of a solution as we have for this.

Johan Commelin (Jul 27 2020 at 08:04):

Ok, so it doesn't matter that I'm proving an equality of types afterwards?

Johan Commelin (Jul 27 2020 at 08:04):

I'll try this, let's hope for the best (-;

Scott Morrison (Jul 27 2020 at 08:04):

In some branch (...?) I also introduced some congr_eq_to_hom (I forget the name exactly), which addressed this..

Scott Morrison (Jul 27 2020 at 08:05):

If f : J \to C, j j' : J, h : j = j' then I defined congr_eq_to_hom f h : f j \hom f j'.

Scott Morrison (Jul 27 2020 at 08:06):

But somehow the point was that if you didn't unfold it, you never had an equation in Type (or C), but only in the index category, and once you reached the end of things they would all resolve away.

Scott Morrison (Jul 27 2020 at 08:06):

Let me see what I can find. I can't even place the context right now.

Scott Morrison (Jul 27 2020 at 08:12):

Sorry, not finding it right away.

Johan Commelin (Jul 27 2020 at 08:18):

This is a really crappy problem, and it's not really going away I fear.

Johan Commelin (Jul 27 2020 at 08:19):

M.graded_object_d (n + 1 + 1)  M.graded_object_d (n + 1 + 1 + -1) = 0

Johan Commelin (Jul 27 2020 at 08:19):

That's my next goal

Johan Commelin (Jul 27 2020 at 08:19):

And of course the definition doesn't reduce nicely, because ↑n + 1 + 1 + -1 doesn't simplify

Johan Commelin (Jul 27 2020 at 08:47):

@Mario Carneiro I'm inclined to redefine nat.sub... but that's just going to shift the problem, right?

Johan Commelin (Jul 27 2020 at 08:48):

What is the "official" solution?

Johan Commelin (Jul 27 2020 at 08:48):

example (n : ) : 0 - n = 0 := rfl -- fails :sad:

Mario Carneiro (Jul 27 2020 at 08:49):

you need an eq_to_hom definition for M.graded_object_d

Johan Commelin (Jul 27 2020 at 08:49):

def graded_object (M : simplicial_module R) : graded_object_with_shift (-1:) (Module R)
| -[1+n] := Module.of R punit -- this should just be 0
| (n:)  := (skeletal.obj M).obj (op n)

def graded_object_d (M : simplicial_module R) :
  M.graded_object  M.graded_object1
| -[1+n]  := 0
| 0       := 0
| (n+1:) := M.boundary n 
               eq_to_hom (show M.graded_object n = M.graded_object (n + 1 + -1), by simp)

example (n : ) : (n:)+1 - -1 = n+2 := rfl
example (n : ) : 0 - n = 0 := rfl

lemma graded_object_d_squared (M : simplicial_module R) :
   i, (M.graded_object_d-1⟧'  M.graded_object_d1⟧'⟦-1⟧') i = 0
| -[1+(n+1)] := rfl
| -1         := rfl
| 0          := rfl
| (n+1:)    :=
begin
  dsimp [shift, has_shift.shift],
  -- have aux : ∀ i j, i = j → M.graded_object_d i == M.graded_object_d j,
  -- { rintro i j rfl, exact heq.refl _ },
  -- dsimp [graded_object_d],
  -- specialize aux (n + 1) (n + 1 + 1 + -1) (by simp),
  -- show (_ ≫ _) ≫ _ = 0,
end

Johan Commelin (Jul 27 2020 at 08:49):

I did that

Johan Commelin (Jul 27 2020 at 08:50):

Now try to prove d_squared

Kenny Lau (Jul 27 2020 at 08:50):

did you use the Mariolization?

Kenny Lau (Jul 27 2020 at 08:50):

i.e. use Sigma

Mario Carneiro (Jul 27 2020 at 08:50):

No no, you need M.graded_object.eq_to_hom : a = b -> M.graded_object a -> M.graded_object b

Mario Carneiro (Jul 27 2020 at 08:51):

kenny's suggestion to use my earlier suggestion is also feasible

Johan Commelin (Jul 27 2020 at 08:51):

Which earlier suggestion?

Mario Carneiro (Jul 27 2020 at 08:52):

mix everything into one untyped pot

Kenny Lau (Jul 27 2020 at 08:52):

use Sigma n, M n (or direct sum I guess)

Kenny Lau (Jul 27 2020 at 08:52):

and state every identity there

Mario Carneiro (Jul 27 2020 at 08:52):

that eliminates the dependent types so you won't have to deal with equalities in type dependencies anymore

Johan Commelin (Jul 27 2020 at 08:52):

I guess that doesn't work for arbitrary categories

Mario Carneiro (Jul 27 2020 at 08:53):

It works on anything

Kenny Lau (Jul 27 2020 at 08:53):

what is graded_object_with_shift?

Mario Carneiro (Jul 27 2020 at 08:54):

it has it's own downsides, but it is a good technique to use when DTT hell starts

Mario Carneiro (Jul 27 2020 at 08:55):

do you have an MWE that I can play with?

Johan Commelin (Jul 27 2020 at 08:57):

Sigma might work, but the direct sum doesn't

Johan Commelin (Jul 27 2020 at 08:58):

I don't have an MWE... but you can leanproject get mathlib:sset...

Johan Commelin (Jul 27 2020 at 08:59):

I'm not sure the graded_object_eq_to_hom trick is sufficient here...

Mario Carneiro (Jul 27 2020 at 08:59):

then what?

Mario Carneiro (Jul 27 2020 at 09:01):

MWE please

Johan Commelin (Jul 27 2020 at 09:08):

I've now proven

lemma graded_object_d_congr (i j : ) (h : i = j) :
  M.graded_object_d i = M.graded_object_eq_to_hom i j h  M.graded_object_d j 
    M.graded_object_eq_to_hom (j-1) (i-1) (by rw h) :=
begin
  subst h, simp only [graded_object_eq_to_hom, category.id_comp, eq_to_hom_refl],
  erw category.comp_id,
end

Johan Commelin (Jul 27 2020 at 09:08):

This is a very ugly hack

Johan Commelin (Jul 27 2020 at 09:16):

Whoah, I managed to prove it:

lemma graded_object_d_squared (M : simplicial_module R) :
   i, (M.graded_object_d  M.graded_object_d1⟧') i = 0
| -[1+n]  := rfl
| 0       := rfl
| 1       := rfl
| (n+2:) :=
begin
  dsimp,
  show M.graded_object_d (n + 1 + 1)  M.graded_object_d (n + 1 + 1 + -1) = 0,
  rw M.graded_object_d_congr (n + 1 + 1 + -1) (n + 1) (by simp),
  show (_  _)  _  (_  _)  _ = 0,
  simp only [graded_object_eq_to_hom, eq_to_hom_trans, category.id_comp,
    eq_to_hom_refl, eq_to_hom_trans_assoc, category.assoc],
  rw  category.assoc,
  show (M.boundary ((n + 1))  M.boundary (n))  eq_to_hom _ = 0,
  rw M.boundary_boundary n,
  simp only [limits.has_zero_morphisms.zero_comp]
end

Johan Commelin (Jul 27 2020 at 09:16):

But I'm not sure whether this method scales...

Johan Commelin (Jul 27 2020 at 09:17):

I guess we need some custom constructors for complexes.

Scott Morrison (Jul 27 2020 at 09:17):

I made a constructor for finite length complexes, out of an inductive type for composable morphisms

Scott Morrison (Jul 27 2020 at 09:18):

it's on a branch SES, which is not very pretty

Johan Commelin (Jul 27 2020 at 09:19):

But this one isn't finite length

Scott Morrison (Jul 27 2020 at 09:20):

Yes, I was just including this under "some". :-)

Mario Carneiro (Jul 27 2020 at 09:21):

hrm, there is still no MWE. What file are you working in? What are the imports? What does anything mean? You aren't being very nice

Scott Morrison (Jul 27 2020 at 09:26):

Which file is this in?

Scott Morrison (Jul 27 2020 at 09:30):

Also, how about you push your latest additions to that branch? :-)

Johan Commelin (Jul 27 2020 at 10:19):

Johan Commelin said:

If you want to play with this, I suggest leanproject get -b mathlib:sset and then look at topology/simplicial/simplicial_complex

I just pushed

Johan Commelin (Jul 27 2020 at 10:20):

I think that we almost have the chain complex

Johan Commelin (Jul 27 2020 at 10:21):

The hom_congr suggestion works sufficiently well, I think.
Thanks @Mario Carneiro

Johan Commelin (Jul 27 2020 at 10:58):

We have lunch and a chain complex (-;

Johan Commelin (Jul 27 2020 at 11:11):

This is how far we are from the homology functors on topological spaces:

R: Type u
_inst_1: comm_ring R
i: 
 Top  Module R
Messages (3)
singular.lean:62:27
failed to synthesize type class instance for
R : Type u,
_inst_1 : comm_ring R,
i : 
 limits.has_images (Module R)
singular.lean:62:27
failed to synthesize type class instance for
R : Type u,
_inst_1 : comm_ring R,
i : 
 limits.has_equalizers (Module R)
singular.lean:62:27
failed to synthesize type class instance for
R : Type u,
_inst_1 : comm_ring R,
i : 
 limits.has_cokernels (Module R)

Markus Himmel (Jul 27 2020 at 11:13):

All of this exists, just not in mathlib

Markus Himmel (Jul 27 2020 at 11:18):

Unless @Scott Morrison has done this already in one of his branches, I can make a PR with my proof of abelian (Module R), which takes care of the images. Equalizers and cokernels should be in #3463.

Johan Commelin (Jul 27 2020 at 11:22):

Great!

Scott Morrison (Jul 27 2020 at 11:23):

Yes please!

Scott Morrison (Jul 27 2020 at 11:24):

#3463 is hopefully close to the merge queue. :-)

Reid Barton (Jul 27 2020 at 12:23):

wait, how could the Sigma approach work on an arbitrary category?

Mario Carneiro (Jul 27 2020 at 12:28):

In an arbitrary category, you get a type arrow C containing all homs, or something like that

Markus Himmel (Jul 27 2020 at 13:41):

@Scott Morrison @Johan Commelin there's a sorry-free proof of abelian (Module R) at https://github.com/leanprover-community/mathlib/commit/0f08541d770094c3e88ce1b45d6928c1defebafc. Some parts can certainly be cleaned up, but I'm done for today and will return to this tomorrow.

Scott Morrison (Jul 27 2020 at 14:26):

Excellent, thank you! This will be a real milestone, our first abelian category. :-)

Kevin Buzzard (Jul 27 2020 at 14:39):

How come you didn't get a bunch of grief about no abelian categories and end up showing that the trivial category is abelian?? That happened for us with perfectoid spaces :-)

Johan Commelin (Jul 27 2020 at 14:50):

lemma singular_chain_complex_d_one_of_unique [subsingleton X] :
  ((singular_chain_complex R).obj X).d 1 = 0 :=

This means that if X is a topological space with at most 1 element, then the first differential d 1 of the singular chain complex of X with coefficients in a ring R is... the zero morphism.

Johan Commelin (Jul 27 2020 at 14:50):

Lean agrees that this is true.


Last updated: Dec 20 2023 at 11:08 UTC