Skip to content

feat: add automorphisms of the infinite binary tree - #45521

Open
EzequielS2 wants to merge 7 commits into
leanprover-community:masterfrom
EzequielS2:aut-binary-tree
Open

EzequielS2 wants to merge 7 commits into
leanprover-community:masterfrom
EzequielS2:aut-binary-tree

Conversation

@EzequielS2

@EzequielS2 EzequielS2 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Add TreeAut as InfiniteRegularTree 2.


@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Oct 31, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to Zulip and join the Lean community.
Thank you again for joining our community.

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

PR summary 031350b41a

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Geometry.Group.InfiniteRegularTree (new file) 1023
Mathlib.Geometry.Group.InfiniteBinaryTree (new file) 1024

Declarations diff (regex)

+ InfiniteBinaryTree
+ InfiniteRegularTree
+ apply_cons
+ apply_cons_ne_nil
+ apply_cons_rootPerm
+ apply_singleton
+ apply_singleton_rootPerm
+ combineFun
+ combineFun_left_inv
+ combineHom
+ combineHom_apply
+ combineHom_compat
+ combine_cons
+ combine_mul
+ combine_one
+ combine₂
+ equivSemidirect_apply
+ equivSemidirect_symm_apply
+ firstLetter
+ firstLetter_symm
+ length_lt_of_prefix_ne
+ length_map_take_ge
+ map_isPrefix_iff
+ map_length
+ map_root
+ ofRootPermHom
+ ofRootPermHom_apply
+ ofRootPerm_cons
+ ofRootPerm_mul
+ ofRootPerm_mul_combine
+ ofRootPerm_one
+ ofRootPerm_root
+ permAction_apply
+ permMulAut
+ prefixRel
+ restrictFun
+ restrict_apply
+ restrict_combine
+ restrict_combine_mul_ofRootPerm
+ root
+ rootPerm_combine
+ rootPerm_combine_mul_ofRootPerm
+ rootPerm_eq_firstLetter
+ succ
+ swapRoot
++ TreeAut
++ combine
++ equivSemidirect
++ inv_eq_symm
++ ofRootPerm
++ permAction
++ restrict
++ rootPerm

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

✅ Lean-aware diff — post-build, computed from the Lean environment (commit 031350b).

  • +53 new declarations
  • −0 removed declarations
+InfiniteBinaryTree
+InfiniteBinaryTree.TreeAut
+InfiniteBinaryTree.TreeAut.combine
+InfiniteBinaryTree.TreeAut.combine₂
+InfiniteBinaryTree.TreeAut.equivSemidirect
+InfiniteBinaryTree.TreeAut.ofRootPerm
+InfiniteBinaryTree.TreeAut.permAction
+InfiniteBinaryTree.TreeAut.restrict
+InfiniteBinaryTree.TreeAut.rootPerm
+InfiniteBinaryTree.TreeAut.swapRoot
+InfiniteBinaryTree.prefixRel
+InfiniteBinaryTree.root
+InfiniteBinaryTree.succ
+InfiniteRegularTree
+InfiniteRegularTree.TreeAut
+InfiniteRegularTree.TreeAut.apply_cons_ne_nil
+InfiniteRegularTree.TreeAut.apply_cons_rootPerm
+InfiniteRegularTree.TreeAut.apply_singleton_rootPerm
+InfiniteRegularTree.TreeAut.combine
+InfiniteRegularTree.TreeAut.combineHom
+InfiniteRegularTree.TreeAut.combineHom_apply
+InfiniteRegularTree.TreeAut.combineHom_compat
+InfiniteRegularTree.TreeAut.combine_cons
+InfiniteRegularTree.TreeAut.combine_mul
+InfiniteRegularTree.TreeAut.combine_one
+InfiniteRegularTree.TreeAut.equivSemidirect
+InfiniteRegularTree.TreeAut.equivSemidirect_apply
+InfiniteRegularTree.TreeAut.equivSemidirect_symm_apply
+InfiniteRegularTree.TreeAut.inv_eq_symm
+InfiniteRegularTree.TreeAut.length_map_take_ge
+InfiniteRegularTree.TreeAut.map_isPrefix_iff
+InfiniteRegularTree.TreeAut.map_length
+InfiniteRegularTree.TreeAut.map_root
+InfiniteRegularTree.TreeAut.ofRootPerm
+InfiniteRegularTree.TreeAut.ofRootPermHom
+InfiniteRegularTree.TreeAut.ofRootPermHom_apply
+InfiniteRegularTree.TreeAut.ofRootPerm_cons
+InfiniteRegularTree.TreeAut.ofRootPerm_mul
+InfiniteRegularTree.TreeAut.ofRootPerm_mul_combine
+InfiniteRegularTree.TreeAut.ofRootPerm_one
+InfiniteRegularTree.TreeAut.ofRootPerm_root
+InfiniteRegularTree.TreeAut.permAction
+InfiniteRegularTree.TreeAut.permAction_apply
+InfiniteRegularTree.TreeAut.permMulAut
+InfiniteRegularTree.TreeAut.restrict
+InfiniteRegularTree.TreeAut.restrict_apply
+InfiniteRegularTree.TreeAut.restrict_combine
+InfiniteRegularTree.TreeAut.restrict_combine_mul_ofRootPerm
+InfiniteRegularTree.TreeAut.rootPerm
+InfiniteRegularTree.TreeAut.rootPerm_combine
+InfiniteRegularTree.TreeAut.rootPerm_combine_mul_ofRootPerm
+List.length_lt_of_prefix_ne
+RelIso.inv_eq_symm

Increase in strong tech debt: (relative, absolute) = (11.57, 0.09)
Current number Change Type (strong)
472 13 backward.privateInPublic
188 11 backward.privateInPublic.warn
Increase in weak tech debt: (relative, absolute) = (2.00, 0.00)
Current number Change Type (weak)
5154 2 exposed public sections

Current commit 031350b41a
Reference commit a906e4e0c0

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.py 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).

@EzequielS2

Copy link
Copy Markdown
Contributor Author
  1. Fin 2 vs Bool: Vertices are words on a 2-letter alphabet, so List Bool would also work. I kept List (Fin 2) because that alphabet is identified with ZMod 2/Fin 2 in the rest of the API: activity is Fin 2-valued, and the semidirect-product factor is Multiplicative (ZMod 2). With Bool we would keep translating between Bool and Fin 2/ZMod 2.

  2. left / right: Removed; the proofs now use list append / succ directly.

  3. length_*: Moved length_lt_of_prefix_ne, length_map_take_ge, and map_length to sit after the Group instance.

  4. phi: This is the usual φ for the homomorphism into the wreath product in Grigorchuk (with ψ for the stabilizer map), so I kept the name.

  5. activity: Same story: standard GGT / automata-group terminology for the child permutation at a vertex.

  6. zmod2_eq_zero_or_one: Removed from this file; the lemma is now ZMod.eq_zero_or_one in Mathlib/Data/ZMod/Basic.lean.

@tb65536 tb65536 added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 4, 2026
@EzequielS2

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 7, 2026
@vihdzp

vihdzp commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

I kept List (Fin 2) because that alphabet is identified with ZMod 2/Fin 2 in the rest of the API: activity is Fin 2-valued, and the semidirect-product factor is Multiplicative (ZMod 2). With Bool we would keep translating between Bool and Fin 2/ZMod 2.

What I'm suggesting is that the entire API make use of Bool. So instead of translating between Fin 2 and ZMod 2 you translate between Bool and ZMod 2.

@vihdzp

vihdzp commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

phi: This is the usual φ for the homomorphism into the wreath product in Grigorchuk (with ψ for the stabilizer map), so I kept the name.

If we called every function by the Greek letter that happened to be used on any given paper, Mathlib would be an unreadable mess. What about naming it something like combine? Perhaps mk? And you can explain on the docstring that Grigorchuk calls this φ, for those reading along.

@EzequielS2

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@tb65536 tb65536 added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 13, 2026
EzequielS2 and others added 2 commits November 15, 2026 16:37
These commands made the changes in this commit.
To make the same fixes yourself, run them in your mathlib4 checkout.
@EzequielS2

Copy link
Copy Markdown
Contributor Author

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Nov 15, 2026
@mathlib-dependent-issues mathlib-dependent-issues Bot added the blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) label Nov 15, 2026
@mathlib-dependent-issues

Copy link
Copy Markdown

This PR/issue depends on:

@github-actions github-actions Bot added the increases-technical-debt Automatically added label for PRs which increase "strong" technical debts label Nov 22, 2026

This branch has not been deployed

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

Labels

blocked-by-other-PR This PR depends on another PR (this label is automatically managed by a bot) increases-technical-debt Automatically added label for PRs which increase "strong" technical debts new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-geometric-group-theory Geometric group theory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants