feat(SymbolicDynamics): basic setup of Zd, full shift, cylinders, pat…#28546
feat(SymbolicDynamics): basic setup of Zd, full shift, cylinders, pat…#28546Sfgangloff wants to merge 99 commits intoleanprover-community:masterfrom
Conversation
PR summary c63c4e5c93Import changes for modified filesNo significant changes to the import graph Import changes for all files
|
|
It's probably not a good idea to do this over |
Thank you for the advice ! I did not want to do it in full generality at first, but indeed d=1 is an important case. I'll try revamp this for groups in general. |
sgouezel
left a comment
There was a problem hiding this comment.
Thanks for your PR! I have mostly made form comments in my review, to show you how your code should be formatted for mathlib. Could you try to use there rules also for the rest of the PR?
Also, reviewing long PRs like this one is quite complicated. Could you maybe split it, postponing the entropy part to another PR, to make sure that we can get your PR in quicker? Thanks!
Thanks a lot for your review! I’ll go through your formatting comments carefully and apply the rules consistently across the PR. I’ll also split off the entropy part into a separate PR, so that this one is easier to review. |
@sgouezel I have implemented all requested changes. Ready for re-review—thanks! |
|
Thanks! |
|
I have a design question here. Everything is defined for the full shift, but most shifts of interest are not the full shift but rather subshifts (e.g. subshifts of finite type, low complexity subshifts, and so on). This means that you will need to redefine all your notions for subshifts, which is not desirable from the point of view of code duplication. I wonder if it would be better to have a design talking only of subshifts, where the full shift would be the subshift on Do you think it would work, or do you see issues with this design which would warrant developing things specifically for the full shift? |
Thanks for the suggestion! I agree most objects of interest are subshifts. My plan is to keep the definitions/lemmas in the ambient full shift and use them on a subshift simply by restriction (viewing a subshift Y as a subtype of G → A). In practice this means most lemmas apply directly without re-proving them. When it is helpful for ergonomics, I can add tiny wrappers (not new theory): e.g. the shift restricted to Y, and “cylinders/occurrence inside Y” defined as the set of points of Y whose underlying function lies in the ambient set. That’s just making the restriction explicit, not duplicating proofs. If you prefer, I can include those small wrappers in this PR; otherwise I’ll keep using the ambient results by restriction. |
|
My question is mainly for the map itself: if you have a subset |
|
There are some linting errors, but certainly not related to your PR. Could you merge master to fix them? |
Done |
Thanks for clarifying! I see your point: if one defines cylinders and the shift only “inside a subshift,” then one gets nice ergonomics locally, but there is overhead whenever combining or comparing different subshifts. For example, suppose I want to prove that In the current design, all definitions (shift, cylinder, occurrence, language, …) live in the ambient full shift, and a subshift is just a closed, invariant subset. Then for a subshift Y I can view its language as languageOn Y.carrier U and results like the union lemma become immediate. When needed for ergonomics, I can certainly add thin wrappers (e.g. “language of a subshift on U”), but they would just unfold to the ambient versions. So I think your concern is exactly the tradeoff: restricting everything to subshifts makes the local API slightly nicer but the global manipulations harder. Keeping things ambient keeps the global operations trivial, and I expect most interesting theory (SFTs, complexity, entropy, …) will want to combine subshifts. I don’t yet have a long worked-out example, but even at this basic stage you can already see the pattern with unions. If you’d like, I can include some of these wrapper lemmas in the PR so that the ergonomics for subshifts are visible right away. |
|
I see your point. I think it's just a difference of background: from my point of view, I work a lot inside a fixed subshift (to study entropy, transfer operators, thermodynamic formalism, and so on), but I essentially never work in the space of subshifts (i.e., I'll never take the union of two subshifts). Since you are the one doing the PR, we should go with your point of view. Could you please explain this design motivation in the file-level docstring? Also, it might be a good idea to namespace everything, to make sure that if we want to define cylinders with the inner point of view we don't get a clash. |
Thanks for the feedback! I have updated the file accordingly:
|
|
Once you're happy, can you remove the awaiting-author tag? Otherwise, the PR does not appear in the queue, so I'm very likely to forget it! |
@sgouezel I don’t seem to have permission to remove the awaiting-author tag (maybe because I’m marked as a new contributor ?). The PR is ready for another review though. |
|
You need to post a message with |
sgouezel
left a comment
There was a problem hiding this comment.
I'm really sorry for the delay, all my apologies. It's a little bit complicated to review a PR like this one, mostly made of definitions, because one can not really see why the definitions are relevant, and if some could be skipped or not -- for instance, you define dominoes but you don't use them yet. I'm sure the applications come later down the road, of course.
I'll try to get the PR inside Mathlib in the near future with your help. But for future development I think it will be more efficient if you build a project downstream of Mathlib, and prove there deep theorems that matter to you. Because proving theorems is what helps get good definitions through refactors imposed by the proofs, and also once you have this you can show off and explain why your work should get into Mathlib.
In any case, I hope that the discussions we had together helped to show you what kind of design choices are important when doing formalization and what style conventions we have, and I hope all these can be put to good use in your project. If you encounter other design questions, don't hesitate to bug me with them on Zulip!
Thanks a lot for the feedback, and no worries at all for the delay! |
|
-awaiting-author |
|
Only minor comments left, thanks! Please don't forget to close the discussions in which you considered you've given a satisfactory answer: it makes it possible to focus on the remaining issues. |
Co-authored-by: Sebastien Gouezel <sebastien.gouezel@univ-rennes1.fr>
|
-awaiting-author |
| This is the set of all finite patterns obtained by restricting some configuration | ||
| `x ∈ X` to `U`. -/ | ||
| @[to_additive languageOn] | ||
| def mulLanguageOn (X : Set (G → A)) (U : Finset G) : Set (Pattern A G) := |
There was a problem hiding this comment.
Maybe drop the mul in the definition, then.
…of isClosed_mulForbidden proof
|
-awaiting-author |
This PR adds a group-generic foundation for symbolic dynamics over an arbitrary group
G, together with convenient specializations forℤandℤ^d.Summary of additions:
Full shift and shift action
abbrev FullShift (A G) := G → A(inherits product topology from the Π-type).shift g xwith convention(shift g x) h = x (h * g).Cylinders and topology
cylinder U x : Set (G → A)for finiteU : Finset G.[DiscreteTopology A]; with a finite alphabet they are also closed.cylinder U x = Set.pi (↑U) (fun i => ({x i} : Set A)), enabling use of theSet.piAPI.Patterns, occurrences, and subshifts
Pattern A Gwith finitesupport : Finset Ganddata : support → A.Pattern.occursIn p x g(occurrence at translateg) and the expected shift law.forbids FandSubshift A G(closed, shift-invariant subsets).FixedSupport A G Uwith an equivalence to(U → A)to obtain finiteness.Language on finite shapes and counting
languageOn X U,languageCardOn X U, andpatternCountOn Y U.Entropy along a shape sequence
limsupAtTop(as ansInfof eventual upper bounds).entropyAlong X F hF := limsup (log (patternCountOn X (F n) + 1) / |F n|)for any nonempty finite shapes
F : ℕ → Finset G(the+ 1avoidslog 0).Specializations
IntShapes: segments[-n,n]onMultiplicative ℤ, withentropy_Z.ZdShapes: boxes[-n,n]^donℤ^d(as functionsFin d → ℤ), withentropy_Zd.Mathematical remarks:
This PR does not assume amenability; the family of shapes is an explicit input.
Motivation:
Provide a clean, reusable base for symbolic dynamics on groups in mathlib.
Future work:
ℤ/ℤ^dtoolkit (alternative shapes, mixing, factors).