Zulip Chat Archive
Stream: Is there code for X?
Topic: From map to AddAction
Marcello Seri (Jun 19 2024 at 13:45):
Given , is there a convenient way to construct an from it?
Eric Wieser (Jun 19 2024 at 16:37):
Can you make a #mwe that shows the assumptions on \a
and specified what you want the action to mean?
Adam Topaz (Jun 19 2024 at 16:40):
I assume you want n
to act on alpha
as n * x = f^[n](x)
?
Adam Topaz (Jun 19 2024 at 16:54):
You can define it as follows:
import Mathlib.Algebra.Group.Nat
import Mathlib.Algebra.Group.Action.Defs
def foo {α : Type*} (f : α → α) : AddAction ℕ α where
vadd n x := f^[n] x
zero_vadd := fun _ => rfl
add_vadd := by
intros a b _
show f^[a+b] _ = _
rw [Function.iterate_add]
rfl
Adam Topaz (Jun 19 2024 at 16:54):
It may be worthwhile to add somewhere if we don't already have it.
Eric Wieser (Jun 19 2024 at 17:16):
def foo {α : Type*} (f : α → α) : AddAction ℕ α :=
AddAction.compHom _ <| MonoidHom.toAdditive'' <| powersHom (Function.End α) f
example (n a) : (foo f).vadd n a = f^[n] a := rfl
Marcello Seri (Jun 19 2024 at 20:54):
Thanks a lot, that's the kind of example I was looking for. Is it worth adding AddAction.ofFun
(and maybe MulAction.ofFun
) on the false line of foo
to mathlib? This can get quite handy in the dynamics section
Eric Wieser (Jun 19 2024 at 21:50):
My initial impression is that AddAction
is unlikely to be helpful to you here since you can't reasonably make it an instance
, and so you should perhaps be working with
def foo {α : Type*} (f : α → α) : ℕ →+ Additive (Function.End α) :=
MonoidHom.toAdditive'' <| powersHom (Function.End α) f
instead
Eric Wieser (Jun 19 2024 at 21:52):
@Yury G. Kudryashov might have some more informed opinions here about dynamics than I do
Yury G. Kudryashov (Jun 19 2024 at 22:23):
We don't have a canonical way to talk about it. One possible approach is docs#Flow.fromIter but Flow
is used in a very small part of the library.
Last updated: May 02 2025 at 03:31 UTC