Skip to content

feat(LinearAlgebra/Basis/HasCanonicalBasis): propose HasCanonicalBasis class#25425

Closed
Paul-Lez wants to merge 4 commits into
masterfrom
chosen-basis
Closed

feat(LinearAlgebra/Basis/HasCanonicalBasis): propose HasCanonicalBasis class#25425
Paul-Lez wants to merge 4 commits into
masterfrom
chosen-basis

Conversation

@Paul-Lez
Copy link
Copy Markdown
Collaborator

@Paul-Lez Paul-Lez commented Jun 4, 2025

Context: in some cases, e.g. writing down PDEs, having a notion of partial derivatives can be useful. In an ideal world (as mentioned by @ocfnash in this Zulip thread), one could write something along the lines of open scoped PartialDerivatives in order to access nice notation for this.

This PR introduces a notion of a canonical basis for a module in order to allow taking partial derivatives with respect to it.
A later PR (which I am about open) would then propose a notation for taking partial derivatives (defined using lineDeriv in order to avoid requiring Frechet-differentiability assumptions). The goal here is to have notation that works equally well on e.g. 𝕜 × 𝕜 and EuclideanSpace 𝕜 (Fin 2) and so on.

I've opened this PR as a draft in order to get some initial feedback on the content (and whether this is considered appropriate for Mathlib!); the file itself would need to be split (e.g. the instances defined should probably go in different files)

Co-authored-by: Eric Wieser efw@google.com


Open in Gitpod

Paul-Lez and others added 4 commits June 4, 2025 10:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2025

PR summary c6a8ffddfe

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.LinearAlgebra.Basis.HasCanonicalBasis (new file) 1975

Declarations diff

+ EuclideanSpace.hasCanonicalBasis
+ HasCanonicalBasis
+ Pi.hasCanonicalBasis
+ basis_apply
+ instance : HasCanonicalBasis 𝕜 (𝕜 × 𝕜 × 𝕜) (Fin 3)
+ instance : HasCanonicalBasis 𝕜 (𝕜 × 𝕜) (Fin 2) (![(1, 0), (0, 1)])
+ instance : HasCanonicalBasis 𝕜 𝕜 (Fin 1) (fun _ ↦ 1)
+ instance [Ring 𝕜] (p : ENNReal) :
+ prod
+ reindex

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).

@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 23, 2025
@leanprover-community-bot-assistant
Copy link
Copy Markdown
Collaborator

This pull request has conflicts, please merge master and resolve them.

@Paul-Lez
Copy link
Copy Markdown
Collaborator Author

This PR has been migrated to a fork-based workflow: #39253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) migrated-to-fork t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants