Opened 4 years ago

Closed 4 years ago

#19179 closed enhancement (fixed)

Chain homotopies

Reported by: jhpalmieri Owned by:
Priority: major Milestone: sage-6.10
Component: algebraic topology Keywords: homotopy
Cc: tscrim, chapoton Merged in:
Authors: John Palmieri Reviewers: Frédéric Chapoton
Report Upstream: N/A Work issues:
Branch: 4d53526 (Commits) Commit: 4d535262d98811febb3fa6ed1756b1987ef7ac22
Dependencies: Stopgaps:

Description

This ticket add chain homotopies, chain contractions, and duals of chain maps and chain homotopies. This is a dependency for #6101 and #6102.

Change History (22)

comment:1 Changed 4 years ago by jhpalmieri

  • Branch set to u/jhpalmieri/chains

comment:2 Changed 4 years ago by jhpalmieri

  • Cc tscrim chapoton added
  • Commit set to dece275cac5a229f9365fad4c8b5404c6a7ebe6b
  • Status changed from new to needs_review

New commits:

dece275trac 19179: chain homotopies, chain contractions, and duals of chain maps

comment:3 Changed 4 years ago by git

  • Commit changed from dece275cac5a229f9365fad4c8b5404c6a7ebe6b to d7b9ed4072c3d96edf1ab67c7e61f19bff91b0b7

Branch pushed to git repo; I updated commit sha1. New commits:

d7b9ed4change AssertionError to other errors

comment:4 Changed 4 years ago by jhpalmieri

  • Dependencies set to #6102

It's too messy for me to disentangle this from #6102, so that ticket and this are now dependencies of each other. In particular, the most natural way to construct examples of chain contractions is to use the algebraic topological model of a complex (which is part of #6102). So some of the examples here use code that is part of #6102. The actual code here doesn't depend on #6102, just those few examples.

Last edited 4 years ago by jhpalmieri (previous) (diff)

comment:5 Changed 4 years ago by git

  • Commit changed from d7b9ed4072c3d96edf1ab67c7e61f19bff91b0b7 to d65ba8d4471ed0e64543a989f0d08c9e2fd02d40

Branch pushed to git repo; I updated commit sha1. New commits:

d65ba8dtrac 19179: change _repr_ for chain maps, chain homotopies

comment:6 Changed 4 years ago by git

  • Commit changed from d65ba8d4471ed0e64543a989f0d08c9e2fd02d40 to f70e3a28db358383ee6f542b490963868ce9550f

Branch pushed to git repo; I updated commit sha1. New commits:

f70e3a2trac 19179: doctest fixes for _repr_ changes

comment:7 Changed 4 years ago by git

  • Commit changed from f70e3a28db358383ee6f542b490963868ce9550f to 4e507769605e20213ea92e64bd73cbb7b1d0195b

Branch pushed to git repo; I updated commit sha1. New commits:

4e50776trac 19179: hashing of chain maps, chain homotopies

comment:8 Changed 4 years ago by jhpalmieri

#18246 broke the default hashing of chain homotopies, so I've added a __hash__ method, and also one for chain maps.

comment:9 Changed 4 years ago by chapoton

This looks strange, in chain_complex_morphism.py:

+        self._matrix_dictionary = {}
+        for i in matrices:
+            m = matrices[i]
+            # Use immutable matrices because they're hashable.
+            m.set_immutable()
+            self._matrix_dictionary[i] = m
         self._matrix_dictionary = matrices

Should the last line be removed ?

comment:10 Changed 4 years ago by jhpalmieri

Yes, thank you.

comment:11 Changed 4 years ago by git

  • Commit changed from 4e507769605e20213ea92e64bd73cbb7b1d0195b to 07c9c4258f68999ecf4e2659890a3385c8f8aa0e

Branch pushed to git repo; I updated commit sha1. New commits:

07c9c42trac 19179: delete extra line

comment:12 Changed 4 years ago by cnassau

I've been playing around with this for the last week and I'm essentially ready to give the ticket a positive review. I can think of a couple of very minor improvements that might be better addressed in a follow-up ticket:

  • add syntactic sugar to replace H._g with something like H[1], or H.endpoint(1) or whatever
  • create a parent for chain homotopies so that linear combinations can be taken easily

I encountered one more serious surprise in my experiments, and I'm not quite sure how to address this: I was starting with a chain complex C over the integers, and I wanted to work with its reduction modulo 2. The code that I came up with actually messed up the original complex:

sage: d1 = matrix([[-1,1,0],[1,-1,0],[-1,0,1],[1,0,-1]]).transpose()
sage: d2 = matrix([[-1,-1,+1,+1],[1,1,1,1]]).transpose()
sage: C=ChainComplex({2:d2,1:d1},degree_of_differential=-1,base_ring=ZZ)
sage: ascii_art(C)
                                [-1  1]      
            [-1  1 -1  1]       [-1  1]      
            [ 1 -1  0  0]       [ 1  1]      
            [ 0  0  1 -1]       [ 1  1]      
 0 <-- C_0 <-------------- C_1 <-------- C_2 <-- 0 
sage: D=ChainComplex(C._diff,degree_of_differential=C.degree_of_differential(),base_ring=GF(2))
sage: ascii_art(C)
                            [1 1]      
            [1 1 1 1]       [1 1]      
            [1 1 0 0]       [1 1]      
            [0 0 1 1]       [1 1]      
 0 <-- C_0 <---------- C_1 <------ C_2 <-- 0 

I would have expected an error here, and possibly a more convenient way to carry out the base change.

As for the patchbot errors: these are a bit confusing; I think they're all due to the fact that the dependencies of the ticket have not been properly merged for the test. Given the dependencies with #6101, #6102 I wonder if it isn't the best approach to approve them all at once, eventually.... (?)

comment:13 Changed 4 years ago by jhpalmieri

With your example, using D = Chain Complex(C.differential(), ...) works better than with C._diff, because C.differential() returns a copy of the defining data, and so modifying it won't change C. It can be dangerous using hidden attributes, and the corresponding methods ought to be safer.

If you are willing to give this a positive review, then #6101 should come next, but neither will get merged without the other.

comment:14 follow-up: Changed 4 years ago by chapoton

  • Keywords homotopy added
  • Status changed from needs_review to needs_work

a few remarks on the doc:

  • please remove the dot at the end of the title line of the new file.
  • Please remove the \circ in H \circ H at several places where it appears (or, if you really prefer, put such a composition symbol everywhere else), for coherence with other compositions.
  • What happens in chain homotopy if the given g is None ? This should be explained in the doc.
  • The def of "dual" of chain homotopy class should start with r"""
  • In dual for chain contraction, skip one line after the first sentence

comment:15 Changed 4 years ago by git

  • Commit changed from 07c9c4258f68999ecf4e2659890a3385c8f8aa0e to 4d535262d98811febb3fa6ed1756b1987ef7ac22

Branch pushed to git repo; I updated commit sha1. New commits:

4d53526trac 19179: minor doc fixes

comment:16 in reply to: ↑ 14 Changed 4 years ago by jhpalmieri

  • Status changed from needs_work to needs_review

Replying to chapoton:

a few remarks on the doc:

  • please remove the dot at the end of the title line of the new file.

Done

  • Please remove the \circ in H \circ H at several places where it appears (or, if you really prefer, put such a composition symbol everywhere else), for coherence with other compositions.

Done (removed \circ)

  • What happens in chain homotopy if the given g is None ? This should be explained in the doc.

This was already there, but I added a sentence.

  • The def of "dual" of chain homotopy class should start with r"""

Right, fixed.

  • In dual for chain contraction, skip one line after the first sentence

Done.

comment:17 Changed 4 years ago by chapoton

  • Reviewers set to Frédéric Chapoton
  • Status changed from needs_review to positive_review

ok, thanks. Then good to go. It will of course be pending until #6102 is reviewed.

comment:18 Changed 4 years ago by chapoton

  • Milestone changed from sage-6.9 to sage-pending

comment:19 Changed 4 years ago by tscrim

  • Milestone changed from sage-pending to sage-6.10

comment:20 Changed 4 years ago by vbraun

Circular dependency, please make up your mind what you want merged first

comment:21 Changed 4 years ago by chapoton

  • Dependencies #6102 deleted

This one first please, but it will not pass the doctests alone.

comment:22 Changed 4 years ago by vbraun

  • Branch changed from u/jhpalmieri/chains to 4d535262d98811febb3fa6ed1756b1987ef7ac22
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.