Skip to content

feat(Algebra/Homology): add Euler characteristic definition for chain complexes#29646

Closed
jessealama wants to merge 1 commit intoleanprover-community:masterfrom
jessealama:feat/chain-complex-euler-char
Closed

feat(Algebra/Homology): add Euler characteristic definition for chain complexes#29646
jessealama wants to merge 1 commit intoleanprover-community:masterfrom
jessealama:feat/chain-complex-euler-char

Conversation

@jessealama
Copy link
Copy Markdown
Contributor

This PR adds a definition of the Euler characteristic for chain complexes.

The definition computes the Euler characteristic up to index n as the alternating sum ∑_{k=0}^n (-1)^k rank(C_k). It works over any ring R (using Module.finrank).

I'm interested in feedback on whether this is the right level of generality and whether the parameterization by index n is the preferred approach. This definition is extracted from work on PR #29639 (Euler's polyhedron formula).

This is a minimal PR containing only the definition - I thought it might be useful to discuss the design before adding lemmas and theorems.

@github-actions github-actions bot added new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc) large-import Automatically added label for PRs with a significant increase in transitive imports labels Sep 14, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 14, 2025

PR summary 82ba83d8bc

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Algebra.Homology.EulerCharacteristic (new file) 1249

Declarations diff

+ boundedEulerChar
+ eulerChar
+ eulerChar_eq_boundedEulerChar
+ eulerChar_succ
+ eulerChar_zero

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch from 497d89e to 53df353 Compare September 14, 2025 19:32
@github-actions github-actions bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label Sep 14, 2025
@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch from 53df353 to e7701ae Compare September 14, 2025 19:35
@github-actions github-actions bot added the large-import Automatically added label for PRs with a significant increase in transitive imports label Sep 14, 2025
@github-actions github-actions bot removed the large-import Automatically added label for PRs with a significant increase in transitive imports label Sep 14, 2025
@jessealama jessealama requested a review from joelriou September 14, 2025 21:18
@jessealama
Copy link
Copy Markdown
Contributor Author

I'm not quite sure what the build error is saying. Things seem to be clean, but there's an unexplained failure at the Check {Mathlib, Tactic, Counterexamples, Archive}.lean step.

@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch 2 times, most recently from 07894ac to 344a309 Compare September 14, 2025 22:00
@jessealama
Copy link
Copy Markdown
Contributor Author

I'm not quite sure what the build error is saying. Things seem to be clean, but there's an unexplained failure at the Check {Mathlib, Tactic, Counterexamples, Archive}.lean step.

Ah, I found the error. I needed to run lake exe mk_all. The build ought to be clean now.

@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch 3 times, most recently from 083b947 to ccbcb5e Compare September 14, 2025 22:30
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 15, 2025
- Rename eulerChar to boundedEulerChar for finite sums (0 to n-1)
- Add new eulerChar as infinite sum over all naturals
- Add boundedEulerChar_zero lemma for empty sum case
- Add boundedEulerChar_succ lemma for induction step
- Add theorem stating equivalence when modules eventually vanish (with sorry)

Based on feedback from PR leanprover-community#29646
@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch from 43187d5 to 18e36b1 Compare September 15, 2025 07:35
Thanks @joelriou for suggesting a number of improvements!

This introduces the Euler characteristic for chain complexes:
- `boundedEulerChar`: The finite alternating sum ∑_{k=0}^{n-1} (-1)^k rank(C_k)
- `eulerChar`: The infinite alternating sum ∑_{k=0}^∞ (-1)^k rank(C_k) using tsum

Key lemmas:
- `eulerChar_zero`: The bounded characteristic at 0 is 0 (empty sum)
- `eulerChar_succ`: Recursive formula for the bounded characteristic
- `eulerChar_eq_boundedEulerChar`: The two definitions agree when the complex eventually vanishes

Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr>
@jessealama jessealama force-pushed the feat/chain-complex-euler-char branch from 18e36b1 to 76f9bd8 Compare September 15, 2025 08:26
@jessealama jessealama requested a review from joelriou September 15, 2025 08:42
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
This PR adds the Euler-Poincaré formula for bounded chain complexes of finite-dimensional vector spaces over a field, following feedback from @joelriou in leanprover-community#29639.

The main result states that for a bounded complex C that vanishes after position n:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This builds upon the Euler characteristic definitions from leanprover-community#29646.

Key additions:
- Basic lemmas about chain complex differentials at boundaries (dFrom 0, dTo n)
- Relationship between dTo/dFrom and the underlying differentials
- General telescoping lemma for alternating sums
- The rank-nullity decomposition for chain complexes
- The main Euler-Poincaré theorem

Thanks to @joelriou for the valuable feedback that guided this implementation.

Co-authored-by: joelriou <joelriou@users.noreply.github.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Adopt the exact EulerCharacteristic.lean file from PR leanprover-community#29646
to maintain consistency. This file defines the Euler characteristic
of chain complexes with both bounded and infinite sum versions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the homological Euler characteristic definition needed for
the Euler-Poincaré formula. This matches the structure from PR leanprover-community#29646
while including the necessary definitions for our proof.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
Add the Euler-Poincaré formula proving that for bounded complexes of
finite-dimensional vector spaces, the alternating sum of dimensions
equals the alternating sum of homology dimensions.

This PR adds:
- `EulerCharacteristic.lean`: Defines Euler characteristic for chain complexes
  (adopted from PR leanprover-community#29646)
- `EulerPoincare.lean`: Proves the Euler-Poincaré formula
- Helper lemmas in `HomologicalComplex.lean` for bounded complexes

The main theorem shows that for a bounded complex C of finite-dimensional
vector spaces over a field k, if C vanishes after position n, then:
∑_{i=0}^n (-1)^i dim(C_i) = ∑_{i=0}^n (-1)^i dim(H_i)

This is a key result in algebraic topology and will be used as the
foundation for proving Euler's polyhedron formula (Wiedijk leanprover-community#13).

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Move chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean
- Keep HomologicalComplex.lean unchanged

This prepares for the Euler-Poincaré formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Prove boundedEulerChar_eq_homologyBoundedEulerChar theorem (Euler-Poincaré formula)
- Add chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean

This prepares for the Euler polyhedron formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Prove boundedEulerChar_eq_homologyBoundedEulerChar theorem (Euler-Poincaré formula)
- Add chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean

This prepares for the Euler polyhedron formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Prove boundedEulerChar_eq_homologyBoundedEulerChar theorem (Euler-Poincaré formula)
- Add chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean

This prepares for the Euler polyhedron formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 16, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Prove boundedEulerChar_eq_homologyBoundedEulerChar theorem (Euler-Poincaré formula)
- Add chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean for both EulerCharacteristic and EulerPoincare

This prepares for the Euler polyhedron formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
jessealama added a commit to jessealama/mathlib4 that referenced this pull request Sep 17, 2025
- Add new file Mathlib/Algebra/Homology/EulerCharacteristic.lean with:
  * boundedEulerChar: bounded Euler characteristic up to index n
  * eulerChar: infinite sum Euler characteristic
  * homologyBoundedEulerChar: homological Euler characteristic
- Prove boundedEulerChar_eq_homologyBoundedEulerChar theorem (Euler-Poincaré formula)
- Add chain complex helper lemmas to EulerPoincare.lean
- Add import to Mathlib.lean for both EulerCharacteristic and EulerPoincare

This prepares for the Euler polyhedron formula by defining the Euler
characteristic following the approach in PR leanprover-community#29646.
@jessealama
Copy link
Copy Markdown
Contributor Author

Definitions generalized and moved to #29713

@jessealama jessealama closed this Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants