Add MultiIndex API for local field-theory foundations#1021
Add MultiIndex API for local field-theory foundations#1021jstoobysmith merged 3 commits intoleanprover-community:masterfrom
Conversation
| -/ | ||
|
|
||
| /-- A multi-index on `n` source coordinates. -/ | ||
| abbrev MultiIndex (n : ℕ) := Fin n → ℕ |
There was a problem hiding this comment.
I personally would make this an structure with a single field corresponding to Fin n -> Fin d where d is the dimension. Using a structure initially will make things more difficult, as you have to define instances on it for e.g. Add, but, it gives you much more flexibility. Everytime I haven't used a structure initially I have gone on to regret it.
|
Thanks — both comments made sense to me. I have now reworked this locally so that:
I will push that update to the PR branch next. |
|
We renamed ./PhysLean to ./Physlib which is why there is a merge conflict on this PR now. If you could fix it, that would be great, but if you need help feel free to let me know. |
0f873ac to
5e2d986
Compare
|
I have now updated the PR branch to the current Concretely:
So this one should be back in a sane state now. |
|
|
||
| namespace MultiIndex | ||
|
|
||
| variable {n : ℕ} |
There was a problem hiding this comment.
mentioned above, but could we replace n here with d since it is meant to be the dimension of Space.
There was a problem hiding this comment.
Good point — I have now changed this to d in the MultiIndex API so that it matches the ambient space-dimension convention more closely.
jstoobysmith
left a comment
There was a problem hiding this comment.
Great! Many thanks! This now looks good to me. I've approved this PR, but you might have to take it out of "draft" mode.
|
Thanks - I will merge shortly :). |
|
Many thanks! I'll move on to the next one tomorrow:
|
|
Great! Looking forward to it! |
Summary
This PR is the first step in a planned local Classical Field Theory development for PhysLib, aimed at a formalization of the local Euler--Lagrange criterion appearing as Theorem 5.2 in Cortés--Haupt, Chapter 5.
The overall local stack is intended to proceed through:
The Zulip discussion for this development is here:
This first PR only introduces the reusable
MultiIndexAPI needed later to index jet coordinates and iterated derivatives.What This PR Adds
This PR adds PhysLean/Mathematics/DataStructures/MultiIndex.lean, with a small API for finitely supported multi-indices on
Fin n.Concretely, it provides:
MultiIndex n := Fin n → ℕ,|I| = Σ_i I_i,Why This Is Needed
Later PRs will use multi-indices to write the local jet coordinates
u^a_Iand iterated derivatives
∂^I = ∂_1^{I_1} ... ∂_n^{I_n}.They also appear in the local Euler--Lagrange expression
E_a(L) = Σ_{|I| ≤ k} (-D)^I (∂L / ∂u^a_I).So even though this first PR is small and purely reusable, it is the indexing layer that the rest of the local field-theory stack will build on.
Design Notes
I have placed this in
Mathematics.DataStructuresrather than underClassicalFieldTheory, since it is meant to be reusable outside the field-theory namespace as well. That follows the earlier Zulip suggestion to keep the reusable pieces out of the domain-specific layer where possible.Build
Locally checked with:
python3 scripts/lint-style.py PhysLean/Mathematics/DataStructures/MultiIndex.leanlake build PhysLean.Mathematics.DataStructures.MultiIndexlake build PhysLean