Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(algebra/homology): redesign of homological complexes #7473

Closed
wants to merge 29 commits into from

Conversation

semorrison
Copy link
Collaborator

@semorrison semorrison commented May 4, 2021

This is a complete redesign of our library on homological complexes and homology.

This PR replaces the current definition of chain_complex which had proved cumbersome to work with.

The fundamental change is that chain complexes are now indexed by a type equipped with a complex_shape, rather than by a monoid. A complex_shape ι contains a relation r, with the intent that we will only allow a differential X i ⟶ X j when r i j. This allows, for example, complexes indexed either by nat or int, with differentials going either up or down.

We set up the initial theory without referring to "successors" and "predecessors" in the type ι, to ensure we can avoid dependent type theory hell issues involving arithmetic in the index of a chain group. We achieve this by having a chain complex consist of morphisms d i j : X i ⟶ X j for all i j, but with an additional axiom saying this map is zero unless r i j. This means we can easily talk about, e.g., morphisms from X (i - 1 + 1) to X (i + 1) when we need to.

However after not too long we also set up option valued next and prev functions which make an arbitrary choice of such successors and predecessors if they exist. Using these, we define morphisms d_to j, which lands in X j, and has source either X i for some r i j, or the zero object if these isn't such an i. These morphisms are very convenient when working "at the edge of a complex", e.g. when indexing by nat.


Open in Gitpod

@semorrison
Copy link
Collaborator Author

Deprecates #7375. This only has part of the content from that PR, but extensively updated. The remainder of that content, and much more, is coming in subsequent PRs!

Co-authored-by: Johan Commelin <johan@commelin.net>
@github-actions github-actions bot added the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label May 4, 2021
@github-actions github-actions bot removed the blocked-by-other-PR This PR depends on another PR which is still in the queue. A bot manages this label via PR comment. label May 7, 2021
@github-actions
Copy link

github-actions bot commented May 7, 2021

Copy link
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this massive refactor!

src/algebra/homology/complex_shape.lean Outdated Show resolved Hide resolved
src/algebra/homology/complex_shape.lean Outdated Show resolved Hide resolved
src/algebra/homology/complex_shape.lean Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Show resolved Hide resolved
src/algebra/homology/exact.lean Outdated Show resolved Hide resolved
Copy link
Collaborator

@adamtopaz adamtopaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments for now, but I'll try to come back to this in the next couple of days.

src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved

variables (X₀ X₁ X₂ : V) (d₀ : X₁ ⟶ X₀) (d₁ : X₂ ⟶ X₁) (s : d₁ ≫ d₀ = 0)
(succ : Π (t : Σ' (X₀ X₁ X₂ : V) (d₀ : X₁ ⟶ X₀) (d₁ : X₂ ⟶ X₁), d₁ ≫ d₀ = 0),
Σ' (X₃ : V) (d₂ : X₃ ⟶ t.2.2.1), d₂ ≫ t.2.2.2.2.1 = 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This t.2.2.2.2.1 makes me think it might be better to just use mk_struct instead of the flat version. Is there any benefit to using a sigma type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamtopaz I don't have sufficient overview, but I feel like Scott need sigma types heavily for construction projective resolutions etc...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want mk_struct to become part of the public API, but rather to stay hidden as an implementation detail of chain_complex.mk.

src/algebra/homology/homological_complex.lean Show resolved Hide resolved
@bryangingechen bryangingechen added the awaiting-review The author would like community review of the PR label May 10, 2021
Copy link
Collaborator

@adamtopaz adamtopaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more minor comments, but otherwise LGTM!

src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homological_complex.lean Outdated Show resolved Hide resolved
src/algebra/homology/homology.lean Outdated Show resolved Hide resolved
src/algebra/homology/homology.lean Outdated Show resolved Hide resolved
src/category_theory/abelian/exact.lean Show resolved Hide resolved
@jcommelin
Copy link
Member

Thanks 🎉

bors merge

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels May 11, 2021
bors bot pushed a commit that referenced this pull request May 11, 2021
This is a complete redesign of our library on homological complexes and homology.

This PR replaces the current definition of `chain_complex` which had proved cumbersome to work with.

The fundamental change is that chain complexes are now indexed by a type equipped with a `complex_shape`, rather than by a monoid. A `complex_shape ι` contains a relation `r`, with the intent that we will only allow a differential `X i ⟶ X j` when `r i j`. This allows, for example, complexes indexed either by `nat` or `int`, with differentials going either up or down.

We set up the initial theory without referring to "successors" and "predecessors" in the type `ι`, to ensure we can avoid dependent type theory hell issues involving arithmetic in the index of a chain group. We achieve this by having a chain complex consist of morphisms `d i j : X i ⟶ X j` for all `i j`, but with an additional axiom saying this map is zero unless `r i j`. This means we can easily talk about, e.g., morphisms from `X (i - 1 + 1)` to `X (i + 1)` when we need to.

However after not too long we also set up `option` valued `next` and `prev` functions which make an arbitrary choice of such successors and predecessors if they exist. Using these, we define morphisms `d_to j`, which lands in `X j`, and has source either `X i` for some `r i j`, or the zero object if these isn't such an `i`. These morphisms are very convenient when working "at the edge of a complex", e.g. when indexing by `nat`.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Johan Commelin <johan@commelin.net>
@bors
Copy link

bors bot commented May 11, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(algebra/homology): redesign of homological complexes [Merged by Bors] - feat(algebra/homology): redesign of homological complexes May 11, 2021
@bors bors bot closed this May 11, 2021
@bors bors bot deleted the homology_redesign branch May 11, 2021 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants