Second-order variational problems on Lie groupoids and optimal control applications

In this paper we study, from a variational and geometrical point of view, second-order variational problems on Lie groupoids and the construction of variational integrators for optimal control problems. First, we develop variational techniques for second-order variational problems on Lie groupoids and their applications to the construction of variational integrators for optimal control problems of mechanical systems. Next, we show how Lagrangian submanifolds of a symplectic groupoid gives intrinsically the discrete dynamics for second-order systems, both unconstrained and constrained, and we study the geometric properties of the implicit flow which defines the dynamics in the Lagrangian submanifold. We also study the theory of reduction by symmetries and the corresponding Noether theorem.


1.
Introduction. The topic of discrete Lagrangian mechanics concerns the study of certain discrete dynamical systems on manifolds. As the name suggests, these discrete systems exhibit many geometric features which are analogous to those in continuous Lagrangian mechanics. In particular, the discrete dynamics are derived from variational principles, have symplectic or Poisson flow maps, conserve momentum maps associated to Noether-type symmetries, and admit a theory of reduction. While discrete Lagrangian systems are quite mathematically interesting, in their own right, they also have important applications in the design of structure-preserving numerical methods for many dynamical systems in mechanics and optimal control theory.
Numerical methods which are constructed in this way are called variational integrators. This approach to discretizing Lagrangian systems was put forward in papers by Bobenko and Suris [6], Moser and Veselov [60], and others in the early 1990s, and the general theory was developed over the subsequent decade (see Marsden and West [51] for a comprehensive overview). and construction of variational integrators. In Section 4 we show how Lagrangian submanifolds of an appropriate symplectic groupoid (cotangent groupoid) give rise to discrete dynamical second-order systems. From such Lagrangian submanifold we obtain the discrete second-order Euler-Lagrange equations on Lie groupoids and such equations correspond with the ones obtained from the variational point of view. We also develop a reduction by symmetries, and we study the relationship between the different dynamics and variational principles for these second-order variational problems. Finally we study discrete constrained second-order Lagrangian mechanics. This allows for systems with arbitrary constraints.
Throughout the paper, we have occasion to draw on certain technical constructions using the theory of Lie algebroids and retraction maps. We provide some supplementary details and discussion of these and an overview on discrete mechanics and higher-order tangent bundles in some Appendices at the end of this paper.
2. Groupoids and discrete mechanics. This section review some results about Lie groupoids and discrete mechanics on Lie groupoids based on [41] and [42].

Generalities about Lie groupoids.
A groupoid is a small category in which every morphism is an isomorphism (i.e. all morphism is invertible). That is, Definition 2.1. A groupoid G over a set Q, denoted G ⇒ Q, consists of a set of objects Q, a set of morphisms G, and the following structural maps: • a source map α : G → Q and a target map β : G → Q. Thus an element g ∈ G is thought as an arrow from x = α(g) to y = β(g) in Q.
• an associative multiplication map m : G 2 → G, m(g, h) = gh, with α(g) = α(gh) and β(h) = β(gh) where is called set of composable pairs defined by α and β. gh is thought as the composite arrow from x to z if g is an arrow from x = α(g) to y = β(g) = α(h) and h is an arrow from y to β(h) = z.
• an identity map, : Q → G, a section of α and β, such that for all g ∈ G, (α(g)) g = g = g (β(g)) , • an inversion map i : G → G, mapping g into g −1 , such that for all g ∈ G, gg −1 = (α(g)) and g −1 g = (β(g)) . g −1 f f Remark 1. Alternatively, a groupoid can be seen as a weak version of a group, where the multiplication will be defined only for elements in G 2 ⊂ G × G.
Definition 2.3. Given a groupoid G ⇒ Q and g ∈ G, define the left translation g : α −1 (β(g)) → α −1 (α(g)) and right translation r g : β −1 (α(g)) → β −1 (β(g)) by g to be g (h) = gh and r g (h) = hg. Note that, −1 g = g −1 and r −1 g = r g −1 . Denoting by X(G) the set of vector fields on G one may introduce the notion of a left (right)-invariant vector field in a Lie groupoid, as in the case of Lie groups.
Definition 2.4. Given a Lie groupoid G ⇒ Q, a vector field X ∈ X(G) is leftinvariant (resp., right-invariant) if X is α-vertical (resp., β-vertical), that is, it is tangent to the fibers of α (resp., β), T α(X) = 0 (resp., T β(X) = 0) and (T h g ) (X(h)) = X (gh) for all (g, h) ∈ G 2 (resp., (T h r g ) (X(h)) = X (hg)).  In Lie groups, the infinitesimal version of a Lie group is a Lie algebra, therefore we will see that the corresponding infinitesimal version of a Lie groupoid is a Lie algebroid. Next, we define the Lie algebroid associated with a Lie groupoid G ⇒ Q.
Given a Lie groupoid G ⇒ Q, consider the vector bundle τ AG : AG −→ Q whose fiber at a point q ∈ Q is A q G = ker T (q) α = V α, i.e., the tangent space to the α-fiber at the identity section, for q ∈ Q. It is easy to prove that there exists a bijection between the space of sections Γ (τ AG ) and the set of left-invariant vector fields on G. If X is a section of τ AG , the corresponding left-invariant vector field on G will be denoted by ← − X ∈ X(G) where ← − X (g) = T (β(g)) g (X (β(g))) . (1) The Lie algebroid structure on AG is given by the bracket [[·, ·]] and the anchor map ρ defined as follows: for all X, Y ∈ Γ (τ AG ) and q ∈ Q.
Remark 4. Alternatively one can also establish a bijection between the space of sections Γ (τ AG ) and the set of right-invariant vector fields on Q, by − → X (g) = − T (α(g)) (r g • i) (X (α(g))) , which yields the Lie bracket relation Thus the mapping X into ← − X is a Lie algebra isomorphism, and the mapping X into − → X is a Lie algebra anti-isomorphism (see [20] and [40] fore more details). • The pair or banal groupoid: Let Q be a differentiable manifold, and consider the product manifold G = Q × Q. G is a Lie groupoid over Q where the source and target maps α and β are the projections onto the first and second factors respectively. The identity is defined as (q) = (q, q) for all q ∈ Q, the multiplication m((q, s), (s, r)) = (q, r) for (q, s), (s, r) ∈ Q × Q and the inverse map i(q, s) = (s, q).
Note that, if q is a point of Q, then V (q) α T q Q. Hence the Lie algebroid of G is isomorphic to the standard Lie algebroid τ T Q : T Q → Q. In this sense, the Banal groupoid is considered as the discrete space for discretizations of Lagrangian functions L : T Q → R.
• Lie groups: Let G be a Lie group. G is a Lie groupoid over one point Q = {e}, the identity element of G. The structural maps of the Lie groupoid G are α(g) = e, β(g) = e, (e) = e, i(g) = g −1 and m(g, h) = gh, for g, h ∈ G.
The Lie algebroid associated with G is the Lie algebra g of G.
• Transformation or action Lie groupoid. Let H be a Lie group with identityẽ and ϕ : Q × H → Q be a right action of H on Q. The product manifold G = Q × H is a Lie groupoid over Q, with structural maps given by The Lie groupoid G is called action or transformation Lie groupoid and its associated Lie algebroid is the action algebroid pr 1 : M ×h → M whereh is the Lie algebra of the Lie group H (for more details, see [40] and [41]).
• The cotangent groupoid: Let G ⇒ Q be a Lie groupoid. If A * G is the dual bundle to AG then the cotangent bundle T * G is a Lie groupoid over A * G. The projectionsβ andα, the partial multiplication ⊕ T * G , the identity section˜ and the inversionĩ are defined by the structural maps of G as follows, Here α, β, m, i, are the structural maps of G ⇒ Q (for more details, see [20] and [31]).
• Symplectic groupoids: Finally, we introduce a subclass of Lie groupoids with an additional structure, symplectic groupoids. They are endowed with a symplectic manifold structure. A symplectic groupoid is a Lie groupoid G ⇒ Q with a symplectic form ω on G such that the graph of the composition law m given by is a Lagrangian submanifold of G×G×G − with the product symplectic form, where the first two factors G are endowed with the symplectic form ω and the third factor G − with the symplectic form −ω.
Observe that if G ⇒ Q is a Lie groupoid then the cotangent groupoid T * G ⇒ A * G is a symplectic groupoid with the canonical symplectic 2-form on T * G, denoted ω G .

2.2.
Lie Groupoids and Discrete Mechanics. Next, we give a review of some generalities on discrete mechanics on Lie groupoids based in [41] and [42].
2.2.1. Discrete Euler-Lagrange equations. Let G be a Lie groupoid over Q with structural maps Denote by τ AG : AG → Q the Lie algebroid of G.
A discrete Lagrangian is a function L d : G → R. Fixed g ∈ G, we define the set of admissible sequences with values in G: For N = 2 we obtain that (g, h) ∈ G 2 is a solution of the discrete Euler-Lagrange for every section X of AG.

SECOND-ORDER VARIATIONAL PROBLEMS ON LIE GROUPOIDS 7
Remark 5. Marrero et al. [41] showed that these discrete Euler-Lagrange equations are also equivalent to the sequence g 1 , . . . , g N ∈ G corresponding to a critical point of the action sum over the space of admissible sequences.
In the case when G is the banal groupoid Q × Q ⇒ Q, this recovers the discrete Euler-Lagrange equations, for k = 1, . . . , N − 1, as in Marsden and West [51].

2.2.2.
Discrete Lagrangian evolution operator. We say that a differentiable mapping Ψ : G → G is a discrete flow or a discrete Lagrangian evolution operator for L d if it verifies the following properties: -graph(Ψ) ⊆ G 2 , that is, (g, Ψ(g)) ∈ G 2 , ∀g ∈ G.
-(g, Ψ(g)) is a solution of the discrete Euler-Lagrange equations, for all g ∈ G, that is, for every section X of AG and every g ∈ G.
2.2.3. Discrete Legendre transformations. Given a discrete Lagrangian L d : G → R we define two discrete Legendre transformations F − L d : G → A * G and F + L d : G → A * G as follows (see [41]) . Regular discrete Lagrangians and Hamiltonian evolution operator. A discrete Lagrangian L d : G → R is said to be regular if and only if the Legendre transformation F + L d is a local diffeomorphism (equivalently, if and only if the Legendre transformation F − L d is a local diffeomorphism). In this case, if (g 0 , h 0 ) ∈ G × G is a solution of the discrete Euler-Lagrange equations for L d then, one may prove (see [41]) that there exist two open subsets U 0 and V 0 of G, with g 0 ∈ U 0 and h 0 ∈ V 0 , and there exists a (local) discrete Lagrangian evolution operator Ψ : U 0 → V 0 such that: 1. Ψ(g 0 ) = h 0 , 2. Ψ is a diffeomorphism and 3. Ψ is unique, that is, if U 0 is an open subset of G, with g 0 ∈ U 0 , and Ψ : U 0 → G is a (local) discrete Lagrangian evolution operator then If L d : G → R is a hyperregular Lagrangian function, then pushing forward to A * G with the discrete Legendre transformations, we obtain the discrete Hamiltonian evolution operator, Ψ : A * G → A * G given by Given a discrete Lagrangian L d : G → R its discrete Euler-Poincaré equations are that is, (see [6,49,50]). A way to discretize a continuous problem is by using a retraction map τ : g → G, which is an analytic local diffeomorphism and maps a neighborhood V ⊆ g of 0 ∈ g to a neighborhood U ⊆ G of the identity e ∈ G. We have that τ (ξ)τ (−ξ) = e for all ξ ∈ g (see [7]).
The retraction map provides a local chart on the Lie group and it is used to express a small change in the group configuration through a unique Lie algebra element, namely ξ k = τ −1 (g −1 k g k+1 )/h, where h > 0 is a small enough time step, ξ k ∈ g, hξ k ∈ V ⊆ g and g k , g k+1 ∈ U ⊆ G, i.e., if ξ k were regarded as an average velocity between g k and g k+1 , then τ is an approximation of the corresponding vector field on G (see [33]).
To derive the discrete Euler-Poincaré equations, one uses the left-trivialized tangent retraction map dτ ξ : g → g and its inverse dτ −1 ξ : g → g defined by for η ∈ g (see [32], [7]) . The Lie algebra g is on itself a vector space, then it is natural to consider local coordinates on g. We will write τ (hξ) = g for a enough small time step h > 0 such that hξ ⊆ V where V is a local neighborhood of 0 ∈ g. Fixing a basis {e γ } of g we induce coordinates (y γ ) on g. In these coordinates, a basis of left-invariant and right-invariant vector fields is where η ∈ g. Given a Lagrangian l : g → R, the discrete Euler-Poincaré equations are: that is, (see [42]).
3. Second-order variational problems on Lie groupoids and optimal control applications. In this section, we discuss discrete second-order Lagrangian mechanics using techniques of variational calculus on Lie groupoids (see [30] and [41] for first order variational calculus on Lie groupoids) and we illustrate our results with some examples and applications in the theory of optimal control of mechanical systems.
3.1. Second-order variational problems on Lie groupoids. Let G be a Lie groupoid with structural maps α, β : G → Q, : Q → G, i : G → G and m : G 2 → G. Denote by τ AG : AG → Q the Lie algebroid associated with the Lie groupoid G.
Definition 3.1. A discrete second-order Lagrangian L d : G 2 → R is a differentiable function defined on the set of composable elements describing the dynamics of the mechanical system.
We denote by G 4 the product G × G × G × G. As in the first order case, fixed g ∈ G, we define the set of admissible sequences in G 4 with values in G by consider N = 4 in (5), that is, with g 1 and g 4 fixed and g 1 g 2 g 3 g 4 = g}. Given a tangent vector at the pointḡ = (g 1 , g 2 , g 3 , g 4 ) to the manifold C 4 g , we may write it as the tangent vector at t = 0 of a curve c(t) in C 4 g , which passes throughḡ at t = 0. This type of curves has the form where h 2 (t) ∈ α −1 (β(g 2 )), for all t, and h 2 (0) = (β(g 2 )). The curve c is called a variation ofḡ. Therefore we may identify the tangent space to C 4 g atḡ with The curve v 2 is called infinitesimal variation ofḡ and is the tangent vector to the α-vertical curve h 2 at t = 0.
We define the discrete action sum associated with the discrete second-order Lagrangian L d : G 2 → R by To derive the discrete equations of motion we apply Hamilton's principle of critical action. In order to do that, we need to consider the variations of the discrete action sum. Definition 3.2 (Discrete Hamilton's principle on Lie groupoids). Given g ∈ G, an admissible sequenceḡ ∈ C 4 g is a solution of the Lagrangian system determined by L d : G 2 → R if and only ifḡ is a critical point of S L d . Proposition 1. Given g ∈ G, the admissible sequenceḡ = (g 1 , g 2 , g 3 , g 4 ) ∈ C 4 g is a solution of the Lagrangian system determined by L d : G 2 → R if and only ifḡ satisfies the discrete second-order Euler-Lagrange equations for L d : Proof. By definition (3.2),ḡ is a solution of the Lagrangian system determined by L d : G 2 → R if it is a critical point of S L d . In order to characterize the critical points, we calculate, where c(t) is the variation ofḡ defined in (11).
Then, the condition d dt t=0 S L d (c(t)) = 0 is equivalent to where v 2 ∈ A β(g2) G is the infinitesimal variation ofḡ, (β(g 2 )) = h 2 (0) and g and r g were defined on Definition 2.3. Therefore,ḡ is a solution of the Lagrangian system determined by the discrete second-order Lagrangian L d : G 2 → R if and only if it satisfies equations (14), that is,ḡ is a solution of the Lagrangian system determined by L d : The equations given above are called discrete second-order Euler-Lagrange equations.

3.1.2.
Example: Discrete second-order Euler-Poincaré equations. Let G be a Lie group, that is G is a Lie groupoid over the identity element {e} of G. Given g ∈ G and a discrete second-order Lagrangian L d : G 2 → R, the solution for the Lagrangian system determined by the discrete Lagrangian L d are ) for an admisible sequence (g k−1 , g k , g k+1 , g k+2 ) ∈ C 4 g with g = g k−1 g k g k+1 g k+2 and g 1 , g 4 fixed points in G.
The equations given above are the discrete second-order Euler-Poincaré equations (see for example [17] and [9]).
3.1.3. Example: Discrete second-order Euler-Lagrange equations on an action Lie groupoid. Let H be a Lie group, and Q a differentiable manifold. Let ϕ : Q×H → Q be a right action, ϕ(q, h) = qh. We consider the action Lie groupoid, G = Q × H over Q. The set of composable elements is determined by If (q, h) ∈ G, the left-translation (q,h) : α −1 (qh) → α −1 (q) and the righttranslation r (q,h) : β −1 (q) → β −1 (qh) (where α and β are the source and target map of G) are given by (q,h) (qh, h ) = (q, hh ) and Consider an admissible path The discrete Euler-Lagrange equations for the system determined by the discrete second-order discrete Lagrangian L d :

3.2.
Second-order constrained variational problems on Lie groupoids. Next, we extend the previous variational principle to second-order variational problems for systems subject to second-order constraints. The constructions presented here are interesting for applications in optimal control problem of underactuated mechanical controlled systems. Let L d : G 2 → R be a discrete second-order Lagrangian describing the dynamics of a discrete mechanical system. Suppose that the dynamics is restricted. This restriction is given by the vanishing of s smooth constraint functions Φ A d : The dynamics of the second-order constrained variational problem associated with L d and Φ A d is described by the discrete constrained second-order Euler-Lagrange equations determined by considering the augmented Lagrangian L d : . . , λ s ) ∈ R s are Lagrange multipliers to be determined (see subsection 4.5 for an intrinsic approach).
Given g ∈ G, the set of admissible sequences is given by for k = 1, 2, 3 with g 1 and g 4 fixed and g 1 g 2 g 3 g 4 = g}.

LEONARDO COLOMBO AND DAVID MARTÍN DE DIEGO
Consider the extended action sum associated with the extended Lagrangian L d : where λ k A = (λ k 1 , . . . , λ k s ) ∈ R s . An easy adaptation of the variational principle (3.2) for the discrete extended Lagrangian L d can be done to obtain the discrete constrained second-order Euler-Lagrange equations by extremizing the extended action sum S L d . The equations describing the dynamics of second-order constrained variational problems are Application to optimal control of mechanical systems. In this section we study how to apply the second-order Euler-Lagrange equations on Lie groupoids to optimal control problems of mechanical systems defined on Lie algebroids. After introducing optimal control control problems, we study their discretization.

Optimal control problems of total-actuated mechanical systems on
The dynamics is specified fixing a Lagrangian L : A → R (see Appendix C) . External forces are modeled, in this case, by curves u F : Given local coordinates (q i ) on Q, and fixing a basis of sections {e α } of τ A : A → Q we can induce local coordinates (q i , y α ) on A; that is, every element b ∈ A q = τ −1 A (q) is expressed univocally as b = y α e α (q). The notion of admissible curves replaces that of natural prolongation in the context of Lie algebroids.
In a local description, a curve ξ on A given by It is possible to adapt the derivation of the Lagrange-d'Alembert principle to study fully-actuated mechanical controlled systems on Lie algebroids (see [19] and [48]). Let q 0 and q T fixed in Q, consider an admissible curve ξ : I ⊂ R → A which satisfies the principle where η(t) ∈ A τ A (ξ(t)) and u F (t) ∈ A * τ A (ξ(t)) defines the control force (where we are assuming they are arbitrary). The infinitesimal variations in the variational principle are given by δξ = η C , for all time-dependent sections η ∈ Γ(τ A ), with η(0) = 0 and η(T ) = 0, where η C is a time-dependent vector field on A, the complete lift, locally defined by [19], [44], [45] and [46]). Here the structure functions C α βγ are determined by [[e β , e γ ]] = C α βγ e α . From the Lagrange-d'Alembert principle one easily derives the controlled Euler-Lagrange equations by using standard variational calculus The control force u F is chosen such that it minimizes the cost functional where C : A ⊕ A * → R is the cost function associated with the optimal control problem. Therefore, the optimal control problem consists on finding an admissible curve ξ(t) = (q i (t), y α (t)) solution of the controlled Euler-Lagrange equations, the boundary conditions and minimizing the cost functional for C : A⊕A * → R. This optimal control problem can be equivalently solved as a second-order variational problem by defining the second-order Lagrangian L : Here A (2) denotes the set of admissible elements of the Lie algebroid A, a subset of A × T A, given by where T τ A : T A → T Q is the tangent map of the bundle projection. A (2) is considered as the substitute of the second-order tangent bundle in classical mechanics [46]. In local coordinates, the set The dynamics associated with the second-order Lagrangian L : A (2) → R (and therefore the optimality conditions for the optimal control problem) is given by the second-order Euler-Lagrange equations on Lie algebroids (see for example [12] and [47]) together with the admissibility condition Remark 6. Alternatively, one can define the Lagrangian L : A (2) → R in terms of the Euler-Lagrange operator as where EL(L) : A (2) → A * is the Euler-Lagrange operator which locally reads as Here {e α } is the dual basis of {e α }, the basis of sections of A and τ A (2) A : A (2) → A is the canonical projection between A (2) and A given by the map

3.3.2.
Optimal control problems of underactuated mechanical systems on Lie algebroids. Now, suppose that our mechanical control system is underactuated, that is, the number of control inputs is less than the dimension of the configuration space. The class of underactuated mechanical systems are abundant in real life for different reasons; for instance, as a result of design choices motivated by the search of less cost engineering devices or as a result of a failure regime in fully actuated mechanical systems. Underactuated systems include spacecrafts, underwater vehicles, mobile robots, helicopters, wheeled vehicles and underactuated manipulators. We will see that the corresponding optimality conditions are given by the solutions of second-order constrained Euler-Lagrange equations (see [16]).
Given a Lagrangian function L : A → R and control external forces, the controlled equations for an underactuated system defined on a Lie algebroid are The optimal control problem consists on finding an admissible trajectory ξ(t) = (q i (t), y A (t), y a (t)) solution of the controlled Euler-Lagrange equations given boundary conditions and minimizing a cost functional C : This optimal control problem can be solved as a constrained second-order variational problem on Lie algebroids where the second-order Lagrangian L : A (2) → R is given by and where the dynamics is restricted by the second order constraints The optimality conditions for the optimal control problem are determined by the second-order constrained Euler-Lagrange equations given by considering the . . , λ s ) ∈ R s are the Lagrange multipliers. These equations are given by (see [12] for more details) together with the admissibility conditionq i = ρ i α y α 3.3.3. Optimal control problems on Lie groupoids. Now we describe the discrete optimal control problem on a Lie groupoid G. Let L d : G → R be a discrete Lagrangian, an approximation of the action corresponding to a continuous Lagrangian L : A → R defined on a Lie algebroid A, that is, where h > 0 is the time step with T = N h and ξ is an admissible curve on A.
Defining the discrete second-order Lagrangian L d : the discrete optimal control problem consists on finding a path (g 0 , g 1 , . . . , g N ) ∈ G N +1 minimizing the discrete action sum J d for the discrete second-order Lagrangian L d : Discrete Hamilton's principle (3.2) states that the paths minimizing J d subject fixed points g 0 , g 1 , g N −1 , g N ∈ G satify the discrete second-order Euler-Lagrange equations for L d : G 2 → R given by .
Therefore, as in the continuous problem, the optimality conditions for the discrete optimal control problem are determined by the discrete second-order Euler-Lagrange equations for L d : Alternatively, one can start with a continuous optimal control problem associated to a Lagrangian L : A → R defined on a Lie algebroid A. The optimality conditions for this optimal control problem are determined by a system of fourth order differential equations obtained from the second-order Euler-Lagrange equations associated with the Lagrangian L : A (2) → R determined by the cost function as in (21). Now, we take directly a discretization of the second-order Lagrangian L to derive L d : Finally, we would like to point out that the underactuated case follows as in the continuous case by consider a discrete second-order constrained problem as in Subsection 3.2 and the optimality conditions are given by the solutions of the discrete second-order constrained Euler-Lagrange equations (18). We will illustrate this in Example 3.3.5.
3.3.4. An illustrative example: Optimal control of a rigid body on SO(3). In this example, we show how the optimal control problem of a rigid body defined on the Lie group SO(3) can be studied using the previous constructions given before. This example is motivated by the attitude optimal control of spacecrafts (see [35], [36] and references therein).
The Lie groupoid structure of SO(3) over the identity matrix Id is given by The Lie algebroid associated with the Lie groupoid SO (3) is the Lie algebra so(3) over a single point, where the anchor map is zero and the bracket is the usual commutator of matrices and the set of admissible elements is identified with so(3) × so (3). Observe that, in this case, all the elements are composable, that is, The equations of motion of the controlled rigid body arė where Ω = (Ω 1 , Ω 2 , Ω 3 ) ∈ R 3 andΩ = (Ω 1 ,Ω 2 ,Ω 3 ) ∈ R 3 , u i are the control inputs (torques for the rigid body) for i = 1, 2, 3 and are constants determined by the moments of inertia of the rigid body I 1 , I 2 , I 3 .
Here, we are using the typical identification of the Lie algebra so(3) with R 3 by the hat map· : R 3 → so(3) (see [2] and [29] for example), where with some abuse of notation, we directly identify R 3 with so(3) by omitting the hat notation. Our fixed boundary conditions for the optimal control problem are (R(0), Ω(0)) and (R(T ), Ω(T )), where R(t) ∈ SO(3) is the attitude of the rigid body subject to the reconstruction equationṘ = RΩ and variations for the attitude are given by δR = Rη, with η an arbitrary curve on so(3). Consider the cost functional From (26) the cost functional becomes into J = T 0 L(Ω,Ω) dt, (see [16] for the solution of this second-order variational problem in the continuous setting). Angular velocities and angular accelerations can be approximated by discrete trajectories ξ k+1/2 Ω(kh) and ξ k,k+1 Ω (kh) respectively for ξ k , ξ k+1 ∈ so(3) where h > 0 is a fixed real number and T = kh with k = 0, . . . , N , where we are using the notation ξ k+1/2 = 1 2 (ξ k + ξ k+1 ) and ξ k, The optimal control problem, is given by minimizing the cost function associated with the discrete second-order Lagrangian L d : Here (w k , w k+1 ) ∈ SO(3) × SO (3), cay(hξ k ) = w k and cay : so(3) → SO(3) denote the Cayley map for the Lie group SO(3) (see Appendix D). Therefore, the discrete Lagrangian is now given by The variational integrator for the optimal control problem is given by applying discrete Hamilton's principle (3.2) in the discrete action sum determined by the discrete cost Instead of working with the discrete sum (28) one can take in order to work in a vector space where variations of ξ k = cay −1 (w k ) ∈ so(3) are given by (see for example [34]) 3.3.5. Example: optimal control of a heavy top with two internal rotors. The following example illustrates the study of underactuated mechanical control systems on Lie algebroids and the construction of variational integrators for such systems. It is the optimal control problem of the upright spinning of the heavy top (see [11] and reference therein).
Consider the top with two rotors so that each rotor's rotation axis is parallel to the first and the second principal axes of the top as in Figure 1. Let I 1 , I 2 , I 3 be the moments of inertia of the top in the body fixed frame. Let J 1 , J 2 be the moments of inertia of the rotors around their rotation axes and J j1 , J j2 , J j3 be the moments of inertia of the j-th rotor, with j = 1, 2, around the first, the second and the third principal axes, respectively. Also we define the quantitiesĪ 1 = I 1 + J 11 + J 21 , I 2 = I 2 + J 12 + J 22 ,Ī 3 = I 3 + J 13 + J 23 , γ 1 =Ī 1 + J 1 and γ 2 =Ī 2 + J 2 . Let M be the total mass of the system, g the magnitude of the gravitational acceleration and h the distance from the origin to the center of mass of the system.
The Lie bracket of sections of A is determined by [[X θr , X θs ]] = 0, with r, s = 1, 2 and [[X θs , X Ei ]] = 0, for s = 1, 2 and i = 1, 2, 3. The reduced Lagrangian l : The Euler-Lagrange equations for l are given by together with the admissibility conditionΓ = Γ × Ω. Next, we add controls in our picture. Each rotor can be controlled is such way the controlled Euler-Lagrange equations are now where e 3 = (0, 0, 1). That is, together with the admissibility conditionṡ The optimal control problem consists on finding an admissible curve γ(t) = (Γ(t), Ω(t), θ(t), u i (t)) of the state variables and control inputs, satisfying the controlled equations given above, the boundary conditions and minimizing the cost This optimal control problem is equivalent to solve the second-order variational problem determined by min (Ω(·),θ(·),u(·)) T 0 L Ω, θ,Ω,θ,θ dt, and subjected to the second-order constraints Φ A : together with the admissibility conditionΓ − Γ × Ω = 0 and where L : where C = 1 2 (u 2 1 + u 2 2 ). Therefore, the optimality conditionsare determined by the constrained secondorder Euler-Lagrange equations given by As before, we use the Cayley transformation on SO(3) to describe the discretization of the optimal control problem for the heavy top with internal rotors. We redefine the Lagrangian L and the constraints Φ A as L : 2so(3) × T (2) where ξ k , ξ k+1 ∈ so(3) and h > 0 is a fixed real number with T = kh, k = 0, . . . , N .

4.
Lagrangian submanifolds generating discrete dynamics. In this section we study how a Lagrangian submanifold of a particular cotangent groupoid can be used to give a more geometric and intrinsic point of view of discrete second-order dynamics. Moreover, we will study the preservation properties of the derived discrete implicit dynamics. We also study discrete second-order constrained systems. Particularly, from this geometrical framework, we will analyze some geometric properties of the associated discrete flow. Finally, we will study the theory of reduction under symmetries.
P π G is called prolongation of G over π : P → Q (See [40], [41] and [56]). Next, we consider the prolongation P α G of the Lie groupoid G over its source map α : G → Q, that is, one can consider the subset of 3G := G × G × G, P α G is a Lie groupoid over G. Moreover, G 2 ⊆ P α G where the inclusion is given by Now, we construct the Lie algebroid associated with P α G. This will be identified with the prolongation P α (AG) of AG over α : G → Q, where AG is the Lie algebroid associated with G with bundle projection τ AG : AG → Q.
A (P α G) is a Lie algebroid over P α G with bundle projection denoted by τ A(P α G) : A (P α G) → P α G.
From (4.1) a section Z of A (P α G) can be expressed as where g ∈ G, X ∈ Γ(τ AG ) and Y is a vector field on G such that T β(X) = T α(Y ).
The corresponding left-invariant and right-invariant vector fields associated with the section Z ∈ Γ(τ A(P α G) ) are with (g, h, r) ∈ P α G. Given a basis of sections of AG one can obtain a basis of sections of A (P α G), denoted by {Z 1 , Z 2 }, with
The next result is a direct application of the construction given before and it will be useful when we derive the discrete second-order dynamics for a second-order discrete Lagrangian.
. For (g, h, r) ∈ P α G the associated left and right invariant vector fields for Z 1 and Z 2 are given by

Generating Lagrangian submanifolds and dynamics on Lie groupoids.
Let G ⇒ Q be a Lie groupoid with source and target map α, β : G → Q respectively, and we consider the prolongation of G over its source map, P α G. We denote by α α , β α : P α G → G the source and target maps of this Lie groupoid. Let τ A * (P α G) : A * (P α G) → G be the dual of the vector bundle associated with the Lie algebroid τ A(P α G) : A (P α G) → G. The Lie groupoid (cotangent groupoid) In what follows, we show how the discrete dynamics associated with a discrete second-order Lagrangian L d : G 2 → R is generated by a Lagrangian submanifold of the cotangent groupoid T * (P α G).
Remember that given a manifold Q and a function S : Q → R, the submanifold Im dS ⊂ T * Q is Lagrangian. There is a more general construction given toŚniatycki and Tulczyjew [57] (see also [58] and [59]) which we will use to generate the discrete dynamics. [57]). Let Q be a smooth manifold, N ⊂ Q a submanifold, and S : N → R. Then

Theorem 4.3 (Śniatycki and Tulczyjew
is a Lagrangian submanifold of T * Q. Here π Q : T * Q → Q and τ Q : T Q → Q denote the cotangent and tangent bundle projections, respectively. Turning back to the groupoid formulation, immediately from Theorem (4.3), the discrete second-order Lagrangian L d : G 2 → R generates a Lagrangian submanifold Σ L d ⊂ T * (P α G) of the symplectic Lie groupoid (T * (P α G), ω P α G ) where ω P α G denotes the canonical symplectic 2-form on T * (P α G). Denoting by i G2 : G 2 → P α G the inclusion defined by i G2 (g 1 , g 2 ) = (g 1 , g 1 , g 2 ), we have is a Lagrangian submanifold of (T * (P α G), ω P α G ). The relationship among these spaces is summarized in the following diagram where from now on we will denoteα andβ the source and target maps, respectively, of the Lie groupoid T * (P α G) ⇒ A * (P α G).
Given an element µ ∈ T * (g,h,r) (P α G) with (g, h, r) ∈ P α G the source and target maps of T * (P α G) are defined such that, for all section Z ∈ Γ(τ A(P α G) ), where ← − Z and − → Z are the corresponding left and right invariant vector fields associated with the section Z of A(P α G) according to (31) and (32).
Remark 8. We have seen how the dynamics is only defined implicitly by a relation in T * (P α G) rather that as an explicit discrete flow map. Therefore, the sequence γ (g1,g2) , . . . , γ (g N −1 ,g N ) ∈ T * (P α G) satisfy the discrete second-order dynamics on Σ L if and only if each pair of successive elements satisfies the relation Next, we show that the discrete dynamics described implicitly in Theorem (4.5) is equivalent to the discrete second-order Euler-Lagrange equations (15) given by the variational point of view.
Theorem 4.6. Let L d : G 2 → R be a discrete second order Lagrangian. For every section Z of Γ(τ A(P α G) ) according to (31) and (32) the discrete second order Euler-Lagrange equations associated with L d are for k = 2, . . . , N − 2.
Example 1. Let G be a Lie group and let L d : G 2 = G × G → R be a discrete second-order Lagrangian. The prolongation of G over its source map, P α G, is a Lie groupoid over G and it can be identified with three copies of G, that is, P α G 3G. We construct a Lagrangian submanifold of the cotangent groupoid T * (P α G) as where i P α G : G 2 → P α G is the inclusion given by . Therefore, we have that a sequence γ (g1,g2) , . . . , γ (g N −1 ,g N ) , where γ (g k ,g k+1 ) ∈ T * i G 2 (g k ,g k+1 ) (P α G), with (g k , g k+1 ) ∈ G 2 for k = 1, . . . , N − 1, satisfies the discrete second-order dy- , that is, (g k , g k+1 ) ∈ G 2 for k = 1, . . . , N −1 is a solution of the discrete second-order Euler-Poincaré equations for the discrete second-order Lagrangian L d : G 2 → R.
Example 2. Let Q be a differentiable manifold, consider the pair groupoid Q×Q ⇒ Q, where the source and target maps are given by the projections onto the fist and second factor, respectively. The set of admissible elements is given by The prolongation Lie groupoid is a Lie groupoid over Q × Q given by P α (Q × Q) = {((q 0 , q 1 ), (q 2 , q 3 ), (q 4 , q 5 )) ∈ 3(Q × Q) | q 1 = q 2 and q 3 = q 4 } 4Q, where the inclusion of (Q × Q) 2 into P α (Q × Q) is given by Given L d : (Q × Q) 2 → R, a discrete second-order Lagrangian, we construct the Lagrangian submanifold Σ L d of the cotangent groupoid (T * (P α (Q×Q)), ω P α (Q×Q) ) over A * (P α (Q × Q)), where ω P α (Q×Q) denotes the canonical symplectic 2-form on T * (P α (Q × Q)), by Using the source and target map given bỹ

LEONARDO COLOMBO AND DAVID MARTÍN DE DIEGO
we have that the second-order discrete dynamics on Σ L d holds if and only if 4.3. Regularity conditions and Poisson structure. We have seen how the dynamics is implicitly defined by a relation on T * (P α G) rather than an explicitly defined map and pointed out that γ (g1,g2) , . . . , γ (g N −1 ,g N ) ∈ T * (P α G) satisfies the discrete second-order dynamics if and only if for each pair of successive elements in T * (P α G) they satisfy Weinstein [62] raised the question of how regularity results for the pair groupoid Q × Q might be generalized to arbitrary Lie groupoids G ⇒ Q, and this question was answered by Marrero et al. (see, Theorem 4.13 in [41]). Here, we study an extension of this problem to discrete second-order systems following the work of Marrero et al. [43] for first order systems. The problem consists on finding under which conditions the relation (48) is the graph of an explicit flow

(at least locally) and what properties have such map.
Consider the source map of the cotangent groupoid T * (P α G) restricted to the Lagrangian submanifold Σ L d , that is,α | Σ L d : Σ L d → A * (P α G). If this map is a local diffeomorphism, then the Lagrangian flow is locally given by Theorem 4.7 (Marrero, Martín de Diego and Stern [43]). Let Γ a symplectic groupoid over a manifold P with source and target maps α and β, respectively. Let Σ be a Lagrangian submanifold Σ ⊂ Γ. Then the restricted source map α | Σ : Σ → P is a local diffeomorphism if and only if the restricted target map β | Σ : Σ → P is a local diffeomorphism.
A direct consequence of Theorem (4.7) is that given the symplectic groupoid (T * (P α G), ω P α G ), if Σ L d ⊂ T * (P α G) is the Lagrangian submanifold generated by the second-order discrete Lagrangian L d : The applicationsα | Σ L d andβ | Σ L d play the role of FL − d and FL + d , respectively, in discrete mechanics (see Appendix B and [13] for the higher-order case), that is, and therefore, from Theorem (4.7), FL + d is a local diffeomorphism if and only if FL − d is a local diffeomorphism. Now, by Definition (4.4), given a sequence γ (g1,g2) , . . . , γ (g N −1 ,g N ) ∈ T * (P α G), it satisfies the discrete second-order dynamics on Σ L d if and only if γ (g1,g2) , . . . , γ (g N −1 ,g N ) ∈ Σ L d and FL + d (γ (g k ,g k+1 ) ) = FL − d (γ (g k+1 ,g k+2 ) ), k = 1, . . . , N − 2. Definition 4.8. Let L d : G 2 → R be a discrete second-order Lagrangian. It is said to be regular ifα | Σ L d is a local diffeomorphism, and hyperregular if it is a global diffeomorphism. Definition 4.9. If the Lagrangian L d : G 2 → R is hyperregular, the map defined as The next theorem shows the relation between the Hamiltonian evolution operator and the preservation of the Poisson structure on A * (P α G).
Theorem 4.10. Assume thatα | Σ L d is a global diffeomorphisms. Then, the discrete Hamiltonian evolution operator Γ L d : A * (P α G) → A * (P α G) preserves the Poisson structure on A * (P α G).
Proof. Ifα | Σ L d (or, equivalently,β | Σ L d ) is a global diffeomorphism, the Hamiltonian evolution operatiorΓ L d is a global automorphism on A * (P α G).
Consider the application where A * (P α G) denotes A * (P α G) endowed with the linear Poisson structure changed of sign.
. Since (α,β) is a Poisson map and Σ L d is a Lagrangian submanifold, the image of Σ L d by (α,β) is a coisotropic submanifold of A * (P α G) × A * (P α G). Thus, by corollary (2.2.3) in [61],Γ L d is a (local) Poisson automorphism on A * (P α G) and therefore Γ L d : A * (P α G) → A * (P α G) preserves the linear Poisson structure on A * (P α G) as we claimed.

4.4.
Morphism, reduction and Noether symmetries. In this subsection we study the reduction of discrete second order Lagrangian systems and Noether symmetries. Consider two Lie groupoids G ⇒ Q and G ⇒ Q with structural maps denoted by α, β, i, , m and α , β , i , , m respectively. Definition 4.11. A smooth map χ : G → G is a morphism of Lie groupoids if, for every composable pair (g, h) ∈ G 2 , it satisfies (χ(g), χ(h)) ∈ G 2 and χ(gh) = χ(g)χ(h) where G 2 denotes the set of composable pairs on G ⇒ Q A morphism of Lie groupoids χ : G → G induces a smooth map that is, the following diagram is commutative, A morphism of Lie groupoids χ induces a morphism Aχ : AG → AG of their corresponding Lie algebroids and for all g ∈ G, v ∈ A β(g) G and w ∈ A α(g) G. Moreover, for X ∈ Γ(AG) and X ∈ [40] for more details). That is, X and X are "Aχ-related" if and only if their corresponding left-invariant (reps., right invariant) vector fields are χ-related.
Now consider the prolongations of G and G by the source map α and α , respectively, denoted by P α G and P α G . Definition 4.12. Let χ : P α G → P α G be a morphism of Lie groupoids and x ∈ P α G. Two covectors µ ∈ T * x (P α G) and µ ∈ T * χ(x) (P α G ) are said to be , where χ 0 : P α G → P α G denotes the smooth map on the base induced by the morphism χ and where Aχ : A(P α G) → A(P α G ) is the associated Lie algebroid morphism.
The following theorem states the reduction of discrete second order Lagrangian systems on Lie groupoids. It follows Theorem 4.5 in [43] for discrete first order systems.
Theorem 4.13. Consider two Lie groupoids G ⇒ Q and G ⇒ Q . Let L d : G 2 → R and L d : G 2 → R be a discrete second order Lagrangians, and let χ : P α G → P α G be a morphism of Lie groupoids satisfying G 2 = χ −1 (G 2 ) and L d = L d •χ | G2 . If µ ∈ T * (P α G) and µ ∈ T * (P α G ) are χ * −related, the following properties hold Proof.
Corollary 1. Let χ : P α G → P α G be a morphism of Lie groupoids.
When f = 0, we say L d is invariant with respect to Z, and the conserved quantity is F Z (µ) = FL ± d (µ), Z , and when f = 0, we say L d is quasi-invariant with respect to Z. Theorem 4.15. If Z ∈ Γ(A(P α G)) is a Noether symmetry of a discrete secondorder Lagrangian system determined by the discrete second-order Lagrangian L d : is a constant of motion where ξ = π P α G (µ). That is, if γ (g1,g2) , . . . , γ (g N −1 ,g N ) ∈ T * (P α G) satisfy the discrete second-order dynamics then, for k = 1, . . . , N − 2.
4.5. Discrete second-order constrained mechanics. Consider a discrete secondorder constrained systems, that is, given a Lie groupoid G ⇒ Q one consider the discrete second-order Lagrangian L N d : N → R defined on a submanifold N of the set of composable elements G 2 ,. The submanifold N implies that the dynamics is restricted.
From Theorem 4.3 The Lagrangian submanifold, Σ L N d is an affine bundle over N taking the projection π P α G | Σ L N d : Σ L N d → N , the restriction of the cotangent bundle projection π P α G : T * (P α G) → P α G to this Lagrangian submanifold.
Suppose that the constraint submanifold N ⊂ G 2 is given by where {Φ A } A∈I is a family of real functions defined in a neighborhood of N and I is an index set. Then, an element µ ∈ Σ L N d with (g 1 , g 2 ) = π P α G | Σ N L d (µ), can be written as where L d : G 2 → R is an arbitrary extension of L N d : N → R. In this sense, Σ L N d can be locally seen as the space consisting of the elements (g 1 , g 2 ) ∈ N together the Lagrange multipliers λ A constraining (g 1 , g 2 ) to N . Therefore, by Theorem 4.5, the sequence (g 1 , g 2 , . . . , g N , λ 1 , λ 2 , . . . , λ N −1 ), is a solution of the discrete second-order constrained Lagrangian system determined by for k = 2, . . . , N − 2 and X a vector field on G.
Remark 9. When the Lie groupoid is a Lie group, we obtain the second-order Euler-Poincaré equations for systems with constraints (see [17] for example) for k = 2, . . . , N − 2.
When the Lie groupoid is the Banal groupoid, we have , for all A ∈ I and for k = 2, . . . , N − 2. The equations given above are the discrete second-order Euler-Lagrange equations for systems with second-order constraints (see [14] for example).

5.
Conclusions and future research. In this paper, we have developed a generalized theory of discrete second-order Lagrangian mechanics from a variational point of view and we have shown how to apply this theory to the construction of variational integrators for some interesting examples of optimal control problems of mechanical systems. After that, we have shown how Lagrangian submanifolds of a symplectic groupoid (cotangent groupoid) give rise an intrinsic way to discrete dynamical second-order systems, and we have studied the geometric properties of these systems from the perspective of symplectic and Poisson geometry. Finally, we have developed the reduction by Noether symmetries, and we have studied the relationship between the dynamics and variational principles for these second-order variational problems.
In [3] we have studied optimal control problems for nonholonomic mechanical systems as second-order constrained variational problems. Let D be a non-integrable distribution defined by the nonholonomic constraints of some mechanical systems. We define the submanifold D (2) of T D by and where we choose coordinates (x i , y α ,ẏ α ) on D (2) , and where the inclusion on T D, i D (2) : D (2) → T D is given by i D (2) (q i , y α ,ẏ α ) = (q i , y α , ρ i α (q)y α ,ẏ α ). Therefore, D (2) is locally described by the constraints on T Ḋ q i − ρ i α y α = 0. The optimal control problem is determined by a smooth function L : D (2) → R given a cost functional as in Section 3. To derive the equations of motion for L one can use standard variational calculus for systems with constraints defining the extended Lagrangian L, L = L + λ i (q i − ρ i α y α ). In a future work we would like to build variational integrators as an alternative way to construct integration schemes for the type of optimal control problems studied in [3]. Since the space D (2) is a subset of T D we can discretize the tangent bundle T D by the cartesian product D × D. Therefore, our discrete variational approach for optimal control problems of nonholonomic mechanical systems will be determined by the construction of a discrete Lagrangian L d : D d is the subset of D × D locally determined by imposing the discretization of the constraintq i = ρ i α (q)y α . For instance we can consider Now the system is in a form appropriate for the application of discrete variational methods for constrained systems developed in this work from both, variational and geometrical points of view as in sections 3.2 and 4.5.
Appendix A: Higher-order tangent bundles. In this Appendix we recall some basic facts of the geometry of tangent bundle theory. For more details see [21,37].
Let Q be a differentiable manifold of dimension n. It is possible to introduce an equivalence relation in the set C k (R, Q) of k-differentiable curves from R to Q. By definition, two given curves in Q, γ 1 (t) and γ 2 (t), where t ∈ (−a, a) with a ∈ R have contact of order k at q 0 = γ 1 (0) = γ 2 (0) if there is a local chart (ϕ, U ) of Q such that q 0 ∈ U and , for all s = 0, ..., k. This is a well defined equivalence relation in C k (R, Q) and the equivalence class of a curve γ will be denoted by [γ] (k) 0 . The set of equivalence classes will be denoted by T (k) Q and it is not hard to show that it has a natural structure of differentiable manifold. Moreover, τ k Q : (k) 0 = γ(0) is a fiber bundle called the tangent bundle of order k of Q.
Appendix B: Discrete Mechanics. This appendix briefly reviews some key results of discrete mechanics (see Marsden and West [51] for more details).

A.1. Discrete Lagrangian Mechanics.
A discrete Lagrangian is a differentiable function L d : Q×Q → R, which may be considered as an approximation of the action integral defined by a continuous regular Lagrangian L : T Q → R. That is, given a time step h > 0 small enough, where q(t) is the unique solution of the Euler-Lagrange equations for L with boundary conditions q(0) = q 0 and q(h) = q 1 .
We construct the grid {t k = kh | k = 0, . . . , N }, with N h = T and define the discrete path space P d (Q) := {q d : {t k } N k=0 → Q}. We identify a discrete trajectory q d ∈ P d (Q) with its image q d = {q k } N k=0 where q k := q d (t k ). The discrete action A d : P d (Q) → R along this sequence is calculated by summing the discrete Lagrangian on each adjacent pair and defined by We would like to point out that the discrete path space is isomorphic to the smooth product manifold which consists on N + 1 copies of Q, the discrete action inherits the smoothness of the discrete Lagrangian and the tangent space T q d P d (Q) at q d is the set of maps v q d : {t k } N k=0 → T Q such that τ Q • v q d = q d which will be denoted by v q d = {(q k , v k )} N k=0 , where τ Q : T Q → Q is the canonical projection. For any product manifold Q 1 ×Q 2 , T * (q1,q2) (Q 1 ×Q 2 ) T * q1 Q 1 ×T * q2 Q 2 , for q 1 ∈ Q 1 and q 2 ∈ Q 2 where T * Q denotes the cotangent bundle of a differentiable manifold Q. Therefore, any covector α ∈ T * (q1,q2) (Q 1 × Q 2 ) admits an unique decomposition α = α 1 + α 2 where α i ∈ T * qi Q i , for i = 1, 2. Thus, given a discrete Lagrangian L d we have the following decomposition dL d (q 0 , q 1 ) = D 1 L d (q 0 , q 1 ) + D 2 L d (q 0 , q 1 ), where D 1 L d (q 0 , q 1 ) ∈ T * q0 Q and D 2 L d (q 0 , q 1 ) ∈ T * q1 Q. The discrete variational principle, or Cadzow's principle [10], states that the solutions of the discrete system determined by L d must extremize the action sum given fixed points q 0 and q N . Extremizing A d over q k with 1 ≤ k ≤ N −1, we obtain the following system of difference equations These equations are usually called discrete Euler-Lagrange equations. Given a solution {q * k } k∈Z of eq.(53) and assuming the regularity hypothesis (the matrix (D 12 L d (q k , q k+1 )) is regular), it is possible to define implicitly a (local) discrete flow Υ L d : U k ⊂ Q × Q → Q × Q, by Υ L d (q k−1 , q k ) = (q k , q k+1 ) from (53) where U k is a neighborhood of the point (q * k−1 , q * k ). Let us define the discrete Lagrangian 1-forms Θ ± L d : Θ − L d : (q k , q k+1 ) −→ −D 1 L d (q k , q k+1 ) dq k .
Then, the discrete flow Υ L d preserves the discrete Lagrangian form

LEONARDO COLOMBO AND DAVID MARTÍN DE DIEGO
Specifically, we have B.2. Discrete Hamiltonian Mechanics. Introduce the right and left discrete Legendre transformations FL ± d : Q × Q → T * Q by FL + d : (q k , q k+1 ) −→ (q k+1 , D 2 L d (q k , q k+1 )), (56a) respectively. Then we find that the Eq. (54) and (55) are pull-backs by these maps of the Liouville 1-form λ Q and the canonical symplectic 2-form ω Q , on T * Q, respectively, as follows: Let us define the momenta Then, the discrete Euler-Lagrange equations become simply p + k−1,k = p − k,k+1 . So defining p k = p + k−1,k = p − k,k+1 , one can rewrite the discrete Euler-Lagrange equations as follows: Furthermore, define the discrete Hamiltonian mapF L d : T * Q → T * Q bỹ F L d : (q k , p k ) → (q k+1 , p k+1 ).
Then, one may relate this map with the discrete Legendre transforms in Eq. (56) as follows:F Furthermore, one can also show that this map is symplectic, i.e., This corresponds to the Hamiltonian description of the dynamics defined by the discrete Euler-Lagrange equations introduced by Marsden and West in [51]. Notice, however, that no discrete analogue of Hamilton's equations is introduced here, although the flow is now on the cotangent bundle T * Q.
Appendix C: Prolongation of Lie algebroids and Mechanics on Lie algebroids. In this Appendix we recall the definition of the prolongation of a Lie agebroid τ A : A → Q over its projection map and the Euler-Lagrange equations on Lie algebroids. Further details can be found in [38], [44] and [46].
C.1. Prolongation of a Lie algebroid. Let (A, [[·, ·]], ρ) be a Lie algebroid of rank n over Q with projection τ A : A → Q. The prolongation of A over its canonical projection, also called A tangent bundle to A, is defined to be where T τ A : T A → T Q is the tangent map to τ A .
In fact, T τ A A is a Lie algebroid of rank 2n over A where τ A : T τ A A → A is the vector bundle projection given by τ (1) A (a , v a ) = τ T A (v a ) = a, and the anchor map is ρ 1 := pr 2 : T τ A A → T A, the projection over the second factor (see [38] and [46] for more details).
If we now denote by (a, a , v a ) an element (a , v a ) ∈ T τ A A where a ∈ A and where v is tangent, we rewrite the definition of the prolongation of the Lie algebroid as the subset of A × A × T A given by , v a ∈ T a A and τ A (a) = τ A (a )}.
In this sense, if (a, a , v a ) ∈ T τ A A, then ρ 1 (a, a , v a ) = (a, v a ) ∈ T a A, and the projection is given by τ (1) A (a, a , v a ) = a ∈ A. The prolongation of A over τ A takes the role of T T Q in standard Lagrangian mechanics.
Along the paper when A = AG → Q is a Lie algebroid associated to a Lie groupoid we have that T τ AG AG = A(P α G) Example. Let g be a finite dimensional real Lie algebra. g is a Lie algebroid over a single point Q = {q}. Using that the anchor map of g is zero we obtain that T τg g = {(ξ 1 , ξ 2 , v ξ1 ) ∈ g × T g} g × g × g 3g.
Such coordinates determine local functions ρ i α , C γ αβ on Q which contain the local information of the Lie algebroid structure, and accordingly they are called structure functions of the Lie algebroid. They are given by which are usually called the structure equations. Given a Lagrangian L : A → R, we fix two points q 0 , q T in the base manifold Q, then we look for admissible curves ξ : I ⊂ R → A, (i.e., curves on A such that ρ(ξ(t)) = d dt τ A (ξ(t))) satisfying the variational principle 0 = δ T 0 L(ξ(t))dt.