diff --git a/Mathlib.lean b/Mathlib.lean index 01bdf95c90f7c3..2b5279162a996e 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -4859,6 +4859,7 @@ public import Mathlib.Geometry.Euclidean.Volume.MeasureSimplex public import Mathlib.Geometry.Euclidean.Volume.Triangle public import Mathlib.Geometry.Group.Growth.LinearLowerBound public import Mathlib.Geometry.Group.Growth.QuotientInter +public import Mathlib.Geometry.Group.InfiniteRegularTree public import Mathlib.Geometry.Group.WordMetric public import Mathlib.Geometry.Group.WordProd public import Mathlib.Geometry.Manifold.Algebra.LeftInvariantDerivation diff --git a/Mathlib/Algebra/Order/Group/End.lean b/Mathlib/Algebra/Order/Group/End.lean index 4bb74e73b3db95..09bc947640959b 100644 --- a/Mathlib/Algebra/Order/Group/End.lean +++ b/Mathlib/Algebra/Order/Group/End.lean @@ -79,6 +79,8 @@ instance : Group (r ≃r r) where mul_one _ := ext fun _ => rfl inv_mul_cancel f := ext f.symm_apply_apply +lemma inv_eq_symm (e : r ≃r r) : e⁻¹ = e.symm := rfl + lemma one_def : (1 : r ≃r r) = .refl r := rfl lemma mul_def (f g : r ≃r r) : (f * g) = g.trans f := rfl diff --git a/Mathlib/Data/List/Infix.lean b/Mathlib/Data/List/Infix.lean index f6b1d0b784903a..3da07ffa8e0adc 100644 --- a/Mathlib/Data/List/Infix.lean +++ b/Mathlib/Data/List/Infix.lean @@ -174,6 +174,11 @@ protected theorem IsPrefix.nodup {l₁ l₂ : List α} (h : l₁ <+: l₂) (hn : l₁.Nodup := hn.sublist h.sublist +/-- A proper prefix is strictly shorter. -/ +theorem length_lt_of_prefix_ne {l₁ l₂ : List α} (h : l₁ <+: l₂) (hne : l₁ ≠ l₂) : + l₁.length < l₂.length := + Nat.lt_of_le_of_ne h.length_le fun H ↦ hne (h.eq_of_length H) + protected theorem IsInfix.nodup {l₁ l₂ : List α} (h : l₁ <:+: l₂) (hn : l₂.Nodup) : l₁.Nodup := hn.sublist h.sublist diff --git a/Mathlib/Geometry/Group/InfiniteRegularTree.lean b/Mathlib/Geometry/Group/InfiniteRegularTree.lean new file mode 100644 index 00000000000000..cab46319e68c90 --- /dev/null +++ b/Mathlib/Geometry/Group/InfiniteRegularTree.lean @@ -0,0 +1,452 @@ +/- +Copyright (c) 2026 Ezequiel Souza dos Santos. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Ezequiel Souza dos Santos +-/ +module + +public import Mathlib.Algebra.Group.Pi.Basic +public import Mathlib.Algebra.Order.Group.End +public import Mathlib.Data.List.Infix +public import Mathlib.GroupTheory.Perm.Basic +public import Mathlib.GroupTheory.SemidirectProduct + +/-! +# The infinite regular rooted tree + +The infinite regular rooted tree on an alphabet `α` has a vertex for every finite word +`List α`. The root is the empty word. The children of a vertex `v` are the words `v ++ [a]` for +`a : α`. When `α` is finite of cardinality `n`, this is the regular rooted tree of degree `n`. + +## Main definitions + +* `InfiniteRegularTree α`: vertices are lists `List α`. +* `InfiniteRegularTree.TreeAut α`: rooted automorphisms, as order isomorphisms of the prefix + partial order (`RelIso`). The name `TreeAut` avoids a clash with `MulAut`. +* `InfiniteRegularTree.TreeAut.combine`: act independently on the subtrees of the root. +* `InfiniteRegularTree.TreeAut.ofRootPerm`: the rooted automorphism induced by a permutation of + the children of the root. +* `InfiniteRegularTree.TreeAut.rootPerm`: the permutation induced at the root. +* `InfiniteRegularTree.TreeAut.restrict`: the section of an automorphism at a first-level vertex. +* `InfiniteRegularTree.TreeAut.equivSemidirect`: the semidirect product isomorphism + `TreeAut α ≃* (α → TreeAut α) ⋊ Equiv.Perm α`. + +## References + +* Nekrashevych, *Self-Similar Groups*, AMS Mathematical Surveys and Monographs 117. + +## Tags + +regular tree, rooted tree, geometric group theory +-/ + +@[expose] public section + +/-- The infinite regular rooted tree on the alphabet `α`: vertices are finite words. -/ +abbrev InfiniteRegularTree (α : Type*) := List α + +namespace InfiniteRegularTree + +variable {α : Type*} + +/-- A rooted automorphism of the infinite regular tree is an order isomorphism of the prefix +partial order. -/ +abbrev TreeAut (α : Type*) := + RelIso (fun x y : List α ↦ x <+: y) (fun x y : List α ↦ x <+: y) + +namespace TreeAut + +variable {α : Type*} + +@[simp] lemma map_isPrefix_iff (f : TreeAut α) {v w : InfiniteRegularTree α} : + f v <+: f w ↔ v <+: w := + f.map_rel_iff + +/-- A tree automorphism fixes the root. -/ +@[simp] lemma map_root (f : TreeAut α) : f [] = [] := by + have h : f [] <+: f (f.symm []) := (map_isPrefix_iff f).mpr List.nil_prefix + rw [RelIso.apply_symm_apply] at h + exact List.prefix_nil.mp h + +@[simp] lemma inv_eq_symm (f : TreeAut α) : f⁻¹ = f.symm := rfl + +lemma length_map_take_ge (f : TreeAut α) (v : InfiniteRegularTree α) : + ∀ k ≤ v.length, k ≤ (f (v.take k)).length + | 0, _ => Nat.zero_le _ + | k + 1, hk => by + have hpref : v.take k <+: v.take (k + 1) := List.take_prefix_take_left (Nat.le_succ k) + have hne : v.take k ≠ v.take (k + 1) := by + intro h + have := congrArg List.length h + have hk' : k + 1 ≤ v.length := hk + simp [Nat.min_eq_left (Nat.le_of_succ_le hk'), Nat.min_eq_left hk'] at this + have hlt := List.length_lt_of_prefix_ne ((map_isPrefix_iff f).mpr hpref) (f.injective.ne hne) + have ih := length_map_take_ge f v k (Nat.le_of_succ_le hk) + omega + +/-- A tree automorphism preserves word length (the distance to the root). -/ +@[simp] lemma map_length (f : TreeAut α) (v : InfiniteRegularTree α) : (f v).length = v.length := by + refine Nat.le_antisymm ?_ ?_ + · have := length_map_take_ge f.symm (f v) (f v).length le_rfl + simpa [List.take_length] using this + · have := length_map_take_ge f v v.length le_rfl + simpa [List.take_length] using this + +lemma apply_cons_ne_nil (f : TreeAut α) (a : α) (w : InfiniteRegularTree α) : + f (a :: w) ≠ [] := by + intro h + have := f.map_length (a :: w) + simp [h] at this + +set_option backward.privateInPublic true in +/-- The first letter of `f [a]`. This is the image of the child `a` of the root. -/ +private def firstLetter (f : TreeAut α) (a : α) : α := + (f [a]).head (apply_cons_ne_nil f a []) + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +private lemma apply_singleton (f : TreeAut α) (a : α) : f [a] = [firstLetter f a] := by + have hne := apply_cons_ne_nil f a [] + have htail : (f [a]).tail = [] := by + apply List.eq_nil_of_length_eq_zero + have hlen := f.map_length [a] + rw [List.length_tail, hlen] + rfl + conv_lhs => rw [← List.cons_head_tail hne, htail] + rfl + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +private lemma firstLetter_symm (f : TreeAut α) (a : α) : + firstLetter f.symm (firstLetter f a) = a := by + have h : f.symm [firstLetter f a] = [a] := by + rw [← apply_singleton f a] + exact f.symm_apply_apply [a] + rw [apply_singleton] at h + exact (List.cons_eq_cons.mp h).1 + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +/-- The permutation of the children of the root induced by `f`. -/ +def rootPerm (f : TreeAut α) : Equiv.Perm α where + toFun := firstLetter f + invFun := firstLetter f.symm + left_inv := firstLetter_symm f + right_inv := firstLetter_symm f.symm + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +private lemma rootPerm_eq_firstLetter (f : TreeAut α) (a : α) : + rootPerm f a = firstLetter f a := + rfl + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +/-- Action of `f` on the subtree hanging from the child `a` of the root. -/ +private def restrictFun (f : TreeAut α) (a : α) (w : InfiniteRegularTree α) : + InfiniteRegularTree α := + (f (a :: w)).tail + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +private lemma apply_cons (f : TreeAut α) (a : α) (w : InfiniteRegularTree α) : + f (a :: w) = firstLetter f a :: restrictFun f a w := by + have hpref : f [a] <+: f (a :: w) := (map_isPrefix_iff f).mpr (by simp [List.cons_prefix_cons]) + rw [apply_singleton] at hpref + obtain ⟨s, hs⟩ := hpref + simp [restrictFun, ← hs] + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +/-- The section of `f` at the first-level vertex `a`. -/ +def restrict (f : TreeAut α) (a : α) : TreeAut α where + toEquiv := + { toFun := restrictFun f a + invFun := restrictFun f.symm (firstLetter f a) + left_inv := by + intro w + calc + restrictFun f.symm (firstLetter f a) (restrictFun f a w) + = (f.symm (firstLetter f a :: restrictFun f a w)).tail := rfl + _ = (f.symm (f (a :: w))).tail := by rw [← apply_cons f a w] + _ = w := by simp [RelIso.symm_apply_apply] + right_inv := by + intro w + have h := apply_cons f.symm (firstLetter f a) w + rw [firstLetter_symm] at h + calc + restrictFun f a (restrictFun f.symm (firstLetter f a) w) + = (f (a :: restrictFun f.symm (firstLetter f a) w)).tail := rfl + _ = (f (f.symm (firstLetter f a :: w))).tail := by rw [h] + _ = w := by simp [RelIso.apply_symm_apply] } + map_rel_iff' := by + intro w w' + have h := f.map_isPrefix_iff (v := a :: w) (w := a :: w') + simp only [List.cons_prefix_cons, true_and] at h + rw [apply_cons f a w, apply_cons f a w'] at h + simpa [List.cons_prefix_cons] using h + +@[simp] lemma restrict_apply (f : TreeAut α) (a : α) (w : InfiniteRegularTree α) : + restrict f a w = (f (a :: w)).tail := + rfl + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +@[simp] lemma apply_singleton_rootPerm (f : TreeAut α) (a : α) : + f [a] = [rootPerm f a] := by + rw [rootPerm_eq_firstLetter, apply_singleton] + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +lemma apply_cons_rootPerm (f : TreeAut α) (a : α) (w : InfiniteRegularTree α) : + f (a :: w) = rootPerm f a :: restrict f a w := by + rw [rootPerm_eq_firstLetter] + exact apply_cons f a w + +set_option backward.privateInPublic true in +/-- The map underlying `combine`: on the subtree rooted at `a`, apply `F a`. -/ +private def combineFun (F : α → TreeAut α) : InfiniteRegularTree α → InfiniteRegularTree α + | [] => [] + | a :: w => a :: F a w + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +private lemma combineFun_left_inv (F : α → TreeAut α) : + (combineFun fun a ↦ (F a).symm).LeftInverse (combineFun F) := by + intro v + induction v with + | nil => rfl + | cons a w ih => + simp [combineFun, RelIso.symm_apply_apply] + +set_option backward.privateInPublic true in +set_option backward.privateInPublic.warn false in +/-- Combine sections by acting independently on the subtrees of the root. -/ +def combine (F : α → TreeAut α) : TreeAut α where + toEquiv := + { toFun := combineFun F + invFun := combineFun fun a ↦ (F a).symm + left_inv := combineFun_left_inv F + right_inv := fun v ↦ by + simpa [RelIso.symm_symm] using + combineFun_left_inv (fun a ↦ (F a).symm) v } + map_rel_iff' := by + intro v w + refine Iff.symm ?_ + induction v generalizing w with + | nil => simp [combineFun, List.nil_prefix] + | cons a u ih => + cases w with + | nil => simp [combineFun] + | cons b v => + change a :: u <+: b :: v ↔ combineFun F (a :: u) <+: combineFun F (b :: v) + by_cases h : a = b + · subst h + simp only [combineFun, List.cons_prefix_cons, true_and] + exact (map_isPrefix_iff (F a)).symm + · simp [combineFun, List.cons_prefix_cons, h] + +@[simp] lemma combine_cons (F : α → TreeAut α) (a : α) (w : InfiniteRegularTree α) : + combine F (a :: w) = a :: F a w := + rfl + +lemma combine_one : combine (fun _ : α ↦ (1 : TreeAut α)) = 1 := + RelIso.ext fun v ↦ by + cases v with + | nil => rfl + | cons a w => rfl + +lemma combine_mul (F G : α → TreeAut α) : + combine (fun a ↦ F a * G a) = combine F * combine G := + RelIso.ext fun v ↦ by + cases v with + | nil => rfl + | cons a w => rfl + +/-- Independent action on the subtrees of the root, as a group homomorphism. -/ +def combineHom : (α → TreeAut α) →* TreeAut α where + toFun := combine + map_one' := combine_one + map_mul' F G := combine_mul F G + +@[simp] lemma combineHom_apply (F : α → TreeAut α) : combineHom F = combine F := rfl + +/-- The rooted automorphism that permutes the children of the root by `σ`. -/ +def ofRootPerm (σ : Equiv.Perm α) : TreeAut α where + toEquiv := + { toFun := fun + | [] => [] + | a :: w => σ a :: w + invFun := fun + | [] => [] + | a :: w => σ.symm a :: w + left_inv := by + intro v + cases v with + | nil => rfl + | cons a w => simp + right_inv := by + intro v + cases v with + | nil => rfl + | cons a w => simp } + map_rel_iff' := by + intro v w + refine Iff.symm ?_ + cases v with + | nil => simp [List.nil_prefix] + | cons a u => + cases w with + | nil => simp + | cons b v => + simp [List.cons_prefix_cons] + +@[simp] lemma ofRootPerm_root (σ : Equiv.Perm α) : ofRootPerm σ [] = [] := rfl + +@[simp] lemma ofRootPerm_cons (σ : Equiv.Perm α) (a : α) (w : InfiniteRegularTree α) : + ofRootPerm σ (a :: w) = σ a :: w := + rfl + +lemma ofRootPerm_one : ofRootPerm (1 : Equiv.Perm α) = 1 := + RelIso.ext fun v ↦ by + cases v with + | nil => rfl + | cons a w => rfl + +lemma ofRootPerm_mul (σ τ : Equiv.Perm α) : + ofRootPerm (σ * τ) = ofRootPerm σ * ofRootPerm τ := + RelIso.ext fun v ↦ by + cases v with + | nil => rfl + | cons a w => rfl + +/-- Embedding of permutations of the alphabet as rooted automorphisms. -/ +def ofRootPermHom : Equiv.Perm α →* TreeAut α where + toFun := ofRootPerm + map_one' := ofRootPerm_one + map_mul' := ofRootPerm_mul + +@[simp] lemma ofRootPermHom_apply (σ : Equiv.Perm α) : ofRootPermHom σ = ofRootPerm σ := + rfl + +/-- The automorphism of the product of sections induced by permuting coordinates. -/ +def permMulAut (σ : Equiv.Perm α) : MulAut (α → TreeAut α) where + toFun F a := F (σ.symm a) + invFun F a := F (σ a) + left_inv F := funext fun a ↦ by simp + right_inv F := funext fun a ↦ by simp + map_mul' F G := rfl + +/-- The natural action of `Equiv.Perm α` on sections by permuting coordinates. -/ +def permAction : Equiv.Perm α →* MulAut (α → TreeAut α) where + toFun := permMulAut + map_one' := by + refine MulEquiv.ext fun F ↦ funext fun a ↦ ?_ + have h : (1 : Equiv.Perm α).symm = 1 := rfl + simp [permMulAut, h] + map_mul' σ τ := by + refine MulEquiv.ext fun F ↦ funext fun a ↦ ?_ + have hsymm : (σ * τ).symm = τ.symm * σ.symm := by + simp [← Equiv.Perm.inv_def, mul_inv_rev] + simp [permMulAut, hsymm, Equiv.Perm.coe_mul] + +@[simp] lemma permAction_apply (σ : Equiv.Perm α) (F : α → TreeAut α) (a : α) : + permAction σ F a = F (σ.symm a) := + rfl + +lemma ofRootPerm_mul_combine (σ : Equiv.Perm α) (F : α → TreeAut α) : + ofRootPerm σ * combine F = combine (permAction σ F) * ofRootPerm σ := + RelIso.ext fun v ↦ by + cases v with + | nil => rfl + | cons a w => + simp [RelIso.mul_apply, permAction_apply] + +lemma combineHom_compat (σ : Equiv.Perm α) : + combineHom.comp (permAction σ).toMonoidHom = + (MulAut.conj (ofRootPermHom σ)).toMonoidHom.comp combineHom := by + refine MonoidHom.ext fun F ↦ ?_ + change combine (permAction σ F) = ofRootPerm σ * combine F * (ofRootPerm σ)⁻¹ + have h := ofRootPerm_mul_combine σ F + calc + combine (permAction σ F) + = combine (permAction σ F) * ofRootPerm σ * (ofRootPerm σ)⁻¹ := + (mul_inv_cancel_right _ _).symm + _ = ofRootPerm σ * combine F * (ofRootPerm σ)⁻¹ := by rw [h] + +lemma rootPerm_combine (F : α → TreeAut α) : rootPerm (combine F) = 1 := by + refine Equiv.Perm.ext fun a ↦ ?_ + have h : combine F [a] = [a] := by + rw [combine_cons, map_root] + have := apply_singleton_rootPerm (combine F) a + rw [h] at this + exact (List.cons_eq_cons.mp this).1.symm + +lemma rootPerm_combine_mul_ofRootPerm (F : α → TreeAut α) (σ : Equiv.Perm α) : + rootPerm (combine F * ofRootPerm σ) = σ := by + refine Equiv.Perm.ext fun a ↦ ?_ + have h : (combine F * ofRootPerm σ) [a] = [σ a] := by + rw [RelIso.mul_apply, ofRootPerm_cons, combine_cons, map_root] + have := apply_singleton_rootPerm (combine F * ofRootPerm σ) a + rw [h] at this + exact (List.cons_eq_cons.mp this).1.symm + +lemma restrict_combine (F : α → TreeAut α) (a : α) : restrict (combine F) a = F a := + RelIso.ext fun w ↦ by + change (combine F (a :: w)).tail = F a w + simp [combine_cons] + +lemma restrict_combine_mul_ofRootPerm (F : α → TreeAut α) (σ : Equiv.Perm α) (a : α) : + restrict (combine F * ofRootPerm σ) a = F (σ a) := + RelIso.ext fun w ↦ by + change ((combine F * ofRootPerm σ) (a :: w)).tail = F (σ a) w + simp [RelIso.mul_apply, combine_cons] + +/-- Every rooted automorphism of the infinite regular tree is uniquely determined by its +first-level sections and its root permutation. Equivalently, this is the semidirect product +isomorphism `TreeAut α ≃* (α → TreeAut α) ⋊ Equiv.Perm α`. -/ +noncomputable def equivSemidirect : + TreeAut α ≃* (α → TreeAut α) ⋊[permAction] Equiv.Perm α := + MulEquiv.symm + { toFun := fun x : (α → TreeAut α) ⋊[permAction] Equiv.Perm α ↦ + combine x.left * ofRootPerm x.right + invFun := fun f ↦ ⟨fun b ↦ restrict f ((rootPerm f).symm b), rootPerm f⟩ + left_inv := by + intro x + rcases x with ⟨F, σ⟩ + refine SemidirectProduct.ext ?_ ?_ + · funext b + change restrict (combine F * ofRootPerm σ) + ((rootPerm (combine F * ofRootPerm σ)).symm b) = F b + rw [rootPerm_combine_mul_ofRootPerm, restrict_combine_mul_ofRootPerm] + simp + · exact rootPerm_combine_mul_ofRootPerm F σ + right_inv := by + intro f + refine RelIso.ext fun v ↦ ?_ + cases v with + | nil => + rw [show f [] = [] from map_root f] + simp [map_root] + | cons a w => + have hf := apply_cons_rootPerm f a w + change (combine (fun b ↦ restrict f ((rootPerm f).symm b)) * + ofRootPerm (rootPerm f)) (a :: w) = f (a :: w) + have ha : (rootPerm f).symm (rootPerm f a) = a := + Equiv.symm_apply_apply (rootPerm f) a + rw [RelIso.mul_apply, ofRootPerm_cons, combine_cons, hf, ha] + map_mul' := + (SemidirectProduct.lift combineHom ofRootPermHom combineHom_compat).map_mul' } + +@[simp] lemma equivSemidirect_apply (f : TreeAut α) : + equivSemidirect f = + ⟨fun b ↦ restrict f ((rootPerm f).symm b), rootPerm f⟩ := + rfl + +@[simp] lemma equivSemidirect_symm_apply (x : (α → TreeAut α) ⋊[permAction] Equiv.Perm α) : + equivSemidirect.symm x = combine x.left * ofRootPerm x.right := + rfl + +end TreeAut + +end InfiniteRegularTree