Opened 7 years ago
Closed 7 years ago
#19179 closed enhancement (fixed)
Chain homotopies
Reported by:  John Palmieri  Owned by:  

Priority:  major  Milestone:  sage6.10 
Component:  algebraic topology  Keywords:  homotopy 
Cc:  Travis Scrimshaw, Frédéric Chapoton  Merged in:  
Authors:  John Palmieri  Reviewers:  Frédéric Chapoton 
Report Upstream:  N/A  Work issues:  
Branch:  4d53526 (Commits, GitHub, GitLab)  Commit:  4d535262d98811febb3fa6ed1756b1987ef7ac22 
Dependencies:  Stopgaps: 
Change History (22)
comment:1 Changed 7 years ago by
Branch:  → u/jhpalmieri/chains 

comment:2 Changed 7 years ago by
Cc:  Travis Scrimshaw Frédéric Chapoton added 

Commit:  → dece275cac5a229f9365fad4c8b5404c6a7ebe6b 
Status:  new → needs_review 
comment:3 Changed 7 years ago by
Commit:  dece275cac5a229f9365fad4c8b5404c6a7ebe6b → d7b9ed4072c3d96edf1ab67c7e61f19bff91b0b7 

Branch pushed to git repo; I updated commit sha1. New commits:
d7b9ed4  change AssertionError to other errors

comment:4 Changed 7 years ago by
Dependencies:  → #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.
comment:5 Changed 7 years ago by
Commit:  d7b9ed4072c3d96edf1ab67c7e61f19bff91b0b7 → d65ba8d4471ed0e64543a989f0d08c9e2fd02d40 

Branch pushed to git repo; I updated commit sha1. New commits:
d65ba8d  trac 19179: change _repr_ for chain maps, chain homotopies

comment:6 Changed 7 years ago by
Commit:  d65ba8d4471ed0e64543a989f0d08c9e2fd02d40 → f70e3a28db358383ee6f542b490963868ce9550f 

Branch pushed to git repo; I updated commit sha1. New commits:
f70e3a2  trac 19179: doctest fixes for _repr_ changes

comment:7 Changed 7 years ago by
Commit:  f70e3a28db358383ee6f542b490963868ce9550f → 4e507769605e20213ea92e64bd73cbb7b1d0195b 

Branch pushed to git repo; I updated commit sha1. New commits:
4e50776  trac 19179: hashing of chain maps, chain homotopies

comment:8 Changed 7 years ago by
#18246 broke the default hashing of chain homotopies, so I've added a __hash__
method, and also one for chain maps.
comment:9 Changed 7 years ago by
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:11 Changed 7 years ago by
Commit:  4e507769605e20213ea92e64bd73cbb7b1d0195b → 07c9c4258f68999ecf4e2659890a3385c8f8aa0e 

Branch pushed to git repo; I updated commit sha1. New commits:
07c9c42  trac 19179: delete extra line

comment:12 Changed 7 years ago by
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 followup ticket:
 add syntactic sugar to replace
H._g
with something likeH[1]
, orH.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 7 years ago by
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 followup: 16 Changed 7 years ago by
Keywords:  homotopy added 

Status:  needs_review → 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 7 years ago by
Commit:  07c9c4258f68999ecf4e2659890a3385c8f8aa0e → 4d535262d98811febb3fa6ed1756b1987ef7ac22 

Branch pushed to git repo; I updated commit sha1. New commits:
4d53526  trac 19179: minor doc fixes

comment:16 Changed 7 years ago by
Status:  needs_work → 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 7 years ago by
Reviewers:  → Frédéric Chapoton 

Status:  needs_review → positive_review 
ok, thanks. Then good to go. It will of course be pending until #6102 is reviewed.
comment:18 Changed 7 years ago by
Milestone:  sage6.9 → sagepending 

comment:19 Changed 7 years ago by
Milestone:  sagepending → sage6.10 

comment:20 Changed 7 years ago by
Circular dependency, please make up your mind what you want merged first
comment:21 Changed 7 years ago by
Dependencies:  #6102 

This one first please, but it will not pass the doctests alone.
comment:22 Changed 7 years ago by
Branch:  u/jhpalmieri/chains → 4d535262d98811febb3fa6ed1756b1987ef7ac22 

Resolution:  → fixed 
Status:  positive_review → closed 
New commits:
trac 19179: chain homotopies, chain contractions, and duals of chain maps