I've looked at a number of questions on what symmetries are in physics, such as this one, this one and this one. However, I found the questions and answers to be not completely satisfying because they were somewhat informal in certain ways that confused me.
Let $(S,\Phi)$ be a dynamical system, where $S$ is the state space, and $\Phi:\mathbb R\times S \to S$ gives the time evolution of the system given an initial condition. i.e. $s_t=\Phi(t,s_0)$ gives the state of the system at time $t$ if the initial state is $s_0$. Then a transformation $T:S\to S$ is a symmetry transformation of the physical system $(S,\Phi)$ if and only if for all $s_0$ and all $t$, $\Phi(t,s_0)=T^{-1}\left(\Phi(t,T(s_0))\right)$. In other words, we can transform the system by $T$, let the system evolve, and transform it back by $T^{-1}$, and it would be as if we hadn't transformed the system at all.
$(S,\Phi)$ could represent any physical system, whether $S$ is the phase space of a few classical point-mass particles, or the quantum state of an atom.
Is this a good general definition of what is meant by "symmetry" in physics?
I have seen people define a symmetry as something that leaves the lagrangian unchanged. However, some changes in the lagrangian (e.g. adding a constant) have no effect on the trajectory $\Phi(t,s_0)$ in the underlying physical system, so this seems like a bad definition.
I am not sure whether this captures gauge symmetries, or whether gauge symmetries are different from other symmetries (as I don't know what gauge symmetries are).