text:
\section{Introduction}
In  \cite{CS}  the first and the third author presented a new  proof of the  classical Pontryagin Maximum Principle (PMP) for controlled  systems,  which was crucially based on the  observation that  the  first order differential constraints  of the system  can be considered as  the Euler-Lagrange equations determined by  an appropriate controlled  first order Lagrangian.
Following the same   ideas of  that proof,   we  give here a generalisation of   the PMP to the   control problems, in which the differential constraints are given
by  Euler-Lagrange equations of higher order. \par
\smallskip
More precisely, we consider   cost minimising  problems  for  dynamical system which are controlled through  the  Euler-Lagrange  equations determined by higher order Lagrangians  with  controlling parameters, i.e. by Lagrangians   depending on appropriate controls $u^a(t)$
$$L ^{u(\cdot)}\left(t, q^i, \frac{d q^i}{dt}, \ldots, \frac{d^k q^i}{dt^k}\right) \=  L\left(t, q^i, \frac{d q^i}{dt}, \ldots, \frac{d^k q^i}{dt^k}, u^a(t)\right)\ .$$
We do not impose any  particular  assumption on the initial conditions of the solutions of the differential constraints, nor on the control curves $u(t) = (u^a(t))$, besides
merely  technical  requirements  of smoothness and  constant rank conditions on the constraints.  In fact,  in this paper we restrict  our discussion  just to  control problems satisfying  strong regularity assumptions:  this choice is  only for the purpose of making  as much as possible transparent the main ideas  of   our  approach.
An illustration  on how the main results of this paper can be generalised  under much   weaker regularity assumptions  is given in \cite{CGS1}. \par
\smallskip
 Considering   the    proof of the PMP  presented in \cite{CS} as a model,  we are able to prove that  a curve of controls $u_o(t)$ and a  set of initial conditions $\sigma_o$ for the evolution  of the controlled dynamical system  corresponds to  an optimal solution  if and only if a particular double integral is greater than  or equal to zero for any homotopy $(u(t, s), \sigma(s))$ of control curves and initial conditions, having $u_o(t) = u(t, 0)$ and $\sigma_o = \sigma(0)$ as starting point.   We   called this property  {\it Principle of Minimal Labour}. Using this and an appropriate formalisation of   Pontryagin's notion of needle variation of  control curves,  we   derive a generalisation of the classical PMP for the control problems that are subjected  to  higher order Euler-Lagrange constraints   {\it of normal type}. This is a very large class of constraints  which naturally includes the classical Mayer problems to which the usual version of the  PMP applies. Actually our  main result  provides additional  information also for the classical first order
 differential constraints  since   it allows  variations of the initial data
and establishes an innovative shortcut between the proofs of the classical PMP and the Noether
Theorem about conservation laws (see for instance the approach to Noether Theorem  based on Stokes Theorem given in  \cite{FS},  and compare  it with the  use of Stokes Theorem  in the proof of the PMP  given here and  in \cite{CS}, as  illustrated  in Sect.\ \ref{Sect2} below).   A   discussion in greater detail of  our main results  and some simple illustrations of how they can be exploited  are given  in  Sect.\ \ref{Sect2} and Sect.\ \ref{Sect8}.\par
 \smallskip
 Before concluding this introduction, we would like  to recall that,   considering an appropriate set of auxiliary variables,  any control problem  with higher order differential constraints -- even those of variational type for  which we establish our generalised PMP --  can be reduced to an equivalent   one with only   first order constraints (but, in general,  no longer of  variational type).   By  introducing other  auxiliary variables, the  Pontryagin variables $p_j$,   the original higher order problem  is finally  transformed into an equivalent one, which is now variational  and  to which the classical PMP applies.
 This  kind of  reduction  procedure
 demands the introduction of a (in general very large) collection of auxiliary   variables. In contrast with this, our generalised PMP   directly applies to any set of higher order constraints, with almost no need of  auxiliary  variables.  This is a valuable feature, which we  briefly   illustrate with  an elementary example in Sect.\ \ref{Sect8}.  More substantial  examples and applications will be discussed  in detail   in a future work.\par
 \smallskip
 This paper is structured as follows. In Sect.\ \ref{Sect2}, we  review the main results of  \cite{CS} and give an informal presentation of  the main ideas  on which  our  results  are based. A  detailed description of the Principle of Minimal Labour and of our generalisation of the PMP are also given.    In  Sect.\ \ref{Sect3} and  Sect.\ \ref{Sect4} the needed preliminaries and a rigorous definition of the class of control problem we are considering are given. In Sect.\ \ref{Sect5},  the considered control problems  are transformed into an equivalent  form, which is  more appropriate
for the subsequent manipulations. The proofs of the Principle of Minimal Labour and of our generalisation of the PMP are given in Sect.\ \ref{Sect6} and Sect.\ \ref{Sect7}, respectively. In Sect.\ \ref{Sect8}, we illustrate  some of the main features of  our approach by discussing  a couple of   elementary   problems.
\par
\medskip
\section{An overview of our approach and main results} \label{Sect2}
 Since
the results of the present paper can be considered as natural developments of the  ideas of  \cite{CS}, we decided to precede our discussion  with    a short
 overview  of  the contents of that paper.  We then  briefly indicate how the scheme of such a previous  paper is here  implemented  to obtain our new results.\par
\smallskip
\subsection{Pontryagin Maximum Principle and Stokes Theorem in a nutshell}
\subsubsection{The basic scheme of a classical Mayer problem}
\label{section211}
Consider a dynamical system, whose evolutions on a fixed time interval $[0, T]$ are represented by  curves $x(t) = (x^1(t), \ldots, x^N(t))$ in $\mathbb{R}^N$  satisfying  the differential problem
\begin{equation} \label{Mayer1} \frac{d x^i}{dt}(t) = f^i(t, x^i(t), u^a(t)) \ ,\qquad x^i(0) = x^i_o \in \mathbb{R}^N\ . \end{equation}
Here $u(t)$ is a  (measurable) function with values in a fixed subset $K$ of $\mathbb{R}^M$
$$u(t) = (u^1(t), \ldots, u^M(t)) \in K \subset \mathbb{R}^M$$
 and represents the evolution in time of  control parameters.  The  $f^i(t, x^i, u^a)$  are continuous  functions   on $[0, T] \times \mathbb{R}^N \times K$ and differentiable in the $x$. The  initial value $x_o$  is  fixed and is the same   for  all of   the evolutions of the system.  Given a  terminal cost function $C: \mathbb{R}^N \to \mathbb{R}$,  the corresponding  {\it Mayer problem}
  consists of  looking for  a curve $\bar u(t)$  of control parameters, for which  the following holds:  {\it the terminal cost $C(\overline x(T))$ of the  solution $\overline x(t)$ to   \eqref{Mayer1} with $u(t) = \overline u(t)$ is less than or equal to the terminal cost of  the solution determined by  any other   choice of the  curve  $u(t)$.}\par
Of course, this is only   one   of the many variants   of the classical Mayer problem.    But  in what follows we  limit ourselves     to such a basic  version. Moreover,  we constantly  assume that   all  the  data    satisfy  much higher regularity assumptions than those mentioned  above.  Take this restriction as  a sort of blanket assumption, which  is  adopted  to easily allow     manipulations   and prevent the risk of diverting  the attention of the reader towards inessential  technical issues.\par
\subsubsection{The  auxiliary variables $p_i$}  \label{Cardinuccio} The classical approach to  a  Mayer problem is usually based on  the  introduction of a set of    auxiliary variables  $p_1, \dots, p_N$
and on the representation of  the dynamical system  through curves
$(x(t), p(t)) =   (x^i(t),   p_j(t))$ in $\mathbb{R}^{2N}$ (of which, however,   only  the  $x^i(t)$ are the   interesting ones),   constrained by  the  \eqref{Mayer1}   {\it and} the auxiliary   equations
\begin{equation}  \label{Mayer2} \frac{d p_j}{dt} \=- \sum_{i = 1}^N p_i(t)  \frac{\partial f^i}{\partial x^j}\bigg|_{(t, x^i(t), u^a(t))} \ .\end{equation}
The introduction of the auxiliary  variables $p_j$ and of the  new constraints \eqref{Mayer2}  has the following effect:  {\it for each  curve of control parameters  $u(t) = (u^a(t))$,  the constraints on the corresponding curve $(x(t), p(t)) $  are    the Euler-Lagrange equations of the  variational principle determined by the (controlled) Lagrangian }
\begin{equation}  \label{classical-lagrangian}L ^{u(\cdot)} (t, p, x, \dot x)= \sum_{j = 1}^N p_j(\dot x^j - f^j(t, x, u(t))) \ .\end{equation}
{\it This Lagrangian has also the special  feature of being identically vanishing along the solutions of the corresponding  Euler-Lagrange equations (in fact the $x^i(t)$ satisfy the \eqref{Mayer1}).}\par
All this has  the consequence   that  the original cost minimising problem   is   equivalent to the following  one.  By subtracting a constant,  with no loss of generality we may  assume that $C(x_o) = 0$. Hence by the vanishing of $L^{(u(t))}$ along the constrained curves,  the value on such curves of the functional
\begin{equation} \label{action1} I^{(u(\cdot))} \= \int_0^T  \bigg(L ^{u(\cdot)} (t, p, x, \dot x) + \sum_{i = 1}^N \frac{\partial C}{\partial x^i }\bigg|_{(t, x(t))}  \dot x^i(t) \bigg) dt\end{equation}
appears to be  equal to
\begin{equation} \label{smart-1} I^{(u(\cdot))} = \int_0^T  \frac{d C(x(t))}{dt}\bigg|_{(t, x(t))} dt = C(x(T)) - C(x(0)) \overset{C(x_o) = 0}= C(x(T))\ . \end{equation}
Thus the original problem turns out to be the same of {\it looking for a curve of controls $u(t) = (u^a(t))$ such that, along the solution of the Euler-Lagrange equations of $L ^{u(\cdot)} $,   the  functional}
 $I^{(u(\cdot))}$
{\it takes the minimum possible value}. \par
\smallskip
We also observe  that, along the solutions $(x(t), p(t))$, the value of the above action  is   independent of  any  boundary (initial or final) conditions for the  $p_j(t)$.   This means that {\it any} value at $t = 0$ (or at $t = T$) can be  imposed  on the  $p_j(t)$, having  absolutely  no consequences on the minimising problem.  As we will see in the next two subsections,  among all of the possible choices for such boundary conditions,  some    are much more   convenient than the others.  \par
\subsubsection{A smart choice for the boundary values  of the  $p_i$}\label{smart-2} Consider  a homotopy of control curves $u^{(s)}(\cdot): [0, T] \to K$, $s \in [0,1]$,  and denote by
$(x^{(s)i}(t), p_j^{(s)}(t))$ the corresponding homotopy of curves satisfying the constraints  \eqref{Mayer1} and \eqref{Mayer2}.   Exploiting our  blanket assumptions on the  regularity of the  data,  we may say  that  the first order jets  $(x^{(s)i}(t), \dot x^{(s)i}(t), p_j^{(s)}(t), \dot p_j^{(s)}(t))$,  determined by the pairs  $(t, s)  \in [0, T] \times [0,1]$,   span a  smooth surface $\mathscr{S}$ in the first order jet space  of curves in $\mathbb{R}^{2N}$, whose boundary is formed
by four smooth curves. We denote them by  $\gamma^{(s=0)}(t) $, $\gamma^{(s=1)}(t) $, $\eta^{(0)}(s)$ and $\eta^{(T)}(s)$. \\
 \centerline{
\begin{tikzpicture}
\draw[fill]  (0.5, 0.2) circle [radius = 0.05];
\draw[fill]  (3.8, 0.7) circle [radius = 0.05];
\draw[fill]  (0.25, 2.3) circle [radius = 0.05];
\draw[fill]  (3.7, 2.85) circle [radius = 0.05];
\node at  (2, 2.85) {\color{blue} \tiny $\gamma^{(s = 1)}(t)$};
\node at  (2, 0.55) {\color{blue} \tiny $\gamma^{(s= 0)}(t)$};
\node [blue] at   (0, 1) {\tiny$\eta^{(0)}(s)$};
\node [blue] at   (4.1, 1.7) {\tiny$\eta^{(T)}(s)$};
\node [red] at  (2, 1.8) {$\mathscr{S}$};
\draw [ thin, blue] (0.5, 0.2) to [out=45, in=180] (2,0.85) to [out=0, in=207] (3.8, 0.7)  ;
\draw [ ->, thick, blue] (2, 0.85) to  (2.02, 0.85)  ;
\draw [ thin, blue] (0.25, 2.3) to [out=45, in=180] (1.5, 2.65) to [out=-5, in=207](3.7, 2.85)   ;
\draw [ ->, thick, blue] (2, 2.61) to  (2.02, 2.61)  ;
\draw [ thin, blue] (0.5, 0.2) to [out=65, in=290] (0.25, 2.3)  ;
\draw [ ->, thick, blue] (0.52, 1.5) to  (0.515, 1.51)  ;
\draw [ thin, blue] (3.8, 0.7) to   [out=155, in=270] (3.3, 1.7) to
 [out=90, in=310]  (3.7, 2.85)  ;
\draw [ ->, thick, blue] (3.3, 1.7) to  (3.3, 1.71)  ;
\draw [ thin, red] (0.56, 1.25) to [out=45, in=180] (1.5, 1.66) to [out=-5, in=207](3.3, 1.8)   ;
\draw [ thin, red] (0.61, 0.75) to [out=45, in=180] (2, 1.26) to [out=-5, in=207](3.35, 1.15)   ;
\draw [ thin, red] (0.44, 1.9) to [out=45, in=180] (2, 2.31) to [out=-5, in=207](3.63, 2.3)   ;
\draw [ ->, thick, red] (2, 2.31) to  (2.1, 2.31)  ;
\draw [ ->, thick, red] (2, 1.26) to  (2.1, 1.26)  ;
\draw [ ->, thick, red] (2.2, 1.61) to  (2.3, 1.61)  ;
 \end{tikzpicture}
 }
  \centerline{\tiny \bf Fig. 1}
The first  two curves correspond to the sides $[0,T] \times \{0\}$,  $[0, T]\times \{1\}$ of  $\partial([0, T] \times [0,1])$:
$$\gamma^{(s=0)}(t) = (x^{(0)i}(t), \dot x^{(0)i}(t),  p_j^{(0)}(t), \dot p_j^{(0)}(t))\ ,$$
$$ \gamma^{(s=1)}(t) =(x^{(1)i}(t), \dot x^{(1)i}(t),  p_j^{(1)}(t), \dot p_j^{(1)}(t))\ .$$
The others  are the curves that correspond  to the remaining  two sides  $\{0\} \times [0,1]$,  $\{T\}\times[0,1]$  of  the boundary of  $[0, T] \times [0,1]$.
We call them the {\it vertical sides} of  $\mathscr{S}$.  In \cite{CS} it was observed that {\it if one imposes that the  $p_j(t)$  satisfy the terminal values conditions
\begin{equation} \label{smart} p_j(T) = - \frac{\partial C}{\partial x^j}\bigg|_{(x(T))}\ ,\end{equation}
 then the integrals of  the $1$-form $\b = \left(L ^{u(\cdot)}(t, p, x, \dot x)  + \sum_{i = 1}^N \frac{\partial C}{\partial x^i }|_{(t, x(t))}  \dot x^i(t)\right) dt$  along the  two vertical sides $\eta^{(0)}(s)$,  $\eta^{(T)}(s)$ of $\mathscr{S}$ (or, more precisely, of an appropriate modification  of $\b$, modelled on  the classical Poincar\'e-Cartan  $1$-form) are   equal to $0$.} \par
 \smallskip
This is an important property, because in combination  with \eqref{smart-1}   it  implies that the integral  of (the Poincar\'e-Cartan type modification of) $\b $  along the anti-clockwise oriented boundary  $\partial \mathscr{S}$ is  equal  to $ - C(x^{(1)}(T)) + C(x^{(0)}(T))$. On the other hand, by Stokes Theorem, such an  integral  is equal to the  integral  of  the exterior differential of the Poincar\'e-Cartan type modification of $\b$ on $\mathscr{S}$.  By exploiting certain properties of the  actions and  of the $1$-forms of Poincar\'e-Cartan type  (it is not essential  to recall them here - in Sect.\ \ref{encapsulating}   we  discuss them in greater detail),  such an integral  reduces to  a very simple form, namely to
\begin{equation} \label{astast}  \begin{split} C(x^{(1)}(T)) - C(x^{(0)}(T))= &- \iint_{t\in [0,T], s\in [0,1]}\frac{{\partial \mathscr{H}}}{ \partial u^a }\frac{\partial u^a }{\partial s}\bigg|_{(t, x^{(s)i}(t), p^{(s)}_j(t), u^{(s)a}(t))}\, dt\, ds\ ,\\
& \text{where}\ \mathscr{H}(t, x^i, p_j, u^a) \= - \sum_{j = 1}^N p_j f^j(t, x^i, u^a)\ .
\end{split}
\end{equation}
The main reason of interest for this identity comes from the fact that  {\it it expresses  the difference between the two terminal costs as  a double integral of an appropriate  function of the   parameters $(t,s)$ of the  homotopy.}   From our point of view, this is   a cornerstone in the  proof of the PMP.
\par
\subsubsection{The Principle of Minimal Labour and the Pontryagin Maximum Principle}
\label{section2.1.4} An immediate consequence of \eqref{astast} is the following:
\\[10pt]
 {\bf Principle of Minimal Labour}. {\it If the curve $\bar u(t) \in K$ gives a solution to the considered Mayer problem, then for any other curve $u(t)$ which is connected to $\overline u(t)$ through an homotopy  of curves $u^{(s)}(t)$ in $K$, the double integral on the left hand side of  \eqref{astast} is less than or equal to $0$}. \\[10pt]
  By   considering   appropriate  highly localised deformations of the curve  $\bar u(t)$  (the so-called {\it Pontryagin's needle variations}  -- see \cite{CS} or Sect.\ \ref{generalisedneedle}  below  for details) and associated interpolating homotopies,   the classical PMP can be derived as  if a `pointwise version'  of the  above principle. Indeed,  adopting a very informal language, we may state the {\bf Pontryagin Maximum Principle}  as follows (the literature on such a  classical principle is vast -- for  extensive  and fundamental presentations we refer to  \cite{PBGM, Su3, Ju, AS, BP, Ce} and references therein): \\
 [10pt]
 {\it  If  $\bar u(t) \in K$ gives a solution $(x^i(t))$ to the considered Mayer problem, then for any $t_o \in [0,T]$ the value of  $\mathscr{H}$ at  the point $(t_o, x^i(t_o), p_j(t_o), \bar u^a(t_o))$
   is maximal among all the  values that  it assumes at the points  $(t_o, x^{(\o)i}(t_o), p^{(\o)}_j(t_o), \o^a)$ determined by
   \begin{itemize}
   \item[(i)]  replacing   $(\bar u^a(t_o))$ by some other value  $(\o^a)\in K$,
   \item[(ii)]   substituting   the values $x^i(t_o)$ and  $p_j(t_o)$ by the values
   $x^{(\o)i}(t_o)$ and $p^{(\o)}_j(t_o)$, which are  assumed by  the  solution  $(x^{(\o)i}(t), p^{(\o)}_j(t))$  at $t_o$ of the  constraints determined by a control curve $u^{(\o)}(t)$   taking the value  $u^{(\o)}(t_o) = \o$ in an infinitesimal  neighbourhood of   $t = t_o$ and  coinciding with the original  $\bar u(t)$ at all other points.
   \end{itemize}
   }
\par\smallskip
\subsection{Our road map  towards the main results}\hfill\par
\label{roadmap}
Let us now focus on the following two facts, pointed out  in  the above summary of  \cite{CS}.
\begin{itemize}[leftmargin = 20pt]
\item[(1)] The   problems,  to which the classical PMP applies,  are costs minimising problems on curves $x(t) = (x^i(t))$ that are controlled by means of  {\it first order differential equations with parameters}.
\item[(2)]  By introducing  auxiliary variables  $p_j$ and an appropriate family of controlled Lagrangians   $L^{u(\cdot)}(t, p, x, \dot x)$, the differential constraints of the original control problem are    replaced by
the Euler-Lagrange equations of such Lagrangians.
\item[(3)] The   Lagrangians  $L^{u(\cdot)}(t, p, x, \dot x)$ have the following   peculiar property: {\it they vanish identically   along  the solutions of  their corresponding Euler-Lagrange equations}.  This is a crucial fact that leads to the identity
\eqref{smart-1}.
\item[(4)]  If  appropriate boundary conditions are imposed on the  $p_j(t)$,  then for any given homotopy $u^{(s)}(t)$ of   control curves,
the integrals of the actions of Poincar\'e-Cartan type along the ``vertical sides'' $\eta^{(0)}(s)$,  $\eta^{(T)}(s)$ of  the surface in Fig.\ 1  are identically vanishing. This property  together with (3) leads to the  identity \eqref{astast},
which expresses  the difference between two terminal costs as a  double integral of an appropriate function of the parameters of the homotopy.
\item[(5)]   The identity \eqref{astast} immediately gives the Principle of Minimal Labour, from which the PMP is derived   using   highly localised  (needle)  variations. In a sense, the Principle of Minimal Labour can be taken as an  underlying substratum  for the PMP.
\end{itemize}
In this paper we consider a special class of cost minimising problems, in which the  curves  are constrained  by  {\it differential equations of  higher  order and of variational type}, that is  by  Euler-Lagrange  equations of  controlled Lagrangians of higher order (Sect.\ \ref{definingtriples}).  For such problems we are able to   follow the same circle of ideas described above and, at the end, we reach  a
generalised version of the PMP that works for  this wider class of cost minimising problems.  \par
We remark that, since  our  differential constraints   are assumed to be  of  Euler-Lagrange type,  there is no need  to introduce     auxiliary variables and  new constraints in order  to obtain the  property described in the point (2) above: It is  granted from the very beginning. However,  since  we are no longer requiring that the  controlled Lagrangian is of  a very  special form,  the crucial phenomena described in the points  (3) and (4)  are in general not occurring.    We nonetheless manage to  overcome this difficulty through the following  two  steps.
\begin{itemize}[leftmargin = 20pt]
\item[(a)] We consider  a special set of functions, denoted by ${\bf h}^i_\b(t)$, ${\bf h}'{}^i_\b(t)$ and  ${\bf h}''{}^i_\b(t)$,  which are completely determined  by  the initial and  the terminal  points of each   controlled  curve. Such  new  functions are  used in a convenient way to   modify the controlled Lagrangian  and  obtain an analogue of   the phenomenon described in (4)  (Sect.\ \ref{encapsulating-bis-A}).
\item[(b)] We  introduce  two auxiliary variables, called $\l$ and $\mu$, and we further adjust   the   Lagrangian  in order to obtain a new controlled Lagrangian. The purpose of this is to get  an additional  property, which is analogous  to the one described  in    (3). As a consequence,   we get an identity of the form   \eqref{smart-1}  (Sect.\ \ref{encapsulating}). We  stress the fact that the introduction of  the new variables  $\l$ and $\mu$ is a merely technical expedient  and that
 such variables  do not occur  in the statements of the final  results.
\end{itemize}
The modifications described in  (a) and (b) have been found   by heuristic arguments.   We  do not know   whether these  are the only possible ones and/or   there  are deep reasons for   why they work (\footnote{We guess that  a more elegant approach should exist. For instance,  the idea we used for the modifications  described in (b)
 calls to mind   a  well known trick, which is usually exploited  to translate   a    Bolza problem into  a  Mayer problem (see e.g.  \cite{BP}, p.\ 116).}).  Nonetheless  for the purposes  of the present paper we only need   to  know that they work. In fact, we would like to stress that  their main use  is basically  to re-write  the sum of a particular  surface integral and of   two  boundary line integrals  into a single surface integral. This yields  an elegant expression  for the Principle of Minimal Labour, which nonetheless  is by no means the only possible one. Other   different equivalent  statements are admissible,  which  can be proven  with no need of the above mentioned modifications, but have the disadvantage of  being much  more involved.  \par
\smallskip
Performing the steps (a) and (b) and  following  essentially the   same ideas used in \cite{CS}   we   finally  get  the desired   analogues of the Principle of Minimal Labour and of the  PMP (Sect.\ \ref{generalisedneedle}).  An    informal description of such results is given  in the next subsection.  \par
\smallskip
We conclude inviting the reader   to consider the outline of this section  as a road map for the following constructions and  to constantly  keep  it  in mind while going  through the rest  of  the  paper. \par
 \smallskip
\subsection{Main results} \hfill\par
The outcomes of the above described approach are basically two. The first is a principle  (Theorem \ref{corollone}) that can be considered as a generalisation  of the first version of the Principle of Minimal Labour proved in  \cite{CS}. It  can be   described  as follows.\\[10pt]
 {\bf  Principle of Minimal Labour}. {\it Consider a terminal  cost minimising problem for evolutions $q(t) = (q^i(t))$, $t \in [0,T]$, which are constrained by  a set of smooth equations on the initial values and by a system of ordinary differential equations  of  Euler-Lagrange  form
 $$\frac{\partial L^{u(\cdot)}}{\partial q^i}\bigg|_{q(t)} + \sum_{\b= 1}^r (-1)^\b \left(\frac{d}{dt}\right)^\b\left(\frac{\partial L ^{u(\cdot)}}{\partial \frac{d^\b q^i}{dt^\b}}\right)\bigg|_{q(t)} = 0\ .$$
 Here, $L ^{u(\cdot)} = L ^{u(\cdot)}(t, q^i, \frac{d q^i}{dt}, \ldots, \frac{d^r q^i}{dt^r})$ is a family of Lagrangians of order $r \geq 1$, which   smoothly  depends on the values of  a curve $u(t) = (u^a(t))$ of control parameters. \par
A  curve $\bar u(t)$ and   admissible initial conditions determine   a solution for the considered  cost minimising problem only if  for any other curve $u(t)$ and any other set of admissible initial conditions, which  can be  joint to  the previous  by a smooth one-parameter deformation,  the following inequality holds
  \begin{equation} \label{formulacor-intro}  \int_0^T \left( \int_0^1    \left( \frac{\partial \mathscr{P}_{(t,s)} }{\partial u^a} \frac{\partial u^{(s)a}}{\partial s} \Bigg|_{u^{(s)}(t)} - \frac{\partial^2 \mu'}{\partial t\,\partial s}\bigg|_{(t,s)}\right)ds \right) dt \leq 0 \ .\end{equation}
  Here:
\begin{itemize}[leftmargin = 15pt]
\item $s \in [0,1]$ is the parameter of the smooth deformation of initial data and control curves and  $\frac{\partial u^{(s)a}}{\partial s} $ are the derivatives with respect to $s$ of the components of  the curves $u^{(s)}(t) = (u^{(s) a}(t))$
of  such deformation;
\item $\mathscr{P}_{(t,s)} $ is the two-parameters family of  functions of the values  $u = (u^a)$ defined by
$$\mathscr{P}_{(t,s)}(u) = - L^{u(\cdot) \equiv u}\left(t, q^{(s)i}(t), \frac{d q^{(s)i}}{dt}\bigg|_t, \ldots, \frac{d^r q^{(s)i}}{dt^r}\bigg|_t\right)\ ,$$
where  $(q^{(s)i}(t))$ denotes  the  evolution of the system, which is  determined by the control curve $u^{(s)}(t)$ and the initial  data associated with  the deformation parameter  $s$;
\item  $ \mu' =  \mu'(t, s)$ is the function which is defined in    \eqref{7.17'};   it  is indeed the time  integral between $0$ and $t$   of  a certain function, which is explicitly  given in that formula and it is determined by  the following  three sets of objects:
\begin{itemize}
\item[(A)]  the curves $u^{(s)}(t)$ of the homotopy  of the control curves;
\item[(B)]  the values and the derivatives  up to the  order $2r$ of the  curves $(q^{(s)i}(t))$;
\item[(C)] the infinitesimal variations  of the terminal costs  of these curves w.r.t. $s$.
\end{itemize}
\end{itemize}
}
 For a  classical Mayer problem, where  the dynamical system is described by curves
 \begin{equation}  q(t)= ( x^i(t), p_j(t))\qquad \text{with}\qquad p_j(T) = - \frac{\partial C}{\partial x^j}\big|_{(x(T))}\ ,\end{equation}
   the above  principle  radically simplifies. More precisely one has that:
\begin{itemize}[leftmargin = 15pt]
\item[(1)] For any homotopy $q^{(s)}(t)$ of controlled curves of the above type, the  double integral  $\int_0^T \int_0^1 \frac{\partial^2  \mu'}{\partial t\,\partial s}\big|_{(t,s)}ds\,  dt$ in \eqref{formulacor-intro}  vanishes.   In fact,    the    end-point constraints on the   $p_j$
force the components  $p_j(t,s) \=    p^{(s)}_j(t)$ of each homotopy $q^{(s)}(t)= ( x^{(s)i}(t), p^{(s)}_j(t))$ to play the role of surrogates  for the    $\mu'(t, s)$. Indeed  each $p_j(t,s)$    is
uniquely  determined by  the curves $u^{(s)}(t)$ and  $x^{(s)}(t) = (x^{(s)i}(t))$,  and  by
 the infinitesimal variations  of the terminal costs at $t = T$. This occurs in perfect  analogy with the properties  (A), (B), (C) of the function  $\mu'(t,s)$.
\item[(2)] The partial derivatives  $ \frac{\partial \mathscr{P}_{(t,s)} }{\partial u^a}$ coincide with the partial derivatives $\frac{{\partial \mathscr{H}}}{ \partial u^a }$.
\item[(3)] The  principle we just mentioned reduces to the  Principle of Minimal Labour  presented in  \cite{CS}  (see Sect.\ \ref{classicalPMP} below for details).
\end{itemize}
In contrast with all this,  for  other kinds of  cost minimising  problems,   no analogues of the auxiliary variables  $p_j$ are involved and  the
term $\int_0^T \int_0^1 \frac{\partial^2    \mu'}{\partial t\,\partial s}\big|_{(t,s)}ds  dt$ in \eqref{formulacor-intro}  cannot    be expected to be  zero. \par
\smallskip
The second main result of our paper is obtained by applying   the above Generalised Principle of Minimal Labour to
the case of  highly localised (``needle'') variations.  Indeed, what we obtain can be  considered as  an analogue of the classical PMP  for the above mentioned  large class of the higher order Euler-Lagrange constraints    {\it of normal type} (see Sect.\ \ref{defnormal} for the precise definition). It  consists of a  necessary condition for a  control curve  $u_o(t)$ in order to determine an  optimal solution $\gamma_o$ and   can be roughly described as follows.   {\it Let   $\mathscr{P}$ be    the  function on $K$ defined by
$$
 \mathscr{P} : K \longrightarrow \mathbb{R} \ ,\qquad  \mathscr{P}(u^a) \= -   L\bigg(t,  \gamma_o(t), \ldots, \frac{d^r \gamma}{dt}, u^a\bigg)\ . $$
Then, $u(t)$ gives an optimal solution $\gamma_o$  only if,  for any $\t \in [0, T]$ and any $\o \in K$,  for  which the curve $u_o(t)$ admits a smooth  deformation $u_{(s)}(t)$ of needle type   around $t = \t$ with $u_{s = 1}(\t) = \o$, the following inequality  holds }
 \begin{equation}  \label{PO} \mathscr{P}(\o)  -  \liminf_{\varepsilon \to 0^+}  \frac{  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) -  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 0) }{\varepsilon}   \leq \mathscr{P}(u_o(\t))\ .\end{equation}
Here,   $ \liminf_{\varepsilon \to 0^+}  \frac{  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) -  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 0) }{\varepsilon}  $ is a corrective term,  which can be  determined by means of the data of  the needle variation, namely: (i) the point   $t = \t$ where it is applied, (ii) the width $\varepsilon$, (iii) the top value $\o$ and  (iv) the $1$-parameter family $\Sigma$ of initial or terminal values for some variables, as e.g. the conditions \eqref{smart} in the  classical Pontryagin setting (see Sect.\ \ref{Sect7} for details).  For  the  classical Mayer problems with first order constraints,  the above corrective term is   zero and the resulting  condition   \eqref{PO} on the function $\mathscr{P}$ reduces   to the  usual  PMP on  the Pontryagin function $\mathscr{H}$.   For what concerns  more general cases with higher order constraints,  we offer a   characterisation of the needle variations,   which  allow to neglect such corrective term. This  yields to an alternative version  of the usual PMP, which we briefly  illustrate   and compare with the classical PMP  through the discussion  of an elementary example  in Sect.\ \ref{Sect8}.
\par
\medskip
\section{Preliminaries}\label{Sect3}
 \subsection{Notational issues} \label{notation}\hfill\par
 Throughout this paper, we consider a dynamical system, whose states are represented by the
 points of an appropriate $N$-dimensional  {\it manifold}  $\mathscr{Q}$,  which might be for instance a configuration space or a  phase space for the system.  A generic set of local coordinates on $\mathscr{Q}$ will be  usually denoted by  $(q^i)_{i = 1,  \ldots, N}$, so that the evolutions in time  of our system  correspond  to  parameterised curves with  coordinate expressions of the form
 $q(t) = (q^1(t), \ldots, q^N(t))$ for $t$ in a fixed interval  $I \subset \mathbb{R}$. \par
Any such curve is  uniquely associated with the corresponding  parameterised graph
\begin{equation} \label{graph} \gamma:  I \subset \mathbb{R}  \longrightarrow     \mathbb{R} \times \mathscr{Q} \ ,\qquad \gamma(t) = (t, q(t))\ ,\end{equation}
i.e.   the  associated local section of the trivial bundle $\mathbb{R} \times \mathscr{Q}$ over  $\mathbb{R}$. Due to this,  from now on {\it we   identify any  evolution of our  system   with   the associated  map  $t  \mapsto \gamma(t) =  (t,q(t))$}.  \par
\par
For any   such a  map $\gamma:  I \to \mathbb{R} \times \mathscr{Q}$ of class $\mathcal{C}^n$, $n \geq 1$,  we denote by    $j^n_{t_o}(\gamma)$ its $n$-th order jet at the time $t_o$. For a classical reference on jets, see for instance \cite{Sa} (\footnote{For convenience of the  reader,  it might be convenient to  briefly mention  what we are going  to adopt  as   definition of an $n$-th order  jet of a curve $\gamma$ in $\mathbb{R} \times \mathscr{Q}$ at a point  $t_o$. It   is  the equivalence class of all the curves of the form $\eta:]-t_o- \d, t_o + \d[ \longrightarrow \mathbb{R} \times \mathscr{Q}$, whose components in some (thus, in any) set of coordinates have    values and    derivatives up to order $n$ at $t_o$ equal to those of $\gamma$ at such a point.}). The collection
of all these $n$-th order jets has a  natural structure of smooth manifold and it is called the {\it jet bundle of order $n$} of the  (trivial) bundle $\mathbb{R} \times \mathscr{Q}$ over $\mathbb{R}$. We denote it by $J^n(\mathscr{Q}|\mathbb{R})$.  \par
For a fixed chart $(q^i): \mathscr{U} \to \mathbb{R}^N$ on some open set $\mathscr{U} \subset \mathscr{Q}$, we  may consider the map  which sends
 each jet $j^n_{t}(\gamma)$ into the $\widetilde N$-tuple,  $\widetilde N \= N(n +1)+1$,
$$j^n_t(\gamma) \longmapsto \left(t, \, q_{(0)}^i(t) \= q^i(t),\, q^i_{(1)}(t) \= \frac{ d q^i}{dt}\bigg|_t,\,  q^i_{(2)}(t) \= \frac{ d^2 q^i}{dt^2}\bigg|_t,\, \ldots, \, q^i_{(n)}(t) \= \frac{ d^n q^i}{dt^n}\bigg|_t\right)\ .$$
This map is well known to be  a (locally defined) system of coordinates for $J^n(\mathscr{Q} | \mathbb{R})$.  In a short notation,  we  denote such coordinates by
$$(t, q^i_{(\b)}) =  (t,  q^i_{(0)}, q^i_{(1)},  \ldots, q^i_{(n)} )\ $$
and we  call them {\it  canonical jet coordinates} determined by the  coordinates  $(q^i)$ of $\mathscr{Q}$. \par
\smallskip
For any   $\gamma(t) = (t, q^i(t))$,   the   {\it  $n$-th order lift of $\gamma$}  is the  corresponding  curve of jets
$$\gamma^{(n)}: I\longrightarrow J^n(\mathscr{Q}|\mathbb{R})\ ,\quad \gamma^{(n)}(t) \= j^n_t(\gamma) =  (t, q^i_{(\b)}(t)) = \left(t, q^i(t), \frac{d q^i}{dt}\bigg|_t, \dots,  \frac{d^n q^i}{dt^n}\bigg|_t\right)\ .$$
\par
We denote by $K \subset \mathbb{R}^{M}$   a fixed set  of  real $M$-tuples  $u = (u^a)$.  In what follows, a  (continuous or $k$-differentiable) curve $t \mapsto u(t)$ with values in $ K$    plays the role of  a  {\it control} for our system.
 We stress the fact  that, in the literature, the terms ``control'', ``control parameter''  or ``control value''  is usually adopted to refer just to  a single value of the curve $u(t)$,  not to  the  curve $u(\cdot)$ as a whole, in contrast with what   we  do  in this paper. We hope that this will not be a source of confusion. \par
We always  assume that   $K$   is   the closure of a bounded open subset of $\mathbb{R}^M$ and that  the boundary $\partial K$ is smooth. This  assumption is mainly made  for the sake of simplicity, since   most of our arguments can be  generalised to a large class  of more  general situations and  under  weaker regularity assumptions.
\par
\smallskip
\subsection{Controlled Lagrangians and controlled Euler-Lagrange operators}\label{problems} \hfill\par
 Let us consider a    {\it (smooth) Lagrangian with controls}, that is a $\mathcal{C}^\infty$  function
 $$L =  L(t, q^i_{(\b)}, u^a) : J^n(\mathscr{Q}|\mathbb{R}) \times K \to \mathbb{R}$$
  depending  on
 \begin{itemize}
  \item  the coordinates   $(t, q^i_{(0)}, q^i_{(1)}, \ldots, q^i_{(n)})$ of the   $n$-th jets in $J^n(\mathscr{Q}|\mathbb{R})$,
 \item  the parameters $u = (u^a)$ arbitrarily varying in $K \subset \mathbb{R}^M$.
 \end{itemize}
 If there is an integer $r$ such that $L$ is independent on all of the  jets coordinates   $q^i_{(\b)}$ with $\b \geq r+1$, we say  that {\it $r$ is the actual order of $L$}.
 For example,  the function
 $$L(t, q^i_{(\b)}, u^a)  = (\sum_{a= 1}^M u^a)\frac{1}{2} \sum_{i = 1}^N (q^i_{(1)})^2 -   \frac{1 }{2}\sum_{i =1}^N (q^i)^2 $$
 can be surely  considered as  a Lagrangian with controls on  any controlled jet space $J^n(\mathscr{Q}|\mathbb{R}) \times K$  of order   $n \geq 1$.  If  we decide  that our   working  ambient is $J^n(\mathscr{Q}|\mathbb{R})$ for some $n$ which is strictly larger than $1$,   the property that  $L$  is   independent   of   the jet coordinates  $q^i_{(2)}$, $q^i_{(3)}$, \ldots,   is synthetically expressed  by  saying that   {\it  $r = 1$ is the actual order  of $L$}.\par
 \smallskip
 In our discussions, we will always assume that  the order $n$ of the controlled jet space $J^n(\mathscr{Q}|\mathbb{R}) \times K$ is  sufficiently    larger than
 the actual order $r$ of the considered Lagrangian  $L$. This is needed for letting  all of the operators considered in this paper (as, for instance, the Euler-Lagrange operator described below) to be meaningful.
As we will shortly  see, we just  need  that the order  of the   jet space $J^n(\mathscr{Q}|\mathbb{R})$   satisfies  the following inequality
\begin{equation}\label{crucialineq}   2 r + 1 \leq n\ ,\end{equation}
which, from now on,  we  constantly and tacitly assume to be  satisfied
 (\footnote{This  assumption could have been safely  omitted  if we considered the infinite jet spaces $J^\infty(\mathscr{Q}|\mathbb{R})$ in place of  finite order jet spaces $J^n(\mathscr{Q}|\mathbb{R})$.  However this would  have  forced us to  work with    infinite-dimensional manifolds, a category  that, for simplicity of the exposition, we prefer   to leave  undisturbed.  }).\par
 \smallskip
The  {\it  controlled Euler-Lagrange operator}  is the  $N$-tuple  $E = (E_i)_{i = 1}^N$  of  differential operators, acting  on any controlled Lagrangian $L$ of actual order $r$,
defined by
 \begin{equation} \label{controlledEL} E_i(L) \= \frac{\partial L}{\partial q^i} + \sum_{\b= 1}^r (-1)^\b \left(\frac{d}{dt}\right)^\b\left(\frac{\partial L}{\partial q^i_{(\b)}}\right)\ ,\qquad i = 1, \ldots, N\ . \end{equation}
 Here, the symbol $\frac{d}{d t}$ denotes  the  {\it total derivative operator}, that is  the operator that transforms any  function $f: J^n(\mathscr{Q}|\mathbb{R}) \times K \to \mathbb{R}$ {\it  of  actual order  $r' \leq n-1$}  into  the function
\begin{equation} \label{totalderiv}
 \frac{d f}{dt}:J^n(\mathscr{Q}|\mathbb{R}) \times K \longrightarrow \mathbb{R}\ ,\qquad\frac{d f}{dt}\bigg|_{(t, q^i_{(\b)})}\=
\frac{\partial f}{\partial t}\bigg|_{(t, q^i_{(\b)})}  + \sum_{\smallmatrix 1 \leq j \leq N\\0 \leq \d \leq r' \endsmallmatrix}\frac{\partial f}{\partial q^j_{(\d)}} q^j_{(\d+1)}\bigg|_{(t, q^i_{(\b)})}  \ .
\end{equation}
 Such an operator is  called  ``total derivative''  simply because,   for any    curve    $ (\gamma(t), u(t))  \in (\mathbb{R} \times \mathscr{Q} \times K)^{[0,T]}$  with constant $u(t) \equiv u_o$, the evaluation of  $ \frac{d f}{dt}$  at the points of the  curve of jets $(\gamma^{(n)}(t), u(t) = u_o)$ is equal to
\begin{equation} \label{3.2-1} \frac{df}{dt}\bigg|_{(\gamma^{(n)}(t), u_o)} = \frac{d }{dt} \left(f(\gamma^{(n)}(t), u_o)\right)\bigg|_t\qquad \text{for each} \ t \in [0, T]\ ,
\end{equation}
i.e.  it  coincides with  the  derivative with respect to $t$ of the map  $t \mapsto f( \gamma^{(n)}(t), u_o)$.\par
\smallskip
Notice that:
\begin{itemize}[leftmargin = 10pt]
\item The total derivative  raises the actual order of a function of at most one unit and  the iterated
total derivatives $\left(\frac{d}{dt}\right)^\b$,   $1 \leq  \b \leq r$, raise the actual orders of at most   $r$ units.
This is one of the reasons why we assume \eqref{crucialineq}. Other reasons for this come from the fact that certain  arguments of the proof of  Lemma \ref{pcprop} below  work nicely  only if   $2r$  is actually {\it strictly} less than $n$.
\item What we    call    ``controlled Euler-Lagrange operator''  is  {\it almost} the same of   the    Euler-Lagrange operator of  the classical  theory of variations. The only difference with respect to the usual one is that   the   operators  $E_a {=} \frac{\partial} {\partial u^a} + \sum_{\b= 1}^r (-1)^\b \left(\frac{d}{dt}\right)^\b\big(\frac{\partial }{\partial u^a_{(\b)}}\big)$, $1 \leq q \leq M$,
corresponding to   the infinitesimal variations of the  coordinates  $u^a$, are here  missing.
\end{itemize}
 \par
  \medskip
 \section{Defining triples and generalised Mayer problems}\label{Sect4}
 \label{definingtriples}
We are now able  to  delineate  in detail  the particular class of  control problems, which  is the main object of study of this paper.
As we already mentioned, the  dynamical systems we are dealing  with  evolve  according to  curves, whose  parameterised graphs are the curves  \eqref{graph}   in $\mathbb{R} \times \mathscr{Q}$.
The independent variable  $t$ (the ``time'') of these evolutions  is from now on always assumed to be varying  in a fixed interval $[0,T]$.  \par
The  control problems on which we focus are those  given  by the following    ingredients.
 \begin{itemize}[itemsep=5pt, leftmargin=10pt]
\item A {\it set of  control parameters} $\mathscr{K}$, i.e. a set   of    pairs $U = (u(t), \sigma)$,  in which:
 \begin{itemize}
\item[a)] the first element  $u(t)$ is a
smooth curve
$u: [0,T]   \to K$   in the above fixed ambient    space  $K \subset \mathbb{R}^M$;
\item[b)]  the second element   is
a  jet  $\sigma = j^{2r-1}_{t = 0}(\gamma)$  where $r$ is the actual order of the controlled Lagrangian considered below; the jet $\sigma$ is   possibly subjected to some  constraints
(as, for instance,  that the $0$-th component  $ j^0_{t = 0}(\gamma) = \gamma(0)$ is equal to a fixed point $q_o \in \mathscr{Q}$)  and  is  later  used as  the  initial datum for   a curve $\gamma(t) = (t, q(t))$,  described in the next  point.
\end{itemize}
\item  A {\it Lagrangian with controls} $L = L(t, q^i_{(\b)}, u^a)$  of  actual order $r$  satisfying \eqref{crucialineq}, which gives the   {\it system of   controlled  Euler-Lagrange  equations}  of order $2r$
 \begin{equation} \label{controlledELbis} E_i(L) |_{(j^n(\gamma(t)), u(t))} = 0  \end{equation}
 for each smooth curve $u:[0,T] \to K$.
We  also assume that $L$  satisfies   all   needed regularity and  maximal rank conditions that    guarantee  the  following:  {\it for each  pair  $U = (u(t), \sigma)$ in the set  $ \mathscr{K}$,
 there exists  a unique  solution $\gamma^{(U)}(t) $   to the initial value problem  formed by the equations \eqref{controlledELbis} and the initial condition
 \begin{equation} \label{initialvalue} j^{2r-1}_{t = 0}(\gamma(t)) = \sigma\ .\end{equation}}
The curves $\gamma^{(U)}$  determined in this way are  called {\rm $\mathscr{K}$-controlled}.
\item A {\it  terminal cost function}, that is  a  real  function of the   jets at the time $t = T$ of some fixed  order $\widetilde r\leq n-1$
(\footnote{This condition on the actual order $\widetilde r$ is  just a  convenient  technical requirement and is used only in the proof of  Lemma \ref{pcprop} below. As observed before,  if we work in jets spaces of sufficiently high order, this requirement is always  easily  satisfied.}). We   assume that such a terminal cost function is actually    the restriction  $C|_{J^{n}(\mathscr{Q}|\mathbb{R})|_{t = T} }$ of  a   smooth real function  of actual order $\widetilde r$ on the whole jet space  that    vanishes identically   on $ J^n(\mathscr{Q}|\mathbb{R})|_{t = 0} $.  \end{itemize}
For any    terminal cost function on the jets  at $t = T$,    there are clearly   infinite   possibilities for  a smooth function   $C$ on $J^n(\mathscr{Q}|\mathbb{R})$  that vanishes at the jets at $t = 0$ and that gives the desired cost function at $t = T$.  But in what follows   we    select   just   one of  such globally defined  functions and  we call  it  {\it  the    (extended) cost function} of  our problem.
\par
\smallskip
Any triple  $(\mathscr{K}, L, C)$,   formed by three ingredients of the above form,  is  called a   {\it defining triple}.   Given such a triple we may consider the following \par
 \begin{definition} \label{MPdefinition}  The   {\it  generalised Mayer problem  determined by  $(\mathscr{K}, L, C)$}  is the problem  of looking for  all $\mathscr{K}$-controlled evolutions  $\gamma^{(U)}$ for which the value of the terminal cost $C(j^n_{t = T}(\gamma^{(U)}))$
 is  minimal among  the   terminal  costs of all   $\mathscr{K}$-controlled evolutions. For such curves, the corresponding pairs  $U = (u(t), \sigma) \in \mathscr{K}$ are called {\it optimal controls}.
\end{definition}
\par
\medskip
\section{Modified  triples and   Mayer problems in integral form}\label{Sect5}
\label{subsect31}
\subsection{Performing the step (a)  of   the road map} \label{encapsulating-bis-A}\hfill\par
 We now  proceed according to  the step  (a) described  in Sect.\ \ref{roadmap}.  More precisely, we  canonically associate with any given curve $(t, q(t))$  in  $[0,T] \times  \mathscr{Q}$  a special set of real  functions. They are
\begin{align} \label{exprA-Abis}  & {\bf h}^i_\b(t) =  A^i_\b e^t +  B^i_\b e^{-t}   \ ,\\
 \label{exprA'-Abis}  & {\bf h}'{}^i_\b(t) =  A'{}^i_\b e^{\frac{\pi}{2 T} t} +  B'{}^i_\b e^{- \frac{\pi}{2 T}  t}   +  C'{}^i_\b \cos\left(\frac{\pi}{2 T}  t\right)+  D'{}^i_\b \sin \left(\frac{\pi}{2 T} t\right) \ ,\\
  \label{exprA''-Abis} & {\bf h}''{}^i_\b(t) =  A''{}^i_\b e^{\frac{\pi}{2 T} t}  +  B''{}^i_\b e^{- \frac{\pi}{2 T}  t}   +  C''{}^i_\b \cos \left(\frac{\pi}{2 T}  t\right)+ D''{}^i_\b \sin \left(\frac{\pi}{2 T}  t\right) \ ,
 \end{align}
  where the  indices $i$ and $\b$ run between  $1 \leq i \leq  N$ and $0 \leq \b \leq r-1$ (here, $r$ is the actual order of $L$) and   the $ A^i_\b$,  $ B^i_\b$, $A'{}^i_\b$, $ B'{}^i_\b$ etc., are the constants that  are uniquely determined  by  the following conditions on   the initial and terminal data of the   $q^i(t)$. The  $ A^i_\b$ and   $ B^i_\b$ are determined by solving the linear equations
\begin{equation} \label{primacond-A}     A^i_\b +  B^i_\b  (={\bf h}^i_{\b}\big|_{t = 0} ) = q^i_{(\b)}\big|_{t = 0},\  A^i_\b - B^i_\b  (  = \frac{d {\bf h}^i_{\b}}{ d t} \bigg|_{t = 0} \hskip-7 pt) {=}  -  \hskip-0.5cm \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix }\hskip-10pt  (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial   L}{\partial q^i_{(\d)}} \right)\!\!\bigg|_{j^{n-1}_{t = 0}(q(t))}\hskip - 8pt .
\end{equation}
The remaining  constants are  set to
\begin{align} \label{condition-1-A-11} &\left(\begin{array}{c} A'{}^i_\b \\ B'{}^i_\b \\ C'{}^i_\b \\ D'{}^i_\b  \end{array} \right) = \mathscr{A}^{-1}\left(\begin{array}{c} 0 \\ 0 \\ q^i_{(\b)}(T) \\ \displaystyle{\sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\
\d  - \varepsilon -1 =  \b  \endsmallmatrix }  (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial  L}{\partial q^i_{(\d)}} + \frac{\partial  }{\partial q^i_{(\d)}} \left( \frac{d C}{dt}\right)\right) \bigg|_{j^{n-1}_{t = T}(q(t))}}  \end{array} \right)\ ,\\
 \label{condition-2-A}
&\left(\begin{array}{c} A''{}^i_\b \\ B''{}^i_\b \\ C''{}^i_\b \\ D''{}^i_\b  \end{array} \right) = \mathscr{A}^{-1}\left(\begin{array}{c} 0 \\ 0 \\ {\bf h}^i_{\b}(T) \\ {\bf h}^i_{\b(1)}(T)  \end{array} \right)\ ,
\end{align}
where $\mathscr{A}$ is the real matrix
 $$\mathscr{A} = \left(\begin{array}{cccc} 1 & 1 & 1 & 0\\  \frac{\pi}{2 T} & - \frac{\pi}{2 T} &  0 & \frac{\pi}{2 T}\\
  \frac{\pi}{2 T} e^{\frac{\pi}{2}} & - \frac{\pi}{2 T}  e^{-\frac{\pi}{2}}& -  \frac{\pi}{2 T} & 0\\
  \left(  \frac{\pi}{2 T}\right)^2 e^{\frac{\pi}{2}} &  \left(\frac{\pi}{2 T} \right)^2 e^{-\frac{\pi}{2}}& 0 & -  \left(\frac{\pi}{2 T}\right)^2
 \end{array}\right)\ .
$$
A tedious but straightforward check   shows that  the  functions \eqref{exprA-Abis}  -- \eqref{exprA''-Abis}    are  precisely  the  unique  solutions to  the system of differential equations
 \begin{equation}  \label{modifiedEL-A1}  \frac{d^2 {\bf h}^i_\b}{dt^2} -  {\bf h}_\b^i = 0\ ,\quad      \frac{d^4{\bf h}'{}^i_\b}{dt^4}  -  \left(\frac{\pi}{2 T}\right)^4 {\bf h}'{}_\b^i = 0 \ ,   \quad   \frac{d^4{\bf h}''{}^i_\b}{dt^4}  -   \left(\frac{\pi}{2 T}\right)^4 {\bf h}''{}_\b^i = 0
  \end{equation}
 together with     the set of the  boundary conditions formed  by the  \eqref{primacond-A} and by
 \begin{align}
 & {\bf h}'{}^i_{\b} (0) = 0\ , && \frac{d {\bf h}'{}^i_{\b}}{dt}\bigg|_{t = 0} = 0\ ,\\
\label{ahio-A} & \frac{d {\bf h}'{}^i_{\b}}{dt}\bigg|_{t = T} = q^i_{(\b)}(T)\ , && \frac{d^2 {\bf h}'{}^i_{\b}}{dt^2}\bigg|_{t = T}  \hskip -0.5cm =  \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix }  (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial    \left(L + \frac{ dC}{dt}\right)}{\partial q^i_{(\d)}} \right) \bigg|_{j^{n-1}_{t = T}(q(t))} \hskip -0.5cm  ,\\
\label{ahiobis-A}
& {\bf h}''{}^i_{\b} (0) = 0\ ,\  \frac{d {\bf h}''{}^i_{\b}}{dt}\bigg|_{t = 0} = 0\ ,&& \frac{d {\bf h}''{}^i_{\b}}{d t}\bigg|_{t = T}  = {\bf h}^i_{\b}(T)   \ , \   \frac{d^2 {\bf h}''{}^i_{\b}}{dt^2}\bigg|_{t = T}   = {\bf h}^i_{\b(1)} (T) \ .
\end{align}
As a matter of fact,  we consider these  functions just  because we want them to  satisfy   such a differential problem.
The  motivation for this requirement  has  been very roughly indicated in our road map and  it will be   definitely  clarified in the next section. \par
Using the  functions  \eqref{exprA-Abis} -- \eqref{exprA''-Abis},  with  any given curve  $(t, q^i(t))$ in  $[0,T] \times \mathscr{Q}$ we may associate  a  curve $(t, q^i(t),  {\bf h}^i_{\b}(t), {\bf h}'{}^i_{\b}(t), {\bf h}''{}^i_{\b}(t))$
in the enlarged   manifold
$ [0,T] \times \widetilde \mathscr{Q} $,  $ \widetilde \mathscr{Q} \=  \mathscr{Q}\times  \mathbb{R}^{3 N r}$.
    Such  a bijective correspondence between  curves  in $[0,T] \times \mathscr{Q}$ and in  $[0, T] \times \widetilde \mathscr{Q}$
 establishes a natural  equivalence between our original control problem,  determined by the   triple $(\mathscr{K},  L,  C)$,   and a new control problem,  determined by an appropriate    modified defining triple $(\widetilde \mathscr{K}, \widetilde L, \widetilde C)$ which  is defined as follows.\\[10pt]
$\bullet$  $\widetilde \mathscr{K}$ is the collection of pairs $\widetilde U = (u(t), \widetilde \sigma)$ in which: (a)  $u(t)$ is precisely as it    occurs  in  the pairs   $(u(t), \sigma) \in  \mathscr{K}$ and (b) $\widetilde \sigma$ is a jet in $J^n(\widetilde \mathscr{Q}|\mathbb{R})\big|_{t = 0}$ of actual order $2 \max\{ r, 2\} - 1$,  playing the role of  the initial datum of a curve
$\widetilde \gamma(t) = (t, q^i(t), {\bf h}^i_\b(t),  {\bf h}'{}^i_\b(t), {\bf h}''{}^i_\b(t))$,  constrained  by the following conditions:
\begin{itemize}[leftmargin = 20pt]
\item[(i)] the part  of $\widetilde \sigma$, corresponding  to    the  initial datum   of   $\gamma(t) = (t, q^i(t))$,
 satisfies   the same  constraints  that are  imposed on the  data $\sigma$  in the    pair  $(u(t), \sigma)$ in  $\mathscr{K}$;
\item[(ii)] the  initial values  for the curves
${\bf h}^i_{\b}(t)$, ${\bf h}'{}^i_\b(t)$ and   ${\bf h}''{}^i_\b(t)$  are required  to satisfy  the conditions given by the   \eqref{primacond-A},  \eqref{ahio-A} and
\eqref{ahiobis-A}; no other condition  is imposed besides those which are naturally requested in order to be  initial conditions that are fully   compatible with the Euler-Lagrange equations   \eqref{12} and  \eqref{13}   below (\footnote{As we will shortly see,   such Euler-Lagrange equations  are nothing but   the  \eqref{modifiedEL-A1}.}).
\end{itemize}
\ \\
$\bullet$   $\widetilde L$ is the controlled Lagrangian  of actual order $\widetilde r = \max\{ r, 2\}$
\begin{multline} \label{LcC-A}
 \widetilde L(t, q^i_{(\d)}, {\bf h}^j_{\b(\d)},   \ldots, u^a) \=  \
 L +\frac{1}{2}\sum_{\smallmatrix 1 \leq j \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( ( {\bf h}^j_{\b(1)})^2 - ( {\bf h}'{}^j_{\b(2)})^2 -  ( {\bf h}''{}^j_{\b(2)})^2  \bigg) + \\
   +  \sum_{\smallmatrix 1 \leq j \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( \frac{1}{2} ( {\bf h}^j_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^j_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^j_{\b})^2 \bigg) \ .
\end{multline}
$\bullet$  $\widetilde C$ is equal to   $\widetilde C = C$.   The  only  difference  between $C$ and $\widetilde C$  is  just  that   its formal domain is  now  $J^n(\widetilde \mathscr{Q}|\mathbb{R})$  (and no longer   $J^n(\mathscr{Q}|\mathbb{R})$).
\par
\smallskip
 If we  now replace the   triple $(\mathscr{K}, L,  C)$  by   $(\widetilde \mathscr{K}, \widetilde L, \widetilde C =  C)$, we have a new  Euler-Lagrange operator,   consisting of the differential operators  $E_i(\cdot)$,   $E^{\b}_i(\cdot)$,     $E'{}^{\b}_i(\cdot)$,    $E''{}^{\b}_i(\cdot)$,      corresponding   to the  variables
$q^i$,  ${\bf h}^i_\b$,
${\bf h}'{}^i_\b$ and  ${\bf h}''{}^i_\b$, respectively.
 The new  set of  Euler-Lagrange equations is
 \begin{align}  \label{11}
 &E(\widetilde  L)_i =       \frac{\partial L}{\partial q^i} + \sum_{\ell= 1}^r (-1)^\ell \frac{d^{\ell }}{dt^{\ell}}\left(\frac{\partial L}{\partial q^i_{(\ell)}}  \right)=   0\ ,\\
  \label{12}   & E(\widetilde L)^\b_i=  -  \frac{d^2 {\bf h}^i_\b}{dt^2} +  {\bf h}_\b^i = 0\ ,\quad    E(\widetilde L)'{}^\b_i=  - \frac{d^4{\bf h}'{}^i_\b}{dt^4}  +  \left(\frac{\pi}{2 T}\right)^4 {\bf h}'{}_\b^i = 0 \ ,  \\
   \label{13}  & E(\widetilde L)''{}^\b_i=  - \frac{d^4{\bf h}''{}^i_\b}{dt^4}  +   \left(\frac{\pi}{2 T}\right)^4 {\bf h}''{}_\b^i = 0  \ .
  \end{align}
From  these equations, we  directly see that      any $\widetilde \mathscr{K}$-controlled curve $ \widetilde \gamma^{(\widetilde U)}(t) = (t, $ $q^i(t),$ ${\bf h}^i_\b(t), {\bf h}'{}^i_\b(t), {\bf h}''{}^i_\b(t))$
  has the following two crucial properties.
\begin{itemize}[leftmargin = 18pt]
\item[($1$)] Being solutions to  the same differential problem,  the   components $q^i(t)$ of a $\widetilde \mathscr{K}$-controlled curve $\widetilde \gamma^{(\widetilde U)}$ and of the corresponding
$\mathscr{K}$-controlled curve $\gamma^{(U)}$ are the same. Therefore   the terminal costs $\widetilde C|_{j^n_{t = T}(\widetilde \gamma^{(\widetilde U)})}$ and   $C|_{j^n_{t = T}(\gamma^{(U)})}$  coincide.
\item[($2$)] The functions ${\bf h}_\b^i(t)$, ${\bf h}'{}_\b^i(t)$, ${\bf h}''{}_\b^i(t)$ have necessarily  the forms \eqref{exprA-Abis} -- \eqref{exprA''-Abis}.
\end{itemize}
 Thus the  generalised Mayer problem defined by  $(\widetilde \mathscr{K}, \widetilde L, \widetilde C)$ is perfectly  equivalent to the original one,  given  by  $( \mathscr{K},  L,  C)$. The bijection  between the  two families of  controlled curves is established by simply   considering   the functions  defined  in \eqref{exprA-Abis} --  \eqref{exprA''-Abis} as  the last  components of  a  curve  in $\mathbb{R} \times \widetilde \mathscr{Q} = (\mathbb{R} \times  \mathscr{Q})\times  \mathbb{R}^{3 N r}$.
\par
\smallskip
\subsection{Performing the step (b) of   the road map} \label{encapsulating}\hfill\par
 We now  go into  the   step (b)  of Sect.\ \ref{roadmap}. Namely,  we  introduce
 two    auxiliary  variables    $\l$, $\mu$ and further  modify the  defining triple of the problem,  so that  an analogue of     \eqref{smart-1}  holds  for  any solution of  the new  controlled Euler-Lagrange equations.
 \par
 Introducing two new   variables   corresponds to    enlarging  the manifold     $\widetilde \mathscr{Q} = \mathscr{Q} \times \mathbb{R}^{3 Nr}$ of the previous section  into the  new  manifold $\dwt \mathscr{Q} = \widetilde  \mathscr{Q} \times \mathbb{R}^{2}$  parameterised by the    coordinates
 $ (t, q^i, {\bf h}_\b^i, {\bf h}'{}_\b^i, {\bf h}''{}_\b^i,   \l, \mu)$. After considering such new enlarged manifold $\dwt \mathscr{Q}$,  we have to introduce  the     {\it further modified  triple} $(\dwt \mathscr{K}, \dwt L, \dwt C)$ defined as follows. \\[10pt]
$\bullet$  $\dwt \mathscr{K}$ is the collection of pairs $\dwt U = (u(t), \dwt \sigma)$ in which: (a)  $u(t)$ is precisely as it    occurs  in  the pairs  in   $ \mathscr{K}$ and $\widetilde \mathscr{K}$ and (b) $\dwt \sigma$ is a jet in $J^n(\dwt \mathscr{Q}|\mathbb{R})\big|_{t = 0}$ of actual order $2  \max\{ r, 2\} -1$,  playing the role of  the initial datum of a curve
$\dwt \gamma(t) = (t, q^i(t), {\bf h}^i_\b(t),  {\bf h}'{}^i_\b(t), {\bf h}''{}^i_\b(t),  \l(t), \mu(t))$,  constrained  by the following conditions:
\begin{itemize}[leftmargin = 20pt]
\item[(i)] the part  of $\dwt \sigma$, corresponding  to    the  initial datum   of   $\widetilde \gamma(t) = (t, q^i(t),  {\bf h}^i_\b(t),  {\bf h}'{}^i_\b(t),$ ${\bf h}''{}^i_\b(t))$,
 satisfies   the same  conditions  that are  imposed on the pairs  $(u(t),\widetilde \sigma) \in \widetilde \mathscr{K}$;
\item[(ii)] the  component $\l|_{t = 0}$ of $\dwt \sigma$ (i.e.     the initial value   of  $\l(t)$)  is always set to be     $\l|_{t = 0} = 1$;  the  values of  all other components
of the jet  giving  the   initial datum for $\l(t)$   are   required to be just  compatible with  the Euler-Lagrange  equations   \eqref{modifiedEL} below (\footnote{By  looking at those equations,   one can  see  that this  compatibility requirement simply  means that  all  derivatives of $\l(t)$  at  $t = 0$ must be equal to $0$.});
\item[(iii)] the  component $\mu|_{t = 0}$ of $\dwt \sigma$  (i.e.   the initial value  of $\mu(t)$)  must  be   $\mu|_{t = 0} = 0$;  the other components of that   initial datum  for $\mu(t)$ have   just  to be compatible with  the  \eqref{modifiedEL}.
\end{itemize}
$\bullet$  $\dwt L$   is  the controlled Lagrangian  of actual order $\dwt r =  \max\{ r, 2\}$   defined by
\begin{multline}
 \dwt L(t, q^i_{(\d)}, {\bf h}^i_{\b(\d)},    {\bf h}'{}^i_{\b(\d)}, {\bf h}''{}^i_{\b(\d)} , \l_{(\d)}, \mu_{(\d)}, u^a) \=    \lambda \big (\mu_{(1)} + \widetilde L\big) +  \frac{d C}{dt} =   \\
 =
   \lambda \Bigg(\mu_{(1)} + L +\frac{1}{2}\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( ( {\bf h}^i_{\b(1)})^2 - ( {\bf h}'{}^i_{\b(2)})^2 -  ( {\bf h}''{}^i_{\b(2)})^2  \bigg) + \\
   +  \frac{1}{2}  \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg(( {\bf h}^i_{\b})^2+ \left(\frac{\pi}{2T}\right)^4 ( {\bf h}'{}^i_{\b})^2 +  \left(\frac{\pi}{2T}\right)^4( {\bf h}''{}^i_{\b})^2 \bigg) \Bigg) +  \frac{d C}{dt}\ .
\end{multline}
Here, according to \eqref{totalderiv},
$ \frac{dC}{dt}$  denotes   the  total derivative of the function $C = C(t, q^i_{(\b)})$.
\\[10pt]
 $\bullet$  $\dwt C$ is    the same of the original cost function   $\dwt C = C$. As  before,  the    difference  between $\dwt C$ and $C$   is  just that  we are now  considering   it as a function on the new jet space  $J^n(\dwt \mathscr{Q}|\mathbb{R})$.
\par
\smallskip
 If we now  replace the  defining triple $(\widetilde \mathscr{K}, \widetilde L, \widetilde C)$  of the previous section  by   $(\dwt \mathscr{K}, \dwt L, \dwt C = C)$, we have to consider  another   Euler-Lagrange operator,  formed not only  by  the  previous operators  $E_i(\cdot)$,    $E^{\b}_i(\cdot)$,     $E'{}^{\b}_i(\cdot)$,    $E''{}^{\b}_i(\cdot)$, but also by
  the   operators   $E_{\{\l\}}(\cdot)$  and $E_{\{\mu\}}(\cdot)$, corresponding   to the new variables  $\l$ and $\mu$, respectively.
  The new  set of  Euler-Lagrange equations is:
 \begin{align}
\nonumber  &  E(\dwt L)_{\{\mu\}}  = - \frac{ d \lambda}{dt} = 0\qquad \left( \ \Longrightarrow\ \ \l\equiv 1\ \ \right) ,\\
\nonumber  &E(\dwt L)_i =   E(\lambda \widetilde L)_i =     \frac{\partial L}{\partial q^i} + \sum_{\ell= 1}^r (-1)^\ell \frac{d^{\ell }}{dt^{\ell}}\left(\frac{\partial L}{\partial q^i_{(\ell)}}  \right)=   0\ ,\\
\nonumber & E(\dwt L)^\b_i=     E(\lambda \widetilde L)^\b_i = -  \frac{d^2 {\bf h}^i_\b}{dt^2} +  {\bf h}_\b^i = 0\ ,\\
\label{modifiedEL} & E(\dwt L)'{}^\b_i=  E(\lambda \widetilde L)'{}^\b_i = - \frac{d^4{\bf h}'{}^i_\b}{dt^4}  +  \left(\frac{\pi}{2 T}\right)^4 {\bf h}'{}_\b^i = 0 \ ,  \\
 \nonumber  & E(\dwt L)''{}^\b_i=   E(\lambda \widetilde L)''{}^\b_i =   - \frac{d^4{\bf h}''{}^i_\b}{dt^4}  +   \left(\frac{\pi}{2 T}\right)^4 {\bf h}''{}_\b^i = 0  \ ,\\
  \nonumber   &   E(\dwt L)_{\{\l\}}  =\frac{d \mu}{dt} +\widetilde L= \\
\nonumber & \hskip 1.4 cm =  \frac{d \mu}{dt} +  L   + \frac{1}{2}\!\!\!\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( ( {\bf h}^i_{\b(1)})^2 {-} ( {\bf h}'{}^i_{\b(2)})^2 {-}  ( {\bf h}''{}^i_{\b(2)})^2
    \bigg) + \\
\nonumber   & \hskip 1.8 cm + \!\!\! \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( \frac{1}{2} ( {\bf h}^i_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^i_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^i_{\b})^2  \bigg)     = 0\ ,
   \end{align}
By just looking at these equations, we  see that      any $\dwt \mathscr{K}$-controlled curve
 \begin{equation} \label{wtK-controlled} \dwt \gamma^{(\dwt U)}(t) = (t, q^i(t), {\bf h}^i_{\b}(t), {\bf h}'{}^i_{\b}(t), {\bf h}''{}^i_{\b}(t),  \l(t), \mu(t))\end{equation}
  has the following properties.
\begin{itemize}[leftmargin = 15pt]
\item[($1$)] The value $\lambda(t)$ is constant and equal to the prescribed initial value, i.e. $\l(t) =1$.   It follows that     {\it the  new  differential constraints   on  the curve  $\widetilde \gamma(t) = (t, q^i(t),  {\bf h}^i_\b(t),  {\bf h}'{}^i_\b(t),$ ${\bf h}''{}^i_\b(t))$ are identical  with  the  original  constraints  \eqref{11} -- \eqref{13}}. This, together with  the uniqueness of the solution to the differential problem for   $\mu(t)$,   imply  that there exists a natural bijection between the class of $\widetilde \mathscr{K}$-controlled curves $\widetilde \gamma^{(\widetilde U)}$  and the class of the $\dwt \mathscr{K}$-controlled curves  $\dwt \gamma^{(\dwt U)}$.
\item[($2$)]  Due to (1), the   cost $\dwt C|_{j^n_{t = T}(\dwt \gamma^{(\dwt U)})}$  for a $\dwt \mathscr{K}$-controlled curve  is always  equal to  the cost $\widetilde C|_{j^n_{t = T}(\widetilde \gamma^{(\widetilde U)})} = C|_{j^n_{t = T}(\gamma^{(U)})}$  of the corresponding $\widetilde \mathscr{K}$-controlled curve $\widetilde \gamma^{(\widetilde U)}$.
\item[($3$)] The  last  equation in  $\eqref{modifiedEL}$  implies that the $1$-form
$ \lambda (\mu_{(1)} + \widetilde L ) dt$
 vanishes identically along  any  curve of  jets  $\dwt \gamma^{(\dwt U) (n)}(t) = j^n_t\left(\dwt \gamma^{(\dwt U)}\right)$  of  a $\dwt \mathscr{K}$-controlled curve $\dwt \gamma^{(\dwt U)}$.
\end{itemize}
From  (1) and (2)  and previous discussion,  we  see  that {\it the  generalised Mayer problem defined by the triple  $(\mathscr{K}, L, C)$ is  not only equivalent to the  problem of Sect.\ \ref{encapsulating-bis-A},   determined by  the triple $(\widetilde  \mathscr{K}, \widetilde  L, \widetilde  C)$,  but also equivalent  to this new problem, determined by  the triple $(\dwt \mathscr{K}, \dwt L, \dwt C)$}. Furthermore (3)  shows that   the improvement, which was mentioned  in the step (b) of  the road map,  is now reached,  In fact, if we
 consider   the $1$-form
\begin{equation}\label{alpha}
\begin{split} \a \=  & \dwt L dt   = \Big( \lambda (\mu_{(1)} + \widetilde L  )+  \frac{d C}{dt} \Big)dt
\end{split} \end{equation}
we may observe   that,   for any  curve  of jets
 $\dwt \gamma^{(\dwt U)(n)}(t)$ of a $\dwt \mathscr{K}$-controlled curve  $\dwt \gamma^{(U)}$
 \begin{equation} \label{extendedaction}
\begin{split} \int_0^T \a\left(\frac{d \dwt \gamma^{(\dwt U)(n)}}{dt} \right)\bigg|_{\dwt \gamma^{(\dwt U)(n)}(t)} dt &=  \int_0^T \dwt L|_{\dwt \gamma^{(\dwt U)(n)}(t)} dt \overset{\text{Property}\ (3)}=  \int_0^T \frac{dC}{dt}\bigg|_{\dwt \gamma^{(\dwt U)(n)}(t)} dt  \overset{ \eqref{3.2-1}} = \\
= C(\gamma^{(U)(n)}(T)) & - C(\gamma^{(U)(n)}(0)) \overset{ C|_{J^n(\mathscr{Q}|\mathbb{R})|_{t = 0}} = 0} =   C(j^n_{t = T}(\gamma^{(U)}))  \ .
\end{split}
\end{equation}
  This means that   for each $\dwt \mathscr{K}$-controlled curve, the  integral \eqref{extendedaction}  is just equal  to    the  terminal cost $C|_{j^n_{t = T}(\gamma^{(U)})} $
  and that  {\it looking for  a solution to the  original  problem  is perfectly equivalent to looking for  a  $\dwt \mathscr{K}$-controlled evolution,  for which  the integral \eqref{extendedaction}
 is  minimal among    those   of  all  other  $\dwt \mathscr{K}$-controlled evolutions.}  \par
\smallskip
\subsection{A convenient replacement of  the integrand in \eqref{extendedaction}}\hfill \par
\label{variationallyequiv}
We  now want to show that we may safely substitute  the $1$-form \eqref{alpha}   by a different one,
which turns out to be much more convenient for our further developments.
In order to introduce  such convenient replacement, we first need  to   recall that on the  jet bundle $J^n(\dwt \mathscr{Q}|\mathbb{R}) $  there exist  an  important   class of  distinguished $1$-forms, namely  the family  of {\it  the  $1$-forms that   vanish identically   on the  tangent vectors of    the curves of jets   $\dwt \gamma^{(n)}(t)$   of    the parameterised graphs $ \dwt \gamma(t) = (t, q^i(t),  {\bf h}^i_\b(t),  {\bf h}'{}^i_\b(t),$ ${\bf h}''{}^i_\b(t),  \l(t), \mu(t))$}. \par
  \smallskip
  It is  known   that    such  distinguished  $1$-forms are precisely those that are  pointwise  linear combinations of the $1$-forms
\begin{equation} \label{holonomic}
\begin{split}
&\o^i_{(\d)} \= dq^i_{(\d)} -  q^i_{(\d+1)} dt\ ,\\
 &\varpi^i_{\b(\d)} \= d{\bf h}^i_{\b(\d)} -  {\bf h}^i_{\b(\d+1)} dt\ ,\quad \varpi'{}^i_{\b(\d)} \= d{\bf h}'{}^i_{\b(\d)} -  {\bf h}'{}^i_{\b(\d+1)} dt\ , \hskip 0.5 cm  i = 1, \ldots, N\ ,
\\[5pt]
&\varpi''{}^i_{\b(\d)} \= d{\bf h}''{}^i_{\b(\d)} -  {\bf h}''{}^i_{\b(\d+1)} dt\ ,\hskip 5 cm  \d = 0, \ldots, n -1\ , \\
&\varpi^{\{\l\}}_{(\d)} \=  d\l_{(\d)} - \l_{(\d+1)} dt\ ,\qquad \varpi^{\{\mu\}}_{(\d)} \=  d\mu_{(\d)} - \mu_{(\d+1)} dt\ .
\end{split}
\end{equation}
Since these $1$-forms vanish identically on the tangent vectors of the  curves $\dwt \gamma^{(n)}(t)$,  the value of the integral \eqref{extendedaction}
 does not changes if  $\a$  is replaced by  any other   $1$-form
\begin{equation} \label{vareq}  \a' = \a + \mathbb{P}^{(\d)}_{i} \o^i_{(\d)} +  \mathbb{Q}^{(\d)}{}^{\b}_{i}\varpi^i_{\b(\d)} + \mathbb{Q}^{'(\d)}{}^{\b}_{i}  \varpi'{}^i_{\b(\d)}+ \mathbb{Q}^{''(\d)}{}^{\b}_{i} \varpi''{}^i_{\b(\d)} +
\mathbb{L}^{(\d)} \varpi^{\{\l\}}_{(\d)} +\mathbb{M}^{(\d)} \varpi^{\{\mu\}}_{(\d)}  \end{equation}
for  some arbitrary   choices of  smooth  functions $ \mathbb{P}^{(\d)}_{i},  \mathbb{Q}^{(\d)}{}^{\b}_{i}$, $ \mathbb{Q}^{'(\d)}{}^{\b}_{i}$, $\mathbb{Q}^{''(\d)}{}^{\b}_{i}$, $\mathbb{L}^{(\d)}$, $\mathbb{M}^{(\d)}$ of  the points of $J^n(\dwt \mathscr{Q}|\mathbb{R}) \times K$.
Following  the terminology used in  \cite{Sp},   we say that  any such  $\a'$  is     {\it variationally equivalent} to $\a$.
The  invariance   of  \eqref{extendedaction} under    replacements  with variationally equivalent $1$-forms might  be considered    as a  sort of ``invariance under gauge transformations''   of the cost  functional.    \par
\medskip
A particular  choice for the  $ \mathbb{P}^{(\d)}_{i},  \mathbb{Q}^{(\d)}{}^{\b}_{i}$, $ \mathbb{Q}^{'(\d)}{}^{\b}_{i}$, etc. yields to  the  following $1$-form. \par
\begin{definition} The   {\it  controlled Poincar\'e-Cartan form associated with  $\dwt L$ }  is the $1$-form  on $J^n(\dwt \mathscr{Q}|\mathbb{R}) \times K$ defined by
\begin{equation} \label{310} \begin{split}  \a^{PC} &=   \dwt L dt +  \sum_{\d = 1}^r  \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon} \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial \dwt L}{\partial q^i_{(\d)}} \right) \o^i_{(\d-(\varepsilon+1))}  + \\
& \hskip 0.5 cm +  \l\hskip-10pt \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( {\bf h}^i_{\b(1)} \varpi^i_{\b(0)}  -  {\bf h}'{}^i_{\b(2)} \varpi'{}^i_{\b(1)} -  {\bf h}''{}^i_{\b(2)} \varpi''{}^i_{\b(1)}  \bigg)\ +  \l \varpi^{\{\mu\}}_{(0)} = \\
&=   \Bigg( \lambda \Big(\mu_{(1)} +  L +\frac{1}{2}\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( ( {\bf h}^i_{\b(1)})^2 - ( {\bf h}'{}^i_{\b(2)})^2 -  ( {\bf h}''{}^i_{\b(2)})^2  \bigg) + \\
 & \hskip 0.8cm  +  \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( \frac{1}{2} ( {\bf h}^i_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^i_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^i_{\b})^2 \bigg) \Big) +  \frac{d C}{dt} \Bigg) dt + \\
& \hskip 1.7 cm +\l \sum_{\d = 1}^r \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon}  \left(\frac{\partial  \left(L + \frac{ dC}{dt}\right) }{\partial q^i_{(\d)}} \right) \o^i_{(\d-(\varepsilon+1))} + \\
 & \hskip 1.7 cm +   \l\hskip-10pt  \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( {\bf h}^i_{\b(1)} \varpi^i_{\b(0)}  -  {\bf h}'{}^i_{\b(2)} \varpi'{}^i_{\b(1)} -  {\bf h}''{}^i_{\b(2)} \varpi''{}^i_{\b(1)}+ \\
   & \hskip 4.7 cm +    {\bf h}'{}^i_{\b(3)} \varpi'{}^i_{\b(0)} +  {\bf h}''{}^i_{\b(3)} \varpi''{}^i_{\b(0)}\bigg) +
\l \varpi^{\{\mu\}}_{(0)} \ .
\end{split}
\end{equation}
\end{definition}
Since  \eqref{310}  is variationally equivalent to $\a$, we may safely  replace   $\a$  by $\a^{PC}$  in \eqref{extendedaction}. And, in fact,  such a substitution is  the  analogue of  what is done in  \cite{CS}  for the  classical Mayer problems,  where  the $1$-form
$$\a=  \left(\sum_{i = 1} p_i(\dot x^i - f^i(t, x, u(t)))  + \sum_{i = 1}^N \frac{\partial C}{\partial x^i }\bigg|_{(t, x(t))}  \dot x^i(t)\right) dt$$
 is  replaced by the    $1$-form
 \begin{multline} \label{vecchiaPC} \a^{PC} = \left( \sum_{i = 1} p_i(\dot x^i - f^i(t, x, u(t))) + \sum_{i = 1}^N \frac{\partial C}{\partial x^i }\bigg|_{(t, x(t))}  \dot x^i(t)\right) dt + \sum_{i = 1} p_i( d x^i -  \dot x^i dt)  = \\
 =  \sum_{i = 1} p_i dx^i - p_i f^i(t, x, u(t)) dt  + \sum_{i = 1}^N \frac{\partial C}{\partial x^i }\bigg|_{(t, x(t))}  \dot x^i(t)  dt\ .  \end{multline}
The convenience of considering the  $1$-form \eqref{vecchiaPC} and, in more general situations,  the controlled Poincar\'e-Cartan forms \eqref{310} comes   from   the special   feature that  is described  in the next lemma and which will be  exploited in the proof of our first main result.
\begin{lem} \label{pcprop} The differential  $d \a^{PC}$ of the controlled Poincar\'e-Cartan form  has the form
\begin{equation} \label{39} \begin{split}
 d & \a^{PC} {=}  E(\dwt L)_i  \o^i_{(0)} \wedge dt +\\
 &  +  E(\dwt L)^\b_i \varpi^i_{\b(0)}\wedge dt +  E(\dwt L)'{}^\b_i \varpi'{}^i_{\b(0)} \wedge dt +    E(\dwt L)''{}^\b_i \varpi''{}^i_{\b(0)} \wedge dt +\\
 &+
  E(\dwt L)_{\{\l\}}  \varpi^{\{\l\}}_{(0)} \wedge dt +E(\dwt L)_{\{\mu\}}   \varpi^{\{\mu\}}_{(0)} \wedge dt+  \frac{\partial \dwt L}{\partial u^a} d u^a \wedge dt  +\\
&+   \text{\rm  linear combinations of   wedges  of pairs of
  $1$-forms   of  the list}\ \eqref{holonomic}
\end{split}\end{equation}
\end{lem}
\begin{pf}  The claim   is  an immediate  consequence of a   general fact concerning  the   classes of variationally equivalent  $1$-forms on   jets spaces (see e.g.  \cite[Prop. A2]{Sp}). For reader's convenience, we present here  a direct  proof.  For   simplicity of notation,  from now on we   denote  any tuple of coordinates   $(q^i, {\bf h}^i_{\b},  {\bf h}'{}^i_{\b}, {\bf h}''{}^i_{\b}, \l, \mu)$ for  $\dwt \mathscr{Q}$   just by  $y = (y^\ell)$,  where the  index  $\ell$ ranges  between  $1$  and $\dwt N =  N (3r+1) +2 $.  Accordingly, the   coordinates
of the whole  jet space are  denoted by $t$ and by   $y^\ell_{(\d)}$, $0 \leq \d \leq n$,  and the associated  $1$-forms of the list  \eqref{holonomic}  are  briefly indicated     as
\begin{equation} \label{list}  \o^\ell_{(\d)} = d y^\ell_{(\d)} - y^\ell_{(\d +1)} d t\qquad\text{with}\ \  1 \leq \ell \leq \dwt N\ \ \text{and}\ \  1 \leq \d \leq n-1\ .\end{equation}
Note that, being $dt \wedge dt = 0$ and $d(d y^\ell_{(\d)}) = 0$,  for each integer $1 \leq \d \leq n-1$,
\begin{equation} d y^\ell_{(\d)}\wedge dt =  \o^\ell_{(\d)} \wedge dt = - d\o^\ell_{(\d-1)} \ .\end{equation}
Hence for any function $f: J^n(\dwt \mathscr{Q}|\mathbb{R}) \times K \to \mathbb{R}$ of    actual order $\dwt r \leq n-1$
\begin{multline} \label{lala}  f d y^\ell_{(\d)} \wedge dt  =  - f d \o^\ell_{(\d-1)}
= \\
= - d \left(f   \o^\ell_{(\d-1)} \right)  + \frac{\partial f}{\partial t} dt \wedge  \o^\ell_{(\d-1)}+
\sum_{\d' = 0}^{\dwt r} \frac{\partial f}{\partial y^m_{(\d')}} d y^m_{(\d')} \wedge \o^\ell_{(\d-1)} = \\
=  - d \left(f   \o^\ell_{(\d-1)} \right)  + \frac{\partial f}{\partial t} dt \wedge\o^\ell_{(\d-1)} +
\sum_{\d' = 0}^{\dwt r} \frac{\partial f}{\partial y^m_{(\d')}} \o^m_{(\d')} \wedge \o^\ell_{(\d-1)}
+\sum_{\d' = 0}^{\dwt r} \frac{\partial f}{\partial y^m_{(\d')}}  y^m_{(\d')}   dt \wedge  \o^\ell_{(\d-1)} = \\
= - d \left(f  \o^\ell_{(\d-1)} \right)   - \frac{d f}{dt}  \, dy^\ell_{(\d-1)}  \wedge dt  \qquad    \text{\rm  modulo  terms of the form }\  \o^r_{(\eta)} \wedge \o^{s}_{(\zeta)}
\end{multline}
If $\d - 1\geq 1$, we may iterate and apply  this    identity  to the term   $-  \frac{d f}{dt}\, dy^\ell_{(\d-1)}  \wedge dt $   which appear in  the  right hand side of such identity. In this way we  get   that
\begin{equation}   f d y^\ell_{(\d)} \wedge dt  =   - d \left(f  \o^\ell_{(\d-1)} \right)   +  d\left(  \frac{d f}{dt}  \o^\ell_{(\d-2)}\right) +
\frac{d^2 f }{dt^2} \,d y^\ell_{(\d-2)}  \wedge dt  \ \    \text{\rm  mod}\  \o^r_{(\eta)} \wedge \o^{s}_{(\zeta)}.
\end{equation}
If $\d -2 \geq 1$,  we may again apply   \eqref{lala}  to the term  $\frac{d^2 f }{dt^2} \,y^\ell_{(\d-2)}  \wedge dt$ and so on.  After  $\d$ iterations of such  use of   \eqref{lala},  we end up with
\begin{equation}   \label{5.9} f d y^\ell_{(\d)} \wedge dt  =  -  d \left( \sum_{\varepsilon = 0}^{\d-1}(-1)^\varepsilon \frac{ d^\varepsilon f}{dt^\varepsilon}  \o^\ell_{(\d-1 -\varepsilon)} \right)   + (-1)^\d
\frac{d^\d f }{dt^\d} \,\o^\ell_{(0)}  \wedge dt  \quad   \text{\rm  mod}\  \o^r_{(\eta)} \wedge \o^{s}_{(\zeta)}
\end{equation}
 Applying  \eqref{5.9} to each  term $ \frac{\partial \dwt L}{\partial y^\ell_\d} dy^\ell_{(\d)} \wedge dt $,   $\d \geq 1$,  appearing in  the exterior differential $d(\dwt L dt )$, we obtain
\begin{equation} \label{5.10}
\begin{split}
d(\dwt L dt) &=  \frac{\partial \dwt L}{\partial y^\ell_{(0)} } dy^\ell_{(0)} \wedge dt  + \sum_{\d = 1}^r \frac{\partial \dwt L}{\partial y^\ell_{(\d)}} dy^\ell_{(\d)} \wedge dt = \\
&=  \frac{\partial \dwt L}{\partial y^\ell_{(0)} } \o^\ell_{(0)} \wedge dt  -  \sum_{\d = 1}^r d \left( \sum_{\varepsilon = 0}^{\d-1}(-1)^\varepsilon \frac{ d^\varepsilon}{dt^\varepsilon}  \frac{\partial \dwt L}{\partial y^\ell_{(\d)}} \o^\ell_{(\d-1 -\varepsilon)} \right) +     \\
&\hskip 3 cm + \sum_{\d = 1}^r   (-1)^{\d+1}
\frac{d^\d }{dt^\d} \frac{\partial \dwt L}{\partial y^\ell_{(\d)}} \,\o^\ell_{0}  \wedge dt \ \ \     \text{\rm  mod}\  \o^r_{(\eta)} \wedge \o^{s}_{(\zeta)} = \\
 & =  - d \left(\sum_{\d = 1}^r   \sum_{\varepsilon = 0}^{\d-1} (-1)^\varepsilon \frac{ d^\varepsilon}{dt^\varepsilon}  \frac{\partial \dwt L}{\partial y^\ell_{(\d)}} \o^\ell_{(\d-(\varepsilon+1))} \right)+  E(\dwt L)_\ell \, \o^\ell_{(0)} \wedge dt  \ \    \text{\rm  mod}\  \o^r_{(\eta)} \wedge \o^{s}_{(\zeta)}
 \end{split}
\end{equation}
Note that,  in the  simplified notation  used in this proof,  the  $1$-form $\a^{PC}$  is nothing but
$$\a^{PC} =  \dwt L dt +  \sum_{\d = 1}^r  \left( \sum_{\varepsilon = 0}^{\d-1}(-1)^\varepsilon \frac{ d^\varepsilon}{dt^\varepsilon}  \frac{\partial \dwt L}{\partial y^\ell_{(\d)}} \o^\ell_{(\d-(\varepsilon+1))} \right) \ .$$
From this and   \eqref{5.10}, the  lemma follows immediately.
\end{pf}
\par
\medskip
 \section{The Principle of Minimal Labour}
 \label{section5}\label{Sect6}
\label{secthomotopy}
We are now ready to prove our first main result, the Principle of Minimal Labour for generalised Mayer problems. As we mentioned in Sect.\ \ref{roadmap}, this is reached by: (i)  first  proving  a generalisation of  the identity  \eqref{astast} for the  problem associated with the modified   defining triple  $(\dwt \mathscr{K}, \dwt L, \dwt C)$  and then  (ii)  deriving   a corresponding  identity  for the original    problem, determined by   $(\mathscr{K}, L, C)$. These two identities   are  proven in Sect.\ \ref{section7.1} and Sect.\ \ref{section7.2}, respectively. \par
\smallskip
\subsection{The homotopy formula for the  problem defined by the  triple $(\dwt \mathscr{K}, \dwt L, \dwt C)$}\hfill\par
\label{section7.1}
  Let  $\dwt U_o  = (u_o(t), \dwt \sigma_o(t))$ be a fixed element in  $\dwt \mathscr{K}$ and  $\dwt  \gamma^{(\dwt U_o)}: [0,T] \to [0,T] \times \dwt \mathscr{Q} $ the corresponding $\dwt \mathscr{K}$-controlled curve.  We call  a smooth  $1$-parameter family ${\dwt{F}}(\cdot, s)$, $s \in [0,1]$,  of  $\dwt \mathscr{K}$-controlled curves with  initial  curve ${\dwt{F}}(\cdot, 0) = \dwt  \gamma^{(\dwt U_o)}$  a {\it $\dwt \mathscr{K}$-controlled variation  of}  $\dwt  \gamma^{(\dwt U_o)}$.  More precisely,     a
  $\dwt \mathscr{K}$-controlled variation ${\dwt{F}}$   is a smooth homotopy of the form
  \begin{equation} \label{homotopy} {\dwt{F}}:[0,T] \times [0,1] \longrightarrow \dwt \mathscr{Q} \ ,\qquad {\dwt{F}}(t,s) = \dwt \gamma^{(\dwt U(s))}(t)\ ,\end{equation}
  where   $\dwt U(s) = (u(\cdot,s), \dwt \sigma(s))$, $s \in [0,1]$,  is a smooth curve  in $\dwt \mathscr{K}$  starting from    $\dwt U(0) =\dwt  U_o$.
 For each  ${\dwt{F}}$, we consider  the    corresponding
 homotopy  ${\dwt{F}}^{(n)}$ in  $J^n(\dwt \mathscr{Q}|\mathbb{R}) \times K$ defined by
  $${\dwt{F}}^{(n)}: [0,T] \times [0,1] \longrightarrow J^n(\dwt \mathscr{Q}|\mathbb{R})\times K\ ,\qquad {\dwt{F}}^{(n)}(t,s) \= (j^{n}_t({\dwt{F}}(\cdot, s)), u(t,s))\ .$$
 Note that, for each fixed $s_o$, the curve $t \mapsto j^{n}_t({\dwt{F}}(\cdot, s_o))$ is nothing but the curve $\dwt \gamma^{(\dwt U(s_o)) (n)}$ of the $n$-th order jets of the  curve
 $\dwt \gamma^{(\dwt U(s_o))}$. \par
 Given a $\dwt \mathscr{K}$-controlled variation  ${\dwt{F}}$,   we  denote by $X_{\dwt{F}}$ and $Y_{\dwt{F}}$ the    vector fields --   defined just  at  the points  of the  surface
 $\dwt \mathscr{S} \= {\dwt{F}}^{(n)}([0,T] \times [0,1]) $ --  which  are determined   by considering  the infinitesimal variations of      the first parameter $t$ and of   the second parameter $s$, respectively.  More precisely, $X_{\dwt{F}}$ and $Y_{\dwt{F}}$ are the vector fields at the points of $\dwt \mathscr{S}$
  \begin{align}\label{vectorX} X_{\dwt{F}}|_{{\dwt{F}}^{(n)}(t,s)} &\={\dwt{F}}^{(n)}_*\left(\frac{\partial}{\partial t}\bigg|_{(t,s)}\right) = \frac{\partial{\dwt{F}}^{(n)}}{\partial t}\bigg|_{(t,s)}\ ,  \\
\label{vectorY} Y_{\dwt{F}}|_{{\dwt{F}}^{(n)}(t,s)} & \={\dwt{F}}^{(n)}_*\left(\frac{\partial}{\partial s}\bigg|_{(t,s)}\right) = \frac{\partial{\dwt{F}}^{(n)}}{\partial s}\bigg|_{(t,s)}\ .
\end{align}
 We remark  that, for each fixed  $s_o \in [0,1]$,
 \begin{itemize}[leftmargin = 20pt]
\item[(1)] The restriction of  $X_{\dwt{F}}$ to the trace of   the  curve   $$ t \mapsto  {\dwt{F}}^{(n)}(t,s_o)  = \left( \dwt \gamma^{(\dwt U(s_o))(n)}(t), u(t, s_o)\right)= \left(j^n_{t}{\dwt{F}}(\cdot,  s_o), u(t, s_o)\right)$$
 coincides with  the family of    the tangent vectors of such a curve.
 \item[(2)] The restriction of  $Y_{\dwt{F}}$ to the trace of the same  curve   is  the Jacobi vector field   corresponding to the  (infinitesimal) variation $\varepsilon \to{\dwt{F}}^{(n)}(\cdot,s_o + \varepsilon) $  of ${\dwt{F}}^{(n)}(\cdot,s_o)  $.
 \end{itemize}
 From (1), (2) and  \eqref{modifiedEL}, we  have  that  the vector fields $X_{\dwt{F}}$ and   $Y_{\dwt{F}}$ must  have  the  form
 \begin{equation} \begin{split}  \label{54uno}
& X_{\dwt{F}} = \frac{\partial}{\partial t} +   X^i_{(\b)} \frac{\partial}{\partial q^i_{(\b)}} +
 X^{\{\mu\}}_{ (\b)} \frac{\partial}{\partial  \mu_{ (\b)} } + X^a \frac{\partial}{\partial u^a} +\\
 & \hskip 3.3 cm + X^i_{\a(\b)} \frac{\partial}{\partial {\bf h}^i_{\a(\b)}}   + X'{}^i_{\a(\b)} \frac{\partial}{\partial {\bf h}'{}^i_{\a(\b)}} + X''{}^i_{\a(\b)} \frac{\partial}{\partial {\bf h}''{}^i_{\a(\b)}}    \ ,\\
 & Y_{\dwt{F}} =    Y^i_{(\b)}  \frac{\partial}{\partial q^i_{(\b)}}  +   Y^{\{\mu\}}_{(\b)} \frac{\partial}{\partial  \mu_{ (\b)} } + Y^a \frac{\partial}{\partial u^a} + \\
  &\hskip 3.3cm  + Y^i_{\a(\b)} \frac{\partial}{\partial {\bf h}^i_{\a(\b)}}   + Y'{}^i_{\a(\b)} \frac{\partial}{\partial {\bf h}'{}^i_{\a(\b)}} + Y''{}^i_{\a(\b)} \frac{\partial}{\partial {\bf h}''{}^i_{\a(\b)}}
    \end{split}
  \end{equation}
 for  appropriate smooth real functions $X^i_{(\b)}$, $X^{\{\mu\}}_{(\b)}$,  etc., defined {\it only} at the points of $\dwt \mathscr{S}$. \par
 \begin{theo}[Homotopy Formula - First Version]  \label{prop34}  Let $\dwt U_0, \dwt U_1 \in \dwt \mathscr{K}$  be the endpoints of a smooth curve $\dwt U(s) \in \dwt \mathscr{K}$, $s \in [0,1]$, and
   $\dwt \gamma \= \dwt \gamma^{(\dwt U_0)}$,  $\dwt \gamma' \= \dwt \gamma^{(\dwt U_1)}$ the $\dwt \mathscr{K}$-controlled curves corresponding to  $\dwt U_0, \dwt U_1$, with terminal costs  $C_0 \= C(j^{n-1}_{t = T}(\dwt \gamma))$  and  $C_1 \= C(j^{n-1}_{t = T}(\dwt \gamma'))$, respectively.  Furthermore
\begin{itemize}
\item[(i)]  for any jet $ j^n_t(\dwt \gamma) \in J^n(\dwt \mathscr{Q}|\mathbb{R})$,  let   $\mathscr{P}_{j^n_t(\dwt \gamma)}$ be    the  function on $K$ defined by
\begin{equation}\label{pontr-funct}
 \mathscr{P}_{j^n_t(\dwt \gamma)} : K \longrightarrow \mathbb{R} \ ,\qquad  \mathscr{P}_{j^n_t(\dwt \gamma)}(u^a) \= -   L(j^n_t(\dwt \gamma), u^a)\ ;\end{equation}
\item[(ii)] let $\dwt \mu: [0,T] \times [0,1] \to \mathbb{R}$ be the  function  defined by  $\dwt \mu(t,s) \= \mu^{(\dwt U(s))}(t)$, where $ \mu^{(\dwt U(s))}(t)$ is  the value at $t$ of the $\mu$-component of the $\dwt \mathscr{K}$-controlled curve
$$\dwt \gamma^{(\dwt U(s))}(t) = (t, q^{(\dwt U(s))i}(t),  {\bf h}^{(\dwt U(s))i}_\b(t), \ldots,  \l^{(\dwt U(s))}(t) = 1,  \mu^{(\dwt U(s))}(t))\ .$$
\end{itemize}
 Then,
  \begin{multline} \label{homotopy-ultimate}
 C_1 - C_0   =  - \int_0^T \left( \int_0^1    \left(Y^a \frac{\partial \mathscr{P}_{\dwt \gamma^{(\dwt U^(s))(n)}_t} }{\partial u^a} \Bigg|_{u^{(s)}(t)} - \frac{\partial^2\dwt  \mu}{\partial t \,\partial s}\bigg|_{(t,s)} -\right.\right.\\
\left.\left.- \sum_{\b = 1}^{r-1}  \sum_{i= 1}^N  \frac{\partial^2}{\partial t \partial s}  \bigg( \int_0^s {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)}  \bigg) \bigg|_{{\dwt{F}}^{(n)}(t, v)} \right)dv \right) dt
\end{multline}
where  $Y^a$, $ Y'{}^i_{\b(0)}$,  $Y''{}^i_{\b(0)}$ are the  $u^a$-, ${\bf h}'{}^i_\b$- and ${\bf h}''{}^i_\b$- components, respectively,  of the vector field $Y_{\dwt F}$ defined in \eqref{54uno}, associated with the $\dwt \mathscr{K}$-controlled variation $\dwt F$ determined by the  $\dwt U(s)$, $s \in [0,1]$,
\end{theo}
\begin{rem} \label{rem72}  From  the  definition of the functions ${\bf h}^i_{\b}(t)$, ${\bf h}'{}^i_{\b}(t)$ and ${\bf h}''{}^i_{\b}(t)$ and  the
 Euler-Lagrange equation $E(\dwt L)_{\{\l\}} = 0$, it follows immediately   that the second summand
 in the right hand side of  \eqref{homotopy-ultimate}   is uniquely  determined by the  $\mathscr{K}$-controlled curves $t \mapsto \gamma^{(U(s))}(t) =  (t, q^{(U(s))i}(t))$   in   $[0, T] \times \mathscr{Q}$.  It is also simple to check that the same is true  for the first summand as well. These two  facts will be used in the next subsection.
\end{rem}
\begin{pf}
 Consider the  embedded surface
 $\dwt \mathscr{S} \= {\dwt{F}}^{(n)}([0,T] \times [0,1])$  and the vector fields  $X_{\dwt{F}}$, $Y_{\dwt{F}}$ defined in  \eqref{vectorX} and \eqref{vectorY}.
From  \eqref{extendedaction}, the  property (1) of  $X_{\dwt{F}}$    and the fact that $\a^{PC}$ is a $1$-form which is variationally equivalent  to $\a$,  we have that for each curve $\dwt \gamma^{(\dwt U(s))}$, $s \in [0,1]$,
\begin{equation} \nonumber
\begin{split}
\int_0^T\left({\dwt{F}}^{(n)*}(\a^{PC})\right)\bigg|_{(t,s)} \left( \frac{\partial}{\partial t}\right) dt  &=   \int_0^T \a^{PC}\left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, s)}  dt  = \\
& = \int_0^T  \a\left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, s)}  dt  = C(j^n_{t = T}(\dwt \gamma^{(\dwt U(s))}))  \ .
\end{split}\ .\end{equation}
This implies that
\begin{equation}  \label{primissima}
\begin{split} C_0 - C_1 &= C(j^n_{t = T}(\dwt \gamma^{(\dwt U(0))})) - C(j^n_{t = T}(\dwt \gamma^{(\dwt U(1))})) = \\
& = \int_0^T \left({\dwt{F}}^{(n)*}(\a^{PC})\right) \left(\frac{\partial}{\partial t}\right) \bigg|_{(t,0)} dt  -
\int_0^T \left({\dwt{F}}^{(n)*}(\a^{PC})\right)\left(\frac{\partial}{\partial t}\right) \bigg|_{(t,1)}  dt \ .
\end{split}
\end{equation}
On the other hand, by property (2) of $Y_{\dwt{F}}$ and   the assumptions on the initial data of the  ${\bf h}^i_{\b}(t)$, ${\bf h}'{}^i_{\b}(t)$ and ${\bf h}''{}^i_{\b}(t)$,  described in  Sect.\ \ref{encapsulating-bis-A},   we have that
$$Y^{\{\mu\}}_{(0)}|_{{\dwt{F}}^{(n)}(0,s)} =  Y'{}^i_{\b(0)}|_{{\dwt{F}}^{(n)}(0,s)} = Y''{}^i_{\b(0)}|_{{\dwt{F}}^{(n)}(0,s)}  =   Y'{}^i_{\b(1)}|_{{\dwt{F}}^{(n)}(0,s)} = Y''{}^i_{\b(1)}|_{{\dwt{F}}^{(n)}(0,s)}  =    0\ ,$$
$$  Y^i_{\b(0)}|_{{\dwt{F}}^{(n)}(0,s)} =  Y^i_{(\b)}|_{{\dwt{F}}^{(n)}(0,s)}\ . $$
From this we obtain
\begin{multline} \label{secondina} \int_0^1 \imath_{\frac{\partial}{\partial s}}\left({\dwt{F}}^{(n)*}(\a^{PC})\right)\bigg|_{(0,s)} ds = \int_0^1 \a^{PC}\left(Y_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(0, s)}  ds = \\
=\sum_{\b = 1}^{r-1}   \sum_{i= 1}^N  \int_0^1  \bigg(
\bigg( \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix }  \hskip-0.5 cm (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial  }{\partial q^i_{(\d)}}   \left(L + \frac{ dC}{dt}\right) \right)  \bigg)Y^i_{(\b)}  +   {\bf h}^i_{\b(1)} Y^i_{\b(0)}  \bigg)\bigg|_{{\dwt{F}}^{(n)}(0, s)}
 \hskip-0.5 cm ds  = \\
=\sum_{\b = 1}^{r-1}  \sum_{i=1}^N \int_0^1\bigg( \bigg( \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix } \hskip-0.5 cm (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial  }{\partial q^i_{(\d)}}  \left(L + \frac{ dC}{dt}\right) \right)   +    {\bf h}^i_{\b(1)}  \bigg) Y^i_{(\b)} \bigg)\bigg|_{{\dwt{F}}^{(n)}(0, s)}
 ds  \overset{\eqref{primacond-A}} = 0\ .  \end{multline}
 \begin{rem} \label{remark52}  This identity is precisely what we planned to obtain  by introducing  the functions ${\bf h}^i_\a(t)$ and   the corresponding terms in  $ \widetilde L$ and $\dwt L$.  In fact, the integral \eqref{secondina} is precisely the integral of $\a^{PC}$ along the first  ``vertical side'' of $\mathscr{S}$ (see Sect.\ \ref{smart-2} and \ref{roadmap}) and the functions ${\bf h}^i_\a(t)$
{\it have been chosen so that such an  integral  is always  vanishing}.
 \end{rem}
 Let us now consider the similar line integral  for  $t = T$. We have
 \begin{multline} \label{59}  \int_0^1 \imath_{\frac{\partial}{\partial s}}\left({\dwt{F}}^{(n)*}(\a^{PC})\right)\bigg|_{(T,s)} ds = \int_0^1 \a^{PC}\left(Y_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(T, s)}  ds = \\
=\sum_{\b = 1}^{r-1}  \sum_{i= 1}^N   \int_0^1  \bigg\{\bigg( \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix }  (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial   \left(L + \frac{ dC}{dt}\right) }{\partial q^i_{(\d)}} \right)  \bigg) Y^i_{(\b)}  + \hskip 4 cm \\
\hskip 0.5 cm  +  \bigg( {\bf h}^i_{\b(1)} Y^i_{\b(0)} - {\bf h}'{}^i_{\b(2)} Y'{}^i_{\b(1)} - {\bf h}''{}^i_{\b(2)} Y''{}^i_{\b(1)} +  {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)} \bigg) \bigg\}\bigg|_{{\dwt{F}}^{(n)}(T, s)}  ds + \\
 +   \int_0^1  Y^{\{\mu\}}_{(0)} \bigg|_{{\dwt{F}}^{(n)}(T, s)} ds \ .
\end{multline}
By property (2) of $Y_{\dwt{F}}$ and   the boundary values  \eqref{ahio-A} and \eqref{ahiobis-A} of the   curves ${\bf h}'{}^i_\b(t)$ and ${\bf h}''{}^i_\b(t)$,  we have that
 \begin{align*}
 & {\bf h}'{}^i_{\b(2)}  \big|_{{\dwt{F}}^{(n)}(T, s)}  = \hskip -0.3cm  \sum_{\smallmatrix 1 \leq \d \leq r\\[2pt] 0 \leq \varepsilon \leq \d\\[2pt]
\d  - \varepsilon -1 =  \b  \endsmallmatrix }  \hskip -0.3 cm (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon} \left(\frac{\partial   \left(L + \frac{ dC}{dt}\right) }{\partial q^i_{(\d)}} \right) \!\!\bigg|_{j^{n-1}_{t = T}(q(t))}
\!\!\!\!\!\!\ ,  & &Y'{}^i_{\b(1)}  \big|_{{\dwt{F}}^{(n)}(T, s)} = Y^i_{(\b)}  \big|_{{\dwt{F}}^{(n)}(T, s)}\ ,\\
  & {\bf h}''{}^i_{\b(2)}  \big|_{{\dwt{F}}^{(n)}(T, s)}  = {\bf h}^i_{\b(1)} \big|_{{\dwt{F}}^{(n)}(T, s)}  \ , \!\!\!\!\!\!& &\!\!\!Y''{}^i_{\b(1)}  \big|_{{\dwt{F}}^{(n)}(T, s)}  = Y^i_{\b(0)} \big|_{{\dwt{F}}^{(n)}(T, s)}   \ .
 \end{align*}
 From this and \eqref{59},  we get that
 \begin{multline} \label{terzina}  \int_0^1 \imath_{\frac{\partial}{\partial s}}\left({\dwt{F}}^{(n)*}(\a^{PC})\right)\bigg|_{(T,s)} ds = \\
 =   \int_0^1 \bigg(  \sum_{\b = 1}^{r-1}  \sum_{i= 1}^N \bigg(  {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)}\bigg) + Y^{\{\mu\}}_{(0)} \bigg)\bigg|_{{\dwt{F}}^{(n)}(T, s)} ds  \ .\end{multline}
 On the other hand, by the definition of the vector field $Y_{\dwt F}$,
  $$Y^{\{\mu\}}_{(0)} \bigg|_{{\dwt{F}}^{(n)}(T, s)}  = \frac{\partial \dwt F^{\{\mu\}}}{\partial s}\bigg|_{(T,s)} = \frac{\partial (\dwt \gamma^{(\dwt U(s))})^{\{\mu\}}}{\partial s}\bigg|_{(T,s)} = \frac{\partial \dwt \mu(T, s)}{\partial s}\ .$$
Hence
\begin{equation}\label{quartina}
\int_0^1  Y^{\{\mu\}}_{(0)} \bigg|_{{\dwt{F}}^{(n)}(T, s)} ds =  \int_0^1 \frac{\partial}{\partial s}\Bigg( \int_0^T \frac{d \dwt \mu(t, s)}{dt}  dt\Bigg) =  \iint_{[0,T] \times [0,1]}   \frac{\partial^2\dwt  \mu}{\partial t \,\partial s} ds dt \ .
\end{equation}
  \begin{rem}\label{remark53}  In  analogy with what we mentioned in Remark \ref{remark52},  the purpose of     the   functions ${\bf h}'{}^i_\b(t)$,  ${\bf h}''{}^i_\b(t)$ and  of  the corresponding   terms in  $\dwt L$  was precisely  to get   \eqref{terzina}, which  simplifies   {\it  the integral of $\a^{PC}$ along the second ``vertical side'' of $\mathscr{S}$.}
 \end{rem}
From \eqref{primissima}, \eqref{secondina}, \eqref{terzina}, \eqref{quartina} and  the Stokes Theorem, we obtain that
\begin{equation} \begin{split} \label{st}
 C_0 - C_1  + &  \int_0^T \left( \int_0^1  \frac{\partial^2\dwt  \mu}{\partial t \,\partial s}\bigg|_{(t,s)} \right. + \\
 & \hskip 2 cm\left.  +\sum_{\b = 1}^{r-1}  \sum_{i= 1}^N  \frac{\partial}{\partial t}  \bigg(  {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)}  \bigg) \bigg|_{{\dwt{F}}^{(n)}(t, s)} ds  \right) dt  = \\
&  =  \int_{\partial ([0,T] \times [0,1])}\left({\dwt{F}}^{(n)*}(\a^{PC})\right)   \overset{\text{Stokes Thm.}}= \\
 & =   \int_{[0,T] \times [0,1]} d\left({\dwt{F}}^{(n)*}( \a^{PC})\right) \left (\frac{\partial}{\partial t}, \frac{\partial}{\partial s}\right)dt \,ds= \\
 & =  \int_{[0,T] \times [0,1]} \left({\dwt{F}}^{(n)*}(d \a^{PC})\right) \left (\frac{\partial}{\partial t}, \frac{\partial}{\partial s}\right)dt \,ds= \\
& = \int_{[0, T] \times [0,1]} d \a^{PC}(X_{\dwt{F}}, Y_{\dwt{F}})\big|_{{\dwt{F}}^{(n)}(t,s)} dt\, ds
 \ ,
 \end{split}\end{equation}
 where, in the  integral of the first line, the integration of ${\dwt{F}}^{(n)*}(\a^{PC})$  is performed along  the  usual counterclockwise parameterisation of  $\partial ([0,T] \times [0,1])$. \par
At this point, it suffices to  recall  that the controlled Euler-Lagrange equations \eqref{modifiedEL} are satisfied at all points of $\dwt \mathscr{S}$ and that  the vectors $X_{\dwt{F}}$ are  tangent vectors to   curves of jets, determined by solutions to the controlled Euler-Lagrange equations.  Indeed, due to this,   \eqref{39} and the fact that each of  the $1$-forms  \eqref{holonomic} vanish  identically  on the vectors $X_{\dwt F}$, we immediately have  that  (\footnote{This is precisely  the point that motivated the substitution  of the $1$-form $\a$ by $\a^{PC}$.})
\begin{equation}
\begin{split} d \a^{PC}(X_{\dwt F}, Y_{\dwt F}) \big|_{{\dwt{F}}^{(n)}(t,s)}  =  \bigg(\frac{\partial \dwt L}{\partial u^a} & d u^a \wedge dt \bigg) (X_{\dwt F}, Y_{\dwt F}) \big|_{{\dwt{F}}^{(n)}(t,s)}  = \\
 & = - \frac{\partial \dwt L}{\partial u^a} Y^a \big|_{{\dwt{F}}^{(n)}(t,s)} =  - \frac{\partial L}{\partial u^a} Y^a \big|_{{\dwt{F}}^{(n)}(t,s)} \ .
 \end{split}
 \end{equation}
From this and \eqref{st}, the conclusion follows.
\end{pf}
\par
\smallskip
\subsection{The  Principle of Minimal Labour}\hfill\par
\label{section7.2}
 Let  us now go back to our original triple $( \mathscr{K},  L,  C)$ and to the parameterised graphs $ \gamma(t) $ in $ \mathbb{R} \times \mathscr{Q}$.  We have already observed that for any $ \mathscr{K}$-controlled curve
 $ \gamma^{( U)}(t) = (t, q^i(t))$
 there is a uniquely associated element $\dwt U \in \dwt \mathscr{K}$ and a uniquely associated $\dwt \mathscr{K}$-controlled curve of the form
 $$\dwt \gamma^{(\dwt U)} = (t, q^i(t), {\bf h}^i_\b(t), {\bf h}'{}^i_\b(t), {\bf h}''{}^i_\b(t),  \l= 1, \mu^{(\dwt U)}(t))\ ,$$
 i.e.  with the same components $q^i(t)$ of $\gamma^{(U)}$. On the basis of this,  in what follows  for  any given  $ U \in  \mathscr{K}$ we  use the symbols $\dwt U$ and  $\dwt \gamma^{(\dwt U)}$ to denote  the  uniquely associated element in $\dwt \mathscr{K}$ and the  corresponding $\dwt \mathscr{K}$-controlled  curve, respectively.
 \par
 \smallskip
Let  $ U_o  = (u_o(t),  \sigma_o(t))$ be a fixed element in  $ \mathscr{K}$ and  $  \gamma^{( U_o)}: [0,T] \to [0,T] \times  \mathscr{Q} $ the corresponding $ \mathscr{K}$-controlled curve.  Exactly as in the previous section, we may now consider a {\it $ \mathscr{K}$-controlled variation}  of this curve, i.e.  a smooth  $1$-parameter family $ F(\cdot, s)$, $s \in [0,1]$,  of  $ \mathscr{K}$-controlled curves with  initial  curve $ F(\cdot, 0) =   \gamma^{( U_o)}$.   As we did in dealing with  $\dwt \mathscr{K}$-controlled variations, we denote by $ F^{(n)}$ the
 homotopy in  $J^n( \mathscr{Q}|\mathbb{R}) \times K$
  $$ F^{(n)}: [0,T] \times [0,1] \longrightarrow J^n( \mathscr{Q}|\mathbb{R})\times K\ ,\qquad  F^{(n)}(t,s) \= (j^{(n)}_t( F(\cdot, s)), u(t,s))\ , $$
determined by  the homotopy of the $n$-th order jets of the  curves  $\gamma^{( U(s))} =  F(\cdot, s)$ and the homotopy $u(t, s) = u^{(s)}(t)$ of control curves.  We  may also consider the vector fields
  \begin{align}\label{vectorX-A} X_{ F}|_{ F^{(n)}(t,s)} &\=  F^{(n)}_*\left(\frac{\partial}{\partial t}\bigg|_{(t,s)}\right) = \frac{\partial  F^{(n)}}{\partial t}\bigg|_{(t,s)}\ ,  \\
\label{vectorY-A} Y_{ F}|_{ F^{(n)}(t,s)} & \=  F^{(n)}_*\left(\frac{\partial}{\partial s}\bigg|_{(t,s)}\right) = \frac{\partial  F^{(n)}}{\partial s}\bigg|_{(t,s)}\ ,
\end{align}
defined   at  the points  of the  surface
 $ \mathscr{S} \=  F^{(n)}([0,T] \times [0,1])  \subset J^n( \mathscr{Q}|\mathbb{R}) \times K$.  By construction,  for each fixed  $s_o \in [0,1]$ we have that:  (a) the restriction of  $X_{ F}$ to the trace of   the  curve
 $$t \mapsto  \left( \gamma^{( U(s_o))(n)}(t) , u(t, s_o)\right) = \left(j^n_{t}\left({{F}}(\cdot s_o)\right), u(t, s_o)\right)$$
 is the family of    the tangent vectors of such a curve; (b) the restriction of  $Y_{ F}$ to the trace of the same  curve   is  the Jacobi vector field   corresponding to the  (infinitesimal) variation $\varepsilon \to  F^{(n)}(\cdot, s_o+\varepsilon)$  of $ F^{(n)}(\cdot, s_o) $; (c) the vector fields  $X_{ F}$ and $Y_{ F}$ have the form
 \begin{equation} \label{54uno-A}   X_{ F} = \frac{\partial}{\partial t} +   X^i_{(\b)} \frac{\partial}{\partial q^i_{(\b)}} + X^a \frac{\partial}{\partial u^a}    \ ,\qquad
  Y_{ F} =    Y^i_{(\b)}  \frac{\partial}{\partial q^i_{(\b)}}   + Y^a \frac{\partial}{\partial u^a}\ .
  \end{equation}
  Finally,   we have that  the curve  $ U(s) \in  \mathscr{K}$  determines uniquely  a    curve $\dwt U(s)$ in $ \dwt \mathscr{K}$ and a corresponding  $\dwt \mathscr{K}$-controlled variation ${\dwt{F}}$  starting from the curve   $\dwt \gamma \= \dwt \gamma^{(\dwt U_0)}$ and ending with   the curve $\dwt \gamma' \= \dwt \gamma^{(\dwt U_1)}$.\par
\smallskip
  We are now ready to establish the following corollary of  Theorem \ref{prop34} and Remark \ref{rem72}.
 \begin{cor}[Homotopy Formula]  \label{cor34}  Let $ U_0,  U_1 \in  \mathscr{K}$  be the endpoints of a smooth curve $ U(s) \in  \mathscr{K}$, $s \in [0,1]$, and
 $ \gamma \=  \gamma^{( U_0)}$,  $ \gamma' \=  \gamma^{( U_1)}$ the $ \mathscr{K}$-controlled curves corresponding to  $ U_0,  U_1$, with terminal costs  $C_0 \= C(j^{n-1}_{t = T}( \gamma))$  and  $C_1 \= C(j^{n-1}_{t = T}( \gamma'))$, respectively.   Let also  $\mathscr{P}_{j^n_t(\gamma)} : K \to \mathbb{R}$ and $\mu, \mu': [0,T] \times [0,1] \to \mathbb{R}$ be the real functions defined by
 \begin{equation}  \mathscr{P}_{j^n_t(\gamma)}(u^a) \= -   L(j^n_t(\gamma), u^a)\ ,\end{equation}
\begin{multline} \label{7.17} \mu(t, s)  \=  -  \int_0^t \bigg(L  + \frac{1}{2}\!\!\!\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( ( {\bf h}^i_{\b(1)})^2 {-} ( {\bf h}'{}^i_{\b(2)})^2 {-}  ( {\bf h}''{}^i_{\b(2)})^2
    \bigg) + \\
  + \!\!\! \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( \frac{1}{2} ( {\bf h}^i_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^i_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^i_{\b})^2  \bigg)  \bigg)\bigg|_{ \gamma^{( U(s))}(\t)}  d\t
   \end{multline}
   \begin{equation} \label{7.17'}  \mu'(t, s)  \= \mu(t, s) +  \sum_{\b = 1}^{r-1}  \sum_{i= 1}^N  \int_0^s \left(    {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)}  \right)\bigg|_{{\dwt{F}}^{(n)}(t, v)} d v   \end{equation}
where we denoted by $\dwt F$ the uniquely determined  $\dwt \mathscr{K}$-controlled variation described above and by $ Y'{}^i_{\b(0)} $, $ Y''{}^i_{\b(0)} $
   the components in the directions of the coordinates ${\bf h}'{}^i_{\b(0)}$,  ${\bf h}''{}^i_{\b(0)}$ of the  vector field $Y_{\dwt F}$ defined in \eqref{vectorY}. Let us finally denote by  $Y_{ F}$ the vector field  in \eqref{54uno-A},  associated with the $\mathscr{K}$-controlled variation $F$ determined by the  $U(s)$, $s \in [0,1]$,
 Then:
 \begin{itemize}
 \item[(i)] The difference between the  terminal costs $C_0$ and $C_1$ is equal to
\begin{equation} \label{homotopy-ultimate-A}
\begin{split}
 C_1 - C_0   =   - \int_0^T \left( \int_0^1    \left(Y^a \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(s)}(t)} -  \frac{\partial^2  \mu'}{\partial t\, \partial s}\bigg|_{(t,s)} \right)ds \right) dt  \ , \quad \sigma^{(s)}_t \= j^n_t( \gamma^{( U(s))})\ ;
 \end{split}
\end{equation}
\item[(ii)] For any $s_o \in [0,1]$,
\begin{equation}\label{controlledNoether}  \a^{PC}\left(Y_{\dwt F}\right)|_{\dwt F^{(n)}(T, s_o)}  = \a^{PC}\left(Y_{\dwt F}\right)|_{\dwt F^{(n)}(0, s_o)} + \int_0^T  \Bigg( \frac{\partial^2 \mu'}{\partial t\,\partial s}\bigg|_{s = s_o} \Bigg)dt \ .\end{equation}
\end{itemize}
\end{cor}
\begin{pf}   By Theorem \ref{prop34},  Remark \ref{rem72} and the fact that, due to the Euler-Lagrange equations,  the \eqref{7.17} is nothing but  the explicit expression for the $\mu$-components of the curve $\dwt \gamma^{(\dwt U(s))}(t)$ (thus, of the function $\dwt \mu(t,s)$ of Theorem \ref{prop34}),  claim (i) follows immediately. \par
We  now prove (ii).  Consider the embedded surface with boundary
 $\dwt  \mathscr{S} \=  \dwt F^{(n)}([0,T] \times [0,1])$  and the vector fields  $X_{\dwt F}$, $Y_{\dwt F}$, which we  defined above at the points of  $ \dwt \mathscr{S}$.
From  \eqref{extendedaction} and  the fact that $\a^{PC}$ is  variationally equivalent  to $\a$,
we have that
\begin{equation}  \label{primissima-A}
\begin{split} C_0 - C_1 &= C(j^n_{t = T}( \gamma^{( U_0)})) - C(j^n_{t = T}( \gamma^{( U_1)})) = \\
& = \int_0^T \imath_{\frac{\partial}{\partial t}}\left({{\dwt F}}^{(n)*}(\a^{PC})\right)\bigg|_{(t,0)}  dt  -
\int_0^T \imath_{\frac{\partial}{\partial t}}\left({\dwt F}^{(n)*}(\a^{PC})\right)\bigg|_{(t,1)}  dt \ .
\end{split}
\end{equation}
On the other hand,
\begin{equation}
\begin{split} \label{secondina-A} &\int_0^1 \imath_{\frac{\partial}{\partial s}}\left( \dwt F^{(n)*}(\a^{PC})\right)\bigg|_{(0,s)} ds  = \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(0, s)}  ds\ ,\\
  &\int_0^1 \imath_{\frac{\partial}{\partial s}}\left( \dwt F^{(n)*}(\a^{PC})\right)\bigg|_{(T,s)} ds = \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(T, s)}  ds \ .
 \end{split}
 \end{equation}
From \eqref{primissima-A},  \eqref{secondina-A}  and  the Stokes Theorem, we get that
\begin{equation} \begin{split} \label{st-A}
 C_0 - C_1
 & =  \int_{\partial ([0,T] \times [0,1])}\left( \dwt F^{(n)*}(\a^{PC})\right)\bigg|_{(t,s)}  + \\
 & \hskip 2 cm + \int_0^1 \imath_{\frac{\partial}{\partial s}}\left( \dwt F^{(n)*}(\a^{PC})\right)\bigg|_{(0,s)} ds -
 \int_0^1 \imath_{\frac{\partial}{\partial s}}\left( \dwt F^{(n)*}(\a^{PC})\right)\bigg|_{(T,s)} ds = \\
 &=   \int_{[0,T] \times [0,1]} \left( \dwt F^{(n)*}(d \a^{PC})\right)\bigg|_{(t,s)}  + \\
 & \hskip 2 cm +  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(0, s)} -  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(T, s)}  ds = \\
& = \int_{[0, T] \times [0,1]} d \a^{PC}(X_{ \dwt F}, Y_{ \dwt F})\big|_{ \dwt F^{(n)}(t,s)} dt\, ds + \\
 & \hskip 2 cm +  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(0, s)} -  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{ \dwt F^{(n)}(T, s)}  ds
 \ .
 \end{split}\ .\end{equation}
As in the proof of Theorem \ref{prop34},  we now observe  that   the vectors $X_{ \dwt F}$ are  the tangent vectors to   curves of jets  that are  solutions to the Euler-Lagrange equations \eqref{modifiedEL}.  Hence, by Lemma \ref{pcprop}, at any   point of $ \mathscr{S} =  \dwt F^{(n)}([0,T] \times [0,1]) $,  we have  that
    \begin{equation}
   d   \a^{PC}\left(X_{ \dwt F},  Y_{ \dwt F}\right)   = - Y^a \frac{\partial  L}{\partial u^a} =   Y^a {\frac{\partial \mathscr{P}_{\sigma^{(s)}_t}}{\partial u^a}}\bigg|_{u^{(s)}(t)}\ .
\end{equation}
From this and \eqref{st-A}, it follows that
\begin{equation}
\begin{split} C_0 - C_1 &=  \int_0^T \left( \int_0^1 \left(Y^a \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a}  \right)\Bigg|_{u^{(s)}(t)}  ds \right) dt  + \\
 & \hskip 2 cm +  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(0, s)} -  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(T, s)}  ds
 \ .
 \end{split}
\end{equation}
 This and (i)  imply that
$$  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(T, s)} ds =  \int_0^1 \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(0, s)}  ds +  \int_0^1 \left( \int_0^T  \frac{\partial^2   \mu'}{\partial t\,\partial s} dt \right) ds   \ . $$
This identity holds not only for the $ \mathscr{K}$-controlled homotopy $ F$, but, for a fixed  $s_o \in [0,1]$ and a fixed sufficiently  small $\varepsilon > 0$, it holds
also for any other $ \mathscr{K}$-controlled homotopy  of the form
$$ F^{(s_o, \varepsilon)}(t,\t) \=  F\left(t,  s_o (1 - \t) +  (s_o + \varepsilon) \t \right)\  ,\qquad \t \in [0, 1]\ ,
$$
 which  interpolates between  the  curve $\gamma^{(U(s_o))}$ to the  curve  $\gamma^{(U(s_o + \varepsilon))}$.
This implies that for any fixed choice of  $s_o \in [0,1)$ and any small $\varepsilon > 0$
$$  \int_{s_o}^{s_o + \varepsilon} \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(T, s)} ds  {=}  \int_{s_o}^{s_o + \varepsilon} \a^{PC}\left(Y_{ \dwt F}\right)|_{{ \dwt F}^{(n)}(0, s)}  ds + \int_{s_o}^{s_o+ \varepsilon}  \left( \int_0^T   \frac{\partial^2  \mu'}{\partial t\,\partial s} dt \right)ds.$$
From this and the continuity of  all involved functions, claim (ii) follows.
\end{pf}
\par
The homotopy formula  has the following   immediate consequence, which is the first main result that was expected according to  the road map. \par
\begin{theo}[Generalised Principle of Minimal Labour] \label{corollone}   A necessary condition for a $ \mathscr{K}$-controlled curve $ \gamma_o \=  \gamma^{( U_o)}$ to be a  solution to the considered generalised Mayer  problem
is that   for any $ \mathscr{K}$-controlled variation  $ F$ with $ F(t,0) = \gamma_o$ one has that
  \begin{equation} \label{formulacor}  \int_0^T \left( \int_0^1    \left(Y^a \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(s)}(t)} - \frac{\partial^2 \mu'}{\partial t\,\partial s}\bigg|_{(t,s)}\right)ds \right) dt \leq 0 \ .\end{equation}
In case  the considered problem is such that for  any two $ \mathscr{K}$-controlled curves $ \gamma \=  \gamma^{( U)}$ and $ \gamma' \=  \gamma^{( U')}$  there is a
$ \mathscr{K}$-controlled variation which has  them as endpoints,  the above  is also  a sufficient condition.
\end{theo}
\par
\medskip
Notice that the above principle  admits  the following equivalent formulation.\\[10pt]
 {\it Let   $ \gamma_o \=  \gamma^{( U_o)}$ be  a fixed $ \mathscr{K}$-controlled curve and  for any  $ \mathscr{K}$-controlled variation $ F$ with $ F(t,0) = \gamma_o$
consider the real function  $\mathscr{W}^{ F}: [0,1] \to \mathbb{R}$ defined by
\begin{equation}  \label{formulacor-bis}
 \mathscr{W}^{ F}(\d) \=  \int_0^T \left( \int_0^\d    \left(Y^a \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(s)}(t)} -  \frac{\partial^2  \mu' }{\partial t\,\partial s}\bigg|_{s}\right)ds \right) dt
\ .\end{equation}
Then  $ \gamma_o \=  \gamma^{( U_o)}$ is a solution to the   Mayer  problem  determined by $( \mathscr{K},  L,  C)$ only if for any $ \mathscr{K}$-variation as above
\begin{equation}   \label{formulacor-bis1}  \mathscr{W}^F(\d) \leq 0\qquad \text{for each}\ \d \in [0,1]\ .\end{equation}
}
\\
It should be pointed out that  an explicit check of \eqref{formulacor-bis1}  is expected to  be  quite hard in  generic situations:  it demands the  study  of the sign
behaviour of the functions $\mathscr{W}^F$  for {\it any}   $ \mathscr{K}$-controlled variation $F$  of a candidate $ \gamma_o$.  Nonetheless it has
a number of  consequences,  the most elementary one  represented  by an infinitesimal version of Theorem  \ref{corollone},   the concluding result of this section. \par
Let $ \gamma_o \=  \gamma^{( U_o)}$ be a $ \mathscr{K}$-controlled curve associated with the pair $ U_o = (u_o(t),  \sigma_o)$  and denote by
$\mathscr{F}$   the full collection   of   the $ \mathscr{K}$-controlled variations of $ \gamma_o$.  Let also denote by $\mathscr{J} ac^{(n)}$ the class of  all  vectors fields $V$ in $T J^n(\mathscr{Q}|\mathbb{R})$, defined just at the points of the trace of $ \gamma^{(n)}_o(t)$,
 of the form
$V|_{ \gamma^{(n)}_o(t)} \= Y_{ F}|_{ \gamma^{(n)}_o(t)}$ for some $F \in \mathscr{F}$.   In other words,  $\mathscr{J} ac^{(n)}$ is the family of all  Jacobi vector fields  of   $ \gamma^{(n)}_o(t) $, which are  determined by the variations of curves of jets determined by  the $ \mathscr{K}$-controlled variations of $ \gamma_o$.
\par
\smallskip
\begin{theo}
 A  $ \mathscr{K}$-controlled curve   $ \gamma_o \=  \gamma^{( U_o)}$ is    a solution to the  Mayer  problem  of  $( \mathscr{K},  L,  C )$ only if the following two conditions hold for any $V \in  \mathscr{J} ac^{(n)}$:
 \begin{itemize}[itemsep = 10pt]
 \item[(1)] $dC \left(V|_{ \gamma^{(n)}_o(T)}\right) \geq  0$;
 \item[(2)] $ \displaystyle  \int_0^T   \left(Y^a \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u_o(t)} -  \frac{\partial^2   \mu' }{\partial t\,\partial s}\bigg|_{s = 0}\right) dt  \leq 0$.
 \end{itemize}
\end{theo}
\begin{pf}  (2) is an immediate consequence of     \eqref{formulacor-bis1}.  For (1), one can obtain it by just  observing the function $\mathscr{W}^F$ coincides with  the map
$\d\overset{\mathscr{W}^F} \longmapsto C|_{F^{(n)}(T, 0)} -  C|_{F^{(n)}(T, \d)}$. The inequality is  then obtained  taking the derivative of this expression at $\d = 0$.
\end{pf}
\par
\medskip
  \section{The generalised   Pontryagin Maximum Principle}
  \label{Sect7}
  In this section we want to show  that  the Principle of Minimal Labour yields  a  strict  analogue   of the classical PMP   for a wide class of  generalised Mayer problems of  higher order differential constraints of variational type  and without the usual restriction of  fixed initial values.  The class we  consider  is characterised by  {\it   differential constraints of normal type}, which are   defined in the next subsection. Immediately after this, we introduce a  generalised version  of the classical Pontryagin needle variations and we finally  prove the advertised result.
  \par
  \smallskip
\subsection{Differential constraints of normal type}  \hfill\par
\label{defnormal}
As usual,  we consider a Mayer problem determined by a triple $(\mathscr{K}, L, C)$ with controlled Lagrangian $L$ of actual order $r\geq 1$ and associated   controlled Euler-Lagrange equations  of order at most $2 r$.  Let us    indicate such a system of  differential constraints  as
\begin{equation} \label{first-1} \mathscr{E}^j\left(t, q^i, \frac{d q^i}{dt}, \ldots, \frac{d^{2r} q^i}{dt^{2r}}, u^a(t)\right) = 0\ ,\qquad 1 \leq i \leq N\ .\end{equation}
By considering  appropriate auxiliary variables,   say
$$y^1(t) = q^1(t) \ ,\ \ y^2(t) = q^2(t)\ ,\ \  \ldots\ \ , y^{N+1}(t) = \frac{d q^1}{dt}\ ,\ \  y^{N+2}(t) = \frac{d q^2}{dt}\ ,\ \ \ldots\ ,$$
the original  system  \eqref{first-1} can be always transformed  into an equivalent system on the new functions $y^A(t)$, which consists only of {\it first} order differential  equations    of the form
\begin{equation} \label{first-2}  \mathscr{G}^B\left(t, y^1, y^2,  \ldots, y^{\widetilde N},  \frac{d y^1}{dt}, \frac{d y^2}{dt}, \ldots,  \frac{d y^{\widetilde N}}{dt},  u^a(t)\right) = 0\ ,\qquad  1 \leq B \leq \widetilde N' \end{equation}
for  some appropriate    $\widetilde N$-tuples of variables  and $\widetilde N'$-tuples of equations, with  both $\widetilde N$ and $\widetilde N'$ greater than or equal to $N$.  In general, there is not a unique way to reduce the constraints \eqref{first-1} into a form \eqref{first-2}. For instance,  the second order equation on curves $q(t) \in \mathscr{Q} = (0, + \infty)$
\begin{equation}\label{ex} q \frac{d^2 q}{dt^2} + \left(\frac{d q}{dt} \right)^2 - u(t) = 0\end{equation} can be reduced not only  to the equivalent first order system
\begin{equation}\label{bad} y^1 \frac{d y^2}{dt}  + (y^2)^2 - u = 0\ ,\qquad \frac{d y^1}{dt} - y^2 = 0\ ,\end{equation}
but also to the  system (via the change of variable $\widetilde y^1 = q^2$)
\begin{equation} \label{good} \frac{d \widetilde y^2}{dt} - 2 u = 0\ ,\qquad  \frac{d \widetilde y^1}{dt} - \widetilde y^2 = 0\ .\end{equation}
We say that {\it the differential constraints \eqref{first-1} are  of normal type} if they  are equivalent to at least one   first order differential system  \eqref{first-2},
consisting only of  first order equations in normal form, that is having the form
\begin{equation} \label{first-3}  \frac{d y^A}{d t} = g^A(t, y^B,  u^a(t)) \ , \end{equation}
{\it with some smooth function $g = (g^A): \mathbb{R} \times \mathbb{R}^{\widetilde N} \times K \subset \mathbb{R}^{ \widetilde N + M +1} \to  \mathbb{R}^{\widetilde N}$}.
Note that, in the previous  example, the system \eqref{bad} does not satisfy such a regularity  assumption, but \eqref{good} does. This is good enough for us to consider the  \eqref{ex} as a constraint of normal type. \par
\smallskip
 In case it is possible to transform the original constraints into some of the form \eqref{first-3} in which the $g^A$
 and the partial derivatives $\frac{\partial g^A}{\partial y^B}\big|_{(t, y^B, u)}$ have
uniform    bounds   we say that they are
of {\it bounded normal type}.
\par
\begin{rem} \label{cut-off}
In dealing with   localised properties of  solutions of  a set of differential constraints,
using cut-off functions  it is in general possible to  replace some (possibly unbounded) smooth functions  $g^A$ by  other
 functions  $g'{}^A$,
coinciding with the $g^A$ on an appropriate compact set and satisfying global bounds for their values and  the partial derivatives $\frac{\partial g^A}{\partial y^B}$.
This idea  is a common tool   for  extending  estimates  on  solutions of  constraints of {\it bounded} normal type to   those of  more general  constraints of normal type.
\end{rem}
Consider now  the distance function on the family of control curves  $u, u': [0,T] \to K \subset \mathbb{R}^M$ defined by
$$\operatorname{dist}(u, u') \= \text{measure}\left\{\ t \in [0, T]\ :\ u(t) \neq u'(t)\  \right\}$$
and denote by $\r$ a fixed metric on the jet space  $J^{n-1}(\mathscr{Q}|\mathbb{R})|_{t =0}$ of initial values, which generates the standard topology of such a space.
The next lemma is an immediate consequence of a classical fact on  systems of controlled first order differential equations (see e.g. \cite[Prop. 3.2.2]{BP}).
It gives  the main motivation for considering the class of  differential constraints  of normal type.
\begin{lem} \label{normallemma} Let $(\mathscr{K}, L, C)$ be a defining triple of a Mayer problem with differential constraints of order $2r$  of  bounded normal type and $K \subset J^{n-1}(\mathscr{Q}|\mathbb{R})|_{t = 0}$ a compact subset in the  space of  the $(n-1)$-jets at $t = 0$.   There exists
a constant ${\mathfrak c}$,  depending only on $L$, such that for any two  $\mathscr{K}$-controlled curves
$$\gamma^{(U)}, \gamma^{(U')} : [0, T] \longrightarrow [0,T] \times \mathscr{Q} \ ,$$ determined by pairs  $U  = (u(\cdot), \sigma)$, $U'= (u'(\cdot), \sigma') $  with  $\sigma$, $\sigma'$ in $K$, one has
\begin{equation} \| \gamma^{(U)} - \gamma^{(U')}\|_{\mathcal{C}^{2r-1}} \leq {\mathfrak c}\, \left(\operatorname{dist}(u, u') + \r(\sigma, \sigma')\right)\ .\end{equation}
\end{lem}
\par
\smallskip
 \subsection{Generalised needle variations}\hfill\par
 \label{generalisedneedle}
Let  $ U_o  = (u_o(\cdot),  \sigma_o)$ be a fixed element in  $ \mathscr{K}$ and   $  \gamma^{( U_o)}: [0,T] \to [0,T] \times  \mathscr{Q} $ the uniquely corresponding $ \mathscr{K}$-controlled curve.
Pick also a strictly positive  time $\t \in (0, T)$, a point $\o \in K$ and two real numbers  $0 < k < < 1$ and $0 < \varepsilon_o $  small enough so that  $[\t - \varepsilon_o - k \varepsilon_o^2, \t + k \varepsilon_o^2] \subset (0,T)$.  After fixing $k$ and the triple $(\t, \o, \varepsilon_o)$,
we may consider  the piecewise continuous map
\begin{equation} \label{uk}
u^{(\t, \o, \varepsilon_o)}: [0, T] \to K\ ,\qquad u^{(\t, \o, \varepsilon_o)}(t) \= \left\{\begin{array}{ll} u_o(t) & \text{if} \ t \in \big[0, \tau- {\varepsilon_o} \big),\\[4pt]
 \omega & \text{if}\ t \in \big[\tau - {\varepsilon_o},  \tau\big),\\[4pt]
 u_o(t) & \text{if} \ t \in \big[\tau, T\big]\ \\
 \end{array}\right.
 \end{equation}
 and  an appropriate associated {\it smooth} map  $\check u^{(\t, \o, \varepsilon_o)}:  [0, T] \to \check K$ with values in the convex hull $\check  K \subset \mathbb{R}^M$ of a slightly larger  open neighbourhood  of $K$, described as follows.
 We assume that $\check u^{(\t, \o, \varepsilon_o)}(t)$  is equal to   $u^{(\t, \o, \varepsilon_o)}(t)$ for  all  points $t$   in $[0,T]$ with the only exception  of  those in two  small intervals of the form  $[\t - \varepsilon_o - k \varepsilon_o^2,  \t - \varepsilon_o]$ and $[ \t, \t + k \varepsilon_o^2]$ with $k<<1$, in which  the function $\check u^{(\t, \o, \varepsilon_o)}(t)$  is required just to take values in $\check K$, with no   further restrictions.  We call $u^{(\t, \o, \varepsilon_o)}$  the {\it needle modification of $u_o$ at $t = \t$ of ceiling value $\o$ and  width $\varepsilon_o$}. Any associated smooth approximation  $\check u^{(\t, \o, \varepsilon_o)}$ will be  called {\it smoothed needle modification} (see Fig. 2 and Fig. 3).
There are of course several ways to build up a smoothed needle modification for  a given discontinuous one. Nonetheless,   we assume that  a fixed algorithm  has been chosen and that each discontinuous needle modification has a uniquely associated  smoothed one.   \\
 \medskip
 \centerline{
\begin{tikzpicture}
\draw[<->, line width = 1] (1,3.8) to (1,0.5) to (6.5,0.5);
\draw[<->, line width = 1] (7,3.8) to (7,0.5) to (12.5,0.5);
\draw[fill]  (3, 0.5) circle [radius = 0.06];
\node at  (3, 0.2) {\tiny $\t - \varepsilon_o$};
\draw[fill]  (4.5, 0.5) circle [radius = 0.06];
\node at  (4.5, 0.2) {\tiny $\t$};
\draw[fill]  (6.2, 0.5) circle [radius = 0.06];
\node at  (6.2, 0.2) {\small $T$};
\draw[fill]  (9, 0.5) circle [radius = 0.05];
\draw[fill,purple]  (8.5, 0.5) circle [radius = 0.06];
\node[purple] at  (8.1, 0.2) {\tiny $\t {-} \varepsilon_o{-} k\varepsilon_o^2$};
\node[purple] at  (11.2, 0.2) {\tiny $\t {+} k\varepsilon_o^2 $};
\draw[fill]  (10.5, 0.5) circle [radius = 0.05];
\draw[fill,purple] (11, 0.5) circle [radius = 0.06];
\draw[fill]  (12.2, 0.5) circle [radius = 0.06];
\node at  (12.2, 0.2) {\small $T$};
\draw[fill]  (1, 3) circle [radius = 0.06];
\node at  (0.8, 3) {\small $\o$};
\draw[fill]  (7, 3) circle [radius = 0.06];
\node at  (6.8, 3) {\small $\o$};
\node[blue] at (2.3,1.7) {\tiny$u_o(t)$};
\node[blue] at (5.3,1.9) {\tiny$u_o(t)$};
\node[black] at (3.7, 2.5) {$u^{(\t, \o, \varepsilon_o)}$};
\draw [line width = 0.7, blue] (1, 1) to [out=-20, in=200] (3,1.7)   ;
\draw [line width = 0.7, blue, dashed](3,1.7)  to (3, 3)   ;
\draw [line width = 0.7, blue] (3, 3) to  (4.5,3)   ;
\draw [line width = 0.7, blue, dashed] (4.5,3)  to(4.5, 1.7)   ;
\draw [line width = 0.7, blue] (4.5, 1.7) to [out=-20, in=150] (6.2,1.5)   ;
\draw [line width = 0.7, blue] (7, 1) to [out=-20, in=200] (9,1.7)   ;
\draw [line width = 0.7, blue, dashed](9,1.7)  to (9, 3)   ;
\draw [line width = 0.7, blue] (9, 3) to  (10.5,3)   ;
\draw [line width = 0.7, blue, dashed] (10.5,3)  to(10.5, 1.7)   ;
\draw [line width = 0.7, blue] (10.5, 1.7) to [out=-20, in=150] (12.2,1.5)   ;
\draw [line width = 1, purple](8.5,1.46)  to  [out=20, in=180] (9.1, 3) ;
\draw [line width = 1, purple] (10.4,3)  to  [out=0, in=180] (11, 1.64)   ;
\node[blue] at (8.3,1.7) {\tiny$u_o(t)$};
\node[blue] at (11.3,1.9) {\tiny$u_o(t)$};
\node[black] at (9.7, 2.5) {$\check u^{(\t, \o, \varepsilon_o)}$};
 \end{tikzpicture}
 }
   \centerline{\tiny\hskip 1 cm \bf Fig. 2 Needle modification \hskip 2 cm \bf Fig. 3 Smoothed needle modification}
\ \\
 \smallskip
From now on, we also assume the following convenient assumption:  \\[2pt]
 {\it The differential problems that determine the $ \mathscr{K}$-controlled
curves are well defined and with unique solutions  also for the pairs $( u(t), \sigma)$, in which the initial datum  $\sigma$  is as usual and   $ u(t)$  takes values in  the convex hull    $\check K$ of some open neighbourhood  of  $K$}.\\[4pt]
 On the basis of this assumption, we
may speak of a  $ \mathscr{K}$-controlled curve $ \gamma^{( U)}$,  $ U = ( u(t),  \sigma)$, not only when $u([0,T])$ is entirely included  in $K$,  but also when it is  within an appropriate convex set $\check K \supset K$.\par
\smallskip
In the next definition, the function $\Sigma = \Sigma(\varepsilon, s)$ is a continuous two-parameters family of initial data in $J^{n-1}(\mathscr{Q}|\mathbb{R})|_{t = 0}$ satisfying the condition   $\Sigma(\varepsilon, 0) = \sigma_o$ for each $\varepsilon \in [0, \varepsilon_o]$.
\par
\begin{definition}
The {\it (generalised) needle variation of  the $ \mathscr{K}$-controlled curve $\gamma^{( U_o)}$, corresponding to the triple $(\t, \o, \varepsilon_o)$ and led by the family  $\Sigma = \Sigma(\varepsilon, s)$} is the  one-parameter family of $ \mathscr{K}$-controlled variations
\begin{equation}\label{Cardino} \mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma^{(U_o)})\= \{\  F^{(\t, \o, \varepsilon, \Sigma)}:[0,T] \times [0,1] \to [0,T] \times  \mathscr{Q}\ , \ \varepsilon \in (0, \varepsilon_o]\ \}\ ,\end{equation}  in which the  variations $ F^{(\t, \o, \varepsilon, \Sigma)}$
are  determined as follows.   For each $\varepsilon \in (0,\varepsilon_o]$,   let $ U^{(\varepsilon, s)} = (u^{(\varepsilon, s)}(t),  \sigma^{(\varepsilon, s)} =   \sigma_o)$ be the curve in $ \mathscr{K}$, in which:
\begin{itemize}[leftmargin = 20pt]
\item the initial    data $ \sigma^{(\varepsilon, s)}$ are given by   $ \sigma^{(\varepsilon, s)} =   \Sigma(\varepsilon, s)$;
\item  the one-parameter family of curves $u^{(\varepsilon, s)}(t)$ takes values in the convex set  $\check K$ and is defined    by
\begin{equation}  u^{(\varepsilon, s)}(t) = (1-s) u_o(t) + s \check u^{(\t, \o, \varepsilon)}(t)\ ,\qquad s \in [0,1]\ .\end{equation}
\end{itemize}
Then, we define  $ F^{(\t, \o, \varepsilon, \Sigma)}$  as the  $ \mathscr{K}$-controlled variation
$$ F^{(\t, \o, \varepsilon, \Sigma)}(t, s) \=  \gamma^{( U^{(\varepsilon, s)})}(t)\ .$$
\end{definition}
In the following, given a needle variation $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)}$,  for each $\varepsilon \in (0, \varepsilon_o]$ we  denote by $ \mu'{}^{(\t, \o, \varepsilon, \Sigma)}, \mu'{}^{(\t, \o, \varepsilon, \Sigma)}:[0,T] \times [0,1] \to \mathbb{R}$ the   functions defined in  \eqref{7.17},  \eqref{7.17'},  by means of  the homotopy $F^{(\t, \o, \varepsilon, \Sigma)}$. \par
 \smallskip
\subsection{The generalised   Pontryagin Maximum Principle}\hfill\par
We are now ready to prove our announced analogue of the PMP for the class of generalised Mayer problems with differential constraints of normal type. As in all previous sections,  we  still consider  a fixed generalised Mayer problem  determined by one of the triples $(\mathscr{K}, L, C)$ described in Sect.\ \ref{definingtriples}.
We start with a preparatory lemma. \par
\begin{lemma}   \label{propnormal}
Let   $ \gamma_o \=  \gamma^{( U_o)}$ be a  $ \mathscr{K}$-controlled curve  and  $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)= \{ F^{(\t, \o, \varepsilon, \Sigma)}, 0 < \varepsilon \leq \varepsilon_o\}$ a needle variation of $\gamma_o$
 with associated  function  $\mu'{}^{(\t, \o, \varepsilon, \Sigma)}: [0,T] \times [0,1] \to \mathbb{R}$ as defined in  \S\ \ref{generalisedneedle}.
If  the Mayer problem has differential constraints of normal type,  the  limit
$\lim_{\varepsilon  \to 0}
 \mathscr{P}_{j^{r}_{\t} ( \gamma^{( U^{(\varepsilon,s)})})}(\o) $
  exist and is  equal to
\begin{equation}  \label{firstlimit-bis}  \lim_{\varepsilon  \to 0} \mathscr{P}_{j^{r}_{\t} ( \gamma^{( U^{(\varepsilon, s)})})}(\o) = \mathscr{P}_{j^{r}_{\t} ( \gamma^{( U_o)})}(\o)
 \ .\end{equation}
\end{lemma}
\begin{pf}  First of all, we recall  that, for any $\varepsilon \in (0, \varepsilon_o]$, the curve of controls $U^{(\varepsilon, s)} = (u^{(\varepsilon, s)}(t),  \sigma^{(\varepsilon, s)} =   \Sigma(\varepsilon, s))$, $s \in [0, 1]$, have all  initial data $\sigma^{(\varepsilon, s)}$ in the compact set $\Sigma([0, \varepsilon_o] \times [0,1])$  and  all control curves  $u^{(\varepsilon, s)}$  differ  from the control curve $u_o(t)$ only at the points of an interval of measure $\varepsilon$ (more precisely, of measure  $\varepsilon + o(\varepsilon)$  since we are considering  smoothed needle variations).
Thus,
 since all of  the  $ \gamma^{( U^{(\varepsilon,s)})}$ and their jets lie in a compact subset of $J^{2r+1}(\mathscr{Q}|\mathbb{R})$,  by   the standard use of cut-off functions  described  Remark \ref{cut-off} and Lemma \ref{normallemma}, we have that  $\| \gamma^{(U(\varepsilon, s))} - \gamma^{(U_o)}\|_{\mathcal{C}^{2r-1}} $ goes   to $0$ for $\varepsilon \to 0$. From this  the function  $\mathscr{P}_{j^{r}_{\t} ( \gamma^{( U^{(\varepsilon,s)})})}: K \to \mathbb{R}$ tends
 to the function $\mathscr{P}_{j^{r}_{\t} ( \gamma^{( U_o)})}: K \to \mathbb{R}$.
\end{pf}
  \begin{theo}[Generalised Pontryagin Maximum Principle] \label{theorem51}\label{POMPone} \label{generalizedPOMP}
Let   $ \gamma_o \=  \gamma^{( U_o)}$ be a  $ \mathscr{K}$-controlled curve for a generalised Mayer problem  with  differential constraints of normal type determined by a triple $(\mathscr{K}, L, C)$. A necessary condition for
$ \gamma_o$ to be  a solution   to the  Mayer  problem   is that for any    $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)= \{ F^{(\t, \o, \varepsilon, \Sigma)}, 0 < \varepsilon \leq \varepsilon_o\}$
  \begin{equation}  \label{712}  \mathscr{P}_{j^{r}_{\t} ( \gamma_o)}(\o) -  \liminf_{\varepsilon \to 0^+}  \frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0) }{\varepsilon}   \leq \mathscr{P}_{j^{n}_{\t} ( \gamma_o)} (u_o(\t))\ .\end{equation}
\end{theo}
\begin{pf} Let $ \mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)}(\gamma_o)$  be a fixed  needle variation
and $\mathscr{Z}:(0, \varepsilon_o] \to \mathbb{R}$  the function   defined by
\begin{equation}  \mathscr{Z}(\varepsilon) \=  \int_0^T \left( \int_0^1    \left(Y^{(\varepsilon)a} \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(\varepsilon, s)}(t)} -  \frac{\partial^2  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}}{\partial t\,\partial s}\bigg|_{(t,s)}\right)ds \right) dt\ , \end{equation}
where, as usual, $\sigma^{(s)}_t $ denotes the curve of jets  $\sigma^{(s)}_t  = j^n_t(\gamma^{(U(\varepsilon,s))})$ and the $Y^{(\varepsilon)a} $ are the components of the vector field $Y_{ F^{(\t, \o, \varepsilon, \Sigma)}}$ in the directions of the $u^a$-axes.
We recall that,
due to the particular construction of the homotopies  $ F^{(\t, \o, \varepsilon, \Sigma)}$,
\begin{equation} \label{limited} Y^{(\varepsilon)a}(t,s) = \frac{\partial  u^{(\varepsilon, s)a}(t)}{\partial s}  = \frac{\partial \left((1-s) u^a_o(t) + s \check u^{(\t, \o, \varepsilon)a}(t)\right)}{\partial s} = \check u^{(\t, \o, \varepsilon)a}(t) - u^a_o(t)\end{equation}
and $\left(\check u^{(\t, \o, \varepsilon, \Sigma)}-  u_o\right)\big|_{[0,T] \setminus [\t - \varepsilon - k \varepsilon^2, \t + k \varepsilon^2]} = 0 $. Thus
the  functions  $Y^{(\varepsilon)}{}^a|_{{u^{(s, \varepsilon)}(t)}}$  are  equal to $0$ at the points  outside of the rectangle  $ [\t - \varepsilon - \frac{k\varepsilon^2}{2}, \t + \frac{k \varepsilon^2}{2}] \times [0,1]$.
By Theorem \ref{corollone},  a necessary condition for $ \gamma_o$ to be a solution to the Mayer problem is that $\mathscr{Z}(\varepsilon) \leq 0$ for any $\varepsilon \in (0, \varepsilon_o]$ . Hence we have that for any such $\varepsilon$
\begin{align}
\label{step1} 0 & \geq  \frac{1}{\varepsilon} \mathscr{Z}(\varepsilon) =  \frac{1}{\varepsilon} \Bigg( \iint_{[0, T] \times [0,1]}    Y^{(\varepsilon)a} \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(\varepsilon, s)}(t)} dt ds -\\
\nonumber & \hskip 5 cm   - \iint_{[0, T] \times [0,1]}   \frac{\partial^2  \mu'{}^{(\t, \o, \varepsilon, \Sigma)}}{\partial t\,\partial s}\bigg|_{(t,s)} dt ds \Bigg) \ .
\end{align}
From \eqref{limited} the first double integral  in \eqref{step1}  reduces to the sum
\begin{multline*}
 \int_0^1 \int_{\t - \varepsilon - k \varepsilon^2}^{\t- \varepsilon} \!\!   Y^{(\varepsilon)a} \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{( \varepsilon, s)}(t)} dt ds +  \int_0^1 \int_{\t - \varepsilon}^{\t }    Y^{(\varepsilon)a} \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{( \varepsilon, s)}(t)} dt ds {+} \\
 {+} \int_0^1 \int_{\t}^{\t + k \varepsilon^2 }  \!\!  Y^{(\varepsilon)a} \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{( \varepsilon, s)}(t)} dt ds\,  {=} \int_0^1 \int_{\t - \varepsilon}^{\t }    (\o^a - u^a_o(t)) \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{( \varepsilon, s)}(t)} dt ds + O(\varepsilon^2)
 \ .
 \end{multline*}
From this, we obtain
\begin{align}
\nonumber 0 \geq &  \frac{1}{\varepsilon} \mathscr{Z}(\varepsilon) = \int_0^1 \frac{1}{\varepsilon} \left(  \int_{\t - \varepsilon}^\t \left( \o^a - u^a_o(t)\right) \frac{\partial \mathscr{P}_{\sigma^{(s)}_t} }{\partial u^a} \Bigg|_{u^{(\varepsilon, s)}(t)} dt   \right) ds    -\\
\nonumber & \hskip 6 cm  - \frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}+   O( \varepsilon)  = \\
\nonumber &  {=} \int_0^1  \left( \o^a - u^a_o(\t )\right) \frac{\partial \mathscr{P}_{\sigma^{(s)}_{\t }} }{\partial u^a} \Bigg|_{u^{( \varepsilon, s)}(\t )}  \hskip - 0.7cm  ds -\frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}+   O( \varepsilon) =
\end{align}
\begin{align}
\nonumber & = \int_0^1 \frac{\partial u^{(\varepsilon, s)a}}{\partial s}  \bigg|_{t = \t } \frac{\partial \mathscr{P}_{\sigma^{(s)}_{\t }} }{\partial u^a}\Bigg|_{u^{( \varepsilon, s)}(\t )}  \hskip - 0.7cm  ds  - \frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}+   O( \varepsilon) = \\
  \label{derivative}
  & =  \mathscr{P}_{j^{n}_{\t} ( \gamma^{( U^{(\t, \o,  \varepsilon)})})}(\o) {-}   \mathscr{P}_{j^{n}_{\t} ( \gamma^{( U_o)})}(u_o(\t)) -\frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}+   O( \varepsilon)
  \ .
\end{align}
From this and \eqref{firstlimit-bis}  the claim follows.
\end{pf}
\par
In order to have a  truly helpful theorem,   the previous result should be combined with some  efficient way to determine  the sign of the  corrective term  $\liminf_{\varepsilon \to 0^+} \frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}$ appearing in \eqref{712}.  This can be reached exploiting  the next technical lemma. \par
\begin{lem} \label{lemmarisolu} Let  the triple $(\mathscr{K}, L, C)$ and the curve   $ \gamma_o \=  \gamma^{( U_o)}$ be  as  in  Theorem \ref{POMPone}.
For any  $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)= \{ F^{(\t, \o, \varepsilon, \Sigma)}, 0 < \varepsilon \leq \varepsilon_o\}$ of  $\gamma_o $, one has that
\begin{multline} \label{717}\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  =   C\big|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,1)} -  C\big|_{\gamma^{(n)}_o(T)} - \\
 - \int_0^T L\big|_{F^{  (\t, \o, \varepsilon, \Sigma)(n)}(t,1)} dt  +  \int_0^T L\big|_{\gamma^{(n)}_o(t)} dt + \\
 + \int_0^1  \sum_{\d = 1}^r \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
(Y_{F})^{i}_{{(\d-(\varepsilon+1))}}  \big|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,s)} ds - \\
-  \int_0^1  \sum_{\d = 1}^r \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
(Y_{F})^{i}_{{(\d-(\varepsilon+1))}}  \big|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(0,s)} ds
\ . \end{multline}
\end{lem}
\begin{pf}
 Let $\Pi$ and $\Pi^{PC}$ be the $1$-forms on $J^n(\dwt \mathscr{Q}|\mathbb{R})$ defined by
 \begin{align}
\nonumber & \Pi \=  \bigg\{\frac{1}{2}\!\!\!\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( ( {\bf h}^i_{\b(1)})^2 {-} ( {\bf h}'{}^i_{\b(2)})^2 {-}  ( {\bf h}''{}^i_{\b(2)})^2
    \bigg) + \\
& \hskip 3 cm   + \!\!\! \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( \frac{1}{2} ( {\bf h}^i_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^i_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^i_{\b})^2  \bigg)   \bigg\} dt\ ,\\
\nonumber &\Pi^{PC} :=    \Pi
+   \l\hskip-10pt  \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \bigg( {\bf h}^i_{\b(1)} \varpi^i_{\b(0)}  -  {\bf h}'{}^i_{\b(2)} \varpi'{}^i_{\b(1)} -  {\bf h}''{}^i_{\b(2)} \varpi''{}^i_{\b(1)} + \\
   & \hskip 7 cm +     {\bf h}'{}^i_{\b(3)} \varpi'{}^i_{\b(0)} +  {\bf h}''{}^i_{\b(3)} \varpi''{}^i_{\b(0)} \bigg)
\end{align}
   (for the definitions of the $1$-forms $\varpi_{\b(\d)}^i$ etc., see \eqref{holonomic}). Consider  the   variation   $\dwt F = \dwt F^{(\t, \o, \varepsilon, \Sigma)}$
   in the extended space $\mathbb{R} \times \dwt \mathscr{Q}$,  which is uniquely associated with one of the    $F = F^{(\t, \o, \varepsilon, \Sigma)}$ belonging
   to the considered needle variation, as we indicated at the beginning of Sect.\ \ref{section7.2}. Let also denote by  $X_{\dwt{F}}$ and $Y_{\dwt{F}}$,
   the corresponding vector fields in $\dwt \mathscr{S} = \dwt F([0,T] \times [0,1])$,  as defined in \eqref{vectorX-A} and \eqref{vectorY-A}. Since
 $\Pi$ and $\Pi^{PC}$ are variationally equivalent (see definition in Sect.\ \ref{variationallyequiv}) and, at each point of $\dwt \mathscr{S}$,  the vector field $X_{\dwt{F}}$  is   tangent to  curves of jets of  one of the curves in $\dwt \mathscr{Q}$ determined by the homotopy $\dwt F$,  we have
\begin{multline} \label{720}
- \int_0^T  \Pi^{PC} \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 1)}  dt  + \int_0^T  \Pi^{PC} \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 0)}  dt  =\\
=  - \int_0^T  \Pi \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 1)}  dt  +
+  \int_0^T  \Pi \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 0)}  dt  = \\
  =  \mu^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu^{(\t, \o, \varepsilon, \Sigma)}(T,0)    + \int_0^T L\big|_{\dwt F^{(n)}(t,1)} dt  -  \int_0^T L\big|_{\gamma^{(n)}_o(t)} dt  \ .
\end{multline}
On the other hand, by the Stokes Theorem
\begin{multline} \label{pollini-bisbis}
- \int_0^T  \Pi^{PC} \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 1)}  dt  + \int_0^T  \Pi^{PC} \left(X_{\dwt{F}}\right)|_{{\dwt{F}}^{(n)}(t, 0)}  dt
= \int_0^1 \Pi^{PC} \left( Y_{\dwt F}\right)\big|_{\dwt F^{(n)} (0,s)} ds - \\
- \int_0^1 \Pi^{PC} \left(Y_{\dwt F}\right) \big|_{\dwt F^{(n)} (T,s)}ds
+\iint_{[0,T] \times [0,1]}d \Pi^{PC}(X_{\dwt{F}}, Y_{\dwt{F}})\big|_{{\dwt{F}}^{(n)}(t,s)} dt ds \end{multline}
We  claim that the third summand  in the right hand side of  \eqref{pollini-bisbis} is $0$. Indeed,  by the same arguments of the proof of Lemma \ref{pcprop},  the differential $d \Pi^{PC}$ is equal to a sum of $2$-forms that are (a) either identically vanishing on the vector field $X_{\dwt F}$    or (b)
have coefficients that vanish identically along the solutions of the Euler-Lagrange equations determined by
 \begin{multline*}L' =  \bigg\{\frac{1}{2}\!\!\!\sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( ( {\bf h}^i_{\b(1)})^2 {-} ( {\bf h}'{}^i_{\b(2)})^2 {-}  ( {\bf h}''{}^i_{\b(2)})^2
    \bigg) + \\
  + \!\!\! \sum_{\smallmatrix 1 \leq i \leq N\\
   0 \leq  \b \leq r-1
   \endsmallmatrix} \!\!\! \bigg( \frac{1}{2} ( {\bf h}^i_{\b})^2+ \frac{\pi^4}{32 T^4} ( {\bf h}'{}^i_{\b})^2 +  \frac{\pi^4}{32 T^4}( {\bf h}''{}^i_{\b})^2  \bigg)   \bigg\}\ .
   \end{multline*}
 Since we are integrating along the points of the surface $\dwt \mathscr{S}$ (whose components ${\bf h}^i_{\b}(t)$, ${\bf h}'{}^i_{\b}(t)$, ${\bf h}''{}^i_\b$ are   solutions  precisely to such Euler-Lagrange equations),  the claim follows.  From this,  \eqref{720} and \eqref{pollini-bisbis},   we  obtain
\begin{equation}   \label{pollini-bis}
\begin{split} \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) & - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)    +  \int_0^T L\big|_{\dwt F^{(n)}(t,1)} dt  -  \int_0^T L\big|_{\gamma^{(n)}_o(t)} dt = \\
&= \int_0^1 \Pi^{PC} \left(  Y_{\dwt F} \right) \big|_{{\dwt{F}}^{(n)}(0,s)} ds - \int_0^1\Pi^{PC} \left(  Y_{\dwt F} \right) \big|_{{\dwt{F}}^{(n)}(T,s)} ds + \\
& \hskip 1 cm +  \sum_{\b = 1}^{r-1}  \sum_{i= 1}^N  \int_0^1 \left(    {\bf h}'{}^i_{\b(3)} Y'{}^i_{\b(0)} + {\bf h}''{}^i_{\b(3)} Y''{}^i_{\b(0)}  \right)\bigg|_{{\dwt{F}}^{(n)}(T, v)} d v\ .
\end{split}
\end{equation}
We now recall  that the initial and terminal conditions on the functions   ${\bf h}^i_{\b}(t)$, ${\bf h}'{}^i_{\b}(t)$, ${\bf h}''{}^i_\b$  have been selected  such a way  that
the  three terms  of the right hand side of \eqref{pollini-bis}  are  equal to minus  the corresponding integrals along the two  ``vertical sides'' of  $\partial \dwt \mathscr{S}$ of  the $1$-form
\begin{equation}
 \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta}  \left(\frac{\partial  \left(L + \frac{ dC}{dt}\right) }{\partial q^i_{(\d)}} \right) \o^i_{(\d-(\zeta+1))}
\end{equation}
(see  Remarks \ref{remark52} and \ref{remark53}).  From this and  the fact that the cost function $C$ vanishes identically on $J^n(\mathscr{Q}|\mathbb{R})_{ t = 0}$,
it follows that
\begin{equation}   \label{pollini-terter}
\begin{split} \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1)  &- \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)   = - \int_0^T L\big|_{\dwt F^{(n)}(t,1)} dt  +  \int_0^T L\big|_{\gamma^{(n)}_o(t)} dt + \\
&\hskip 0.5 cm  +  \int_0^1  \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
Y_{\dwt F}{}^{i}_{{(\d-(\zeta+1))}}  \big|_{{\dwt{F}}^{(n)}(T,s)} ds - \\
 &\hskip 0.5 cm -  \int_0^1  \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
Y_{\dwt F}{}^{i}_{{(\d-(\zeta+1))}}  \big|_{{\dwt{F}}^{(n)}(0,s)} ds + \\
& \hskip 0.5 cm + \int_0^1  \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta} \frac{\partial  }{\partial q^i_{(\d)}}\left( \frac{ dC}{dt} \right)
Y_{\dwt F}{}^{i}_{{(\d-(\zeta+1))}}  \big|_{{\dwt{F}}^{(n)}(T,s)} ds.
\end{split}
\end{equation}
We now observe that the fifth summand in \eqref{pollini-terter}  is equal to  the sum along  the two ``vertical sides'' of $\partial \dwt \mathscr{S}$ of the $1$-form
$$\b^{PC} \= \frac{d C}{dt} dt + \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta} \frac{\partial  }{\partial q^i_{(\d)}}\left( \frac{ dC}{dt} \right)\o^i_{(\d-(\zeta+1))} \ . $$
This $1$-form is variationally equivalent to the $1$-form $\b \= \frac{d C}{dt} dt $.  Hence, by Stokes Theorem and the properties of the variationally equivalent $1$-forms
\begin{multline} \label{ultimino} \int_0^1  \sum_{\d = 1}^r \sum_{\zeta = 0}^{\d-1} (-1)^{\zeta}  \frac{d^\zeta}{dt^\zeta} \frac{\partial  }{\partial q^i_{(\d)}}\left( \frac{ dC}{dt} \right)
Y_{\dwt F}{}^{i}_{{(\d-(\zeta+1))}}  \big|_{{\dwt{F}}^{(n)}(T,s)} ds = \\
=  \int_0^T  \left( \frac{d C}{dt}  \bigg|_{{\dwt{F}}^{(n)}(t,1)} -  \frac{d C}{dt}  \bigg|_{{\dwt{F}}^{(n)}(t,0)}\right) dt +  \iint_{[0,T] \times [0,1]} d \b^{PC} (X_{\dwt F}, Y_{\dwt F})\bigg|_{\dwt F^{(n)}(t,s)} dt ds =
\\
= C\big|_{{\dwt{F}}^{(n)}(T,1)} -  C\big|_{\gamma^{(n)}_o(T)}  +   \iint_{[0,T] \times [0,1]} d \b^{PC} (X_{\dwt F}, Y_{\dwt F})\bigg|_{\dwt F^{(n)}(t,s)} dt\, ds  \ .
\end{multline}
Using once again  the  proof of Lemma \ref{pcprop}, and that  the curves ${\dwt{F}}^{(n)}(\cdot, s)$, $s \in [0,1]$, have tangent vectors on which the holonomic $1$-forms vanish identically, we obtain that the double integral in \eqref{ultimino} reduces to the integral of a linear combination of $2$-forms with coefficients given by
the Euler-Lagrange operator applied to the Lagrangian $\frac{d C}{dt}$. By the well-known property that  an  Euler-Lagrange operator  on a    total differential  gives an identically vanishing function,  we  conclude that  $  \iint_{[0,T] \times [0,1]} d \b^{PC} (X_{\dwt F}, Y_{\dwt F})\big|_{\dwt F^{(n)}(t,s)} dt\, ds = 0$.  From \eqref{ultimino} and \eqref{pollini-terter} the lemma follows.
 \end{pf}
\begin{cor}[Generalised Pontryagin Maximum Principle -- II Version] \label{Corollone}  Let   $(\mathscr{K}, L, C)$  be as in  Theorem \ref{POMPone} and for any $\mathscr{K}$-controlled curve   $ \gamma \=  \gamma^{( U)}$    denote by ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma)$   the  class of   needle  variations  $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)= \{ F^{(\t, \o, \varepsilon, \Sigma)}, 0 < \varepsilon \leq \varepsilon_o\}$ of  $\gamma_o $,
which satisfy  the following inequality  for any $\varepsilon \in (0, \varepsilon_o]$
\begin{multline} \label{additional}     \int_0^T \Bigg(L\big|_{F^{  (\t, \o, \varepsilon, \Sigma)(n)}(t,1)}   -   L\big|_{\gamma^{(n)}_o(t)} \Bigg)dt
 + \int_0^1 \Bigg(- \frac{\partial C}{\partial q^i_{(\b)}} (Y_F)^i_{(\b)}\bigg|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,s)} -  \\
-  \sum_{\d = 1}^r \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
(Y_{F})^{i}_{{(\d-(\varepsilon+1))}}  \big|_{F^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,s)} \Bigg) ds + \\
 + \int_0^1  \sum_{\d = 1}^r \sum_{\varepsilon = 0}^{\d-1} (-1)^{\varepsilon}  \frac{d^\varepsilon}{dt^\varepsilon}  \left(\frac{\partial L  }{\partial q^i_{(\d)}} \right)
(Y_{F})^{i}_{{(\d-(\varepsilon+1))}}  \big|_{F^{ (\t, \o, \varepsilon, \Sigma)(n)}(0,s)} ds \geq 0
\ . \end{multline}
A $\mathscr{K}$-controlled curve
$ \gamma_o = \gamma^{(U_o)}$ is   a solution   to the  Mayer  problem  only if  for any    needle variation in  ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma_o)$
  \begin{equation}  \label{712-bis}  \mathscr{P}_{j^{r}_{\t} ( \gamma_o)}(\o)   \leq \mathscr{P}_{j^{n}_{\t} ( \gamma_o)} (u_o(\t))\ .\end{equation}
\end{cor}
\begin{pf} From Lemma \ref{lemmarisolu},  if  a needle variation satisfies \eqref{additional}, then  the expression $- \frac{\mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T, 1) - \mu'{}^{(\t, \o, \varepsilon, \Sigma)}(T,0)  }{\varepsilon}$ is non-negative for any $\varepsilon \in (0, \varepsilon_o]$.  From this and   Theorem \ref{POMPone}, the necessary condition \eqref{712-bis} holds.
\end{pf}
\par
\smallskip
\subsection{The classical  Pontryagin Maximum Principle}\hfill\par
\label{classicalPMP}
Consider now a classical Mayer problem, i.e. a problem as described in Sect.\ \ref{section211}.  Let us  represent the controlled evolutions of the system by curves
$x(t) = (x^1(t), \ldots x^{N'}(t))$, $t \in [0, T]$,  in some $\mathbb{R}^{N'}$. They are   constrained by the  conditions:
\begin{itemize}[leftmargin = 25pt]
\item[(a)] $x(0) = x_o$ for a fixed initial value $x_o$;
\item[(b)] they satisfy the differential constraints $\frac{d x^i}{dt}  = f^i(t, x(t), u(t))$.
\end{itemize}
  As    pointed out in Sect.\ \ref{Cardinuccio},   if we   add the  auxiliary variables
$p = (p_1, \ldots, p_{N'})$,   impose that they  are solutions to the   equations
$ \frac{d p_i}{dt} = - p_\ell  \frac{\partial f^\ell}{\partial x^i}(t, x(t), u(t))$
and   set
$$q^1 \= x^1\ ,\ \ldots\ ,\ q^{N'} \= x^{N'}\\  , \ q^{N' + 1} \= p_1, \ \ldots\ , \ q^{2N'} \= p_{N'} \ ,$$
 such a classical  problem can be considered as a generalised  Mayer problem on $J^3(\mathbb{R}^N|\mathbb{R})$, $N = 2 N'$ (\footnote{We consider a jet bundle of order $3$ just to be sure that \eqref{crucialineq} is satisfied by the actual order $r = 1$ of the controlled Lagrangian  defined below.})   with  the  defining triple given by:
 \begin{itemize}[itemsep=5pt, leftmargin=10pt]
\item   the set $\mathscr{K}$  of  the  pairs $U = (u(t), \sigma)$,  in which $u(t)$ is a
smooth curve  $u: [0,T]   \to K\subset \mathbb{R}^M$  and   $\sigma = (A^i =  x^i(0), B_\ell = p_\ell (0))$  is a $0$-th order jet
where $x(0)= x_o$ and   $p(0)$ is (provisionally) unconstrained.
\item  the  controlled Lagrangian
$$L(t, q^j_{(\b)}, u^a) \=   p_i  \left(x^i_{(1)}  - f^i(t, x^i, u^a) \right)\ . $$
\item a  cost function  $C: J^3(\mathbb{R}^N|\mathbb{R}) \to \mathbb{R}$    which is of actual order $r = 0$   and coincides on $J^3(\mathbb{R}^N|\mathbb{R})|_{t = T}$  with a classical  terminal cost function,  depending just on the coordinates $x^i$. With no loss of generality, we  assume that $C$ depends just  on the  $x^i$ at all points.
\end{itemize}
Such  a (generalised) Mayer problem is manifestly of normal type, as defined in Sect.\ \ref{defnormal},  and Corollary  \ref{Corollone}  applies.  Let us therefore determine what are the needle variations of the class ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}$  for this setting.  First of all, we observe that along any solution of the controlled Euler-Lagrange equations of this problem, the function  $L$ vanishes identically. Hence, since the actual order $r$ of the Lagrangian is $r = 1$,  the characterising inequality \eqref{additional} reduces to
\begin{equation}  \label{additional-bis}  C\big|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,1)} -  C\big|_{\gamma^{(n)}_o(T)} \leq \\
 - \int_0^1  p_i
\frac{\partial x^i}{\partial s} \bigg|_{F^{(\t, \o, \varepsilon, \Sigma)}(T,s)} ds +  \int_0^1  p_i
\frac{\partial x^i}{\partial s} \bigg|_{F^{(\t, \o, \varepsilon, \Sigma)}(0,s)} ds
\ .
\end{equation}
Here, we denoted by $x^i = x^i(t, s)$ the component  in the  $x^i$-direction of the $\mathscr{K}$-controlled variation $F(t,s) = F^{(\t, \o, \varepsilon, \Sigma)}(t,s)$ of a considered generalised needle variation.  We now observe that
$$ C\big|_{{F}^{ (\t, \o, \varepsilon, \Sigma)(n)}(T,1)} -  C\big|_{\gamma^{(n)}_o(T)} = \int_0^1   \frac{\partial C}{\partial x^i}
\frac{\partial x^i}{\partial s} \bigg|_{F^{(\t, \o, \varepsilon, \Sigma)}(T,s)} ds$$
 and  $x^i(0, s) \equiv x^i_o$  so that $\frac{\partial x^i}{\partial s} \big|_{F^{(\t, \o, \varepsilon, \Sigma)}(0,s)} = 0$.
Thus, \eqref{additional-bis} is equivalent to
\begin{equation}  \label{additional-bisbis}  -  \int_0^1  \left( \frac{\partial C}{\partial x^i} + p_i\right) \frac{\partial x^i}{\partial s} \bigg|_{F^{(\t, \o, \varepsilon, \Sigma)}(T,s)}  ds \geq 0
\ .
\end{equation}
We now recall that  we are free to impose any initial  condition on  the auxiliary variables $p_j$. Furthermore, by the particular form  of the differential constraints on the curves $p_j(t)$,
it is certainly possible to determine  a family $\Sigma = \Sigma(\varepsilon, s)$ of initial data for a needle variation, with the property  that  the corresponding functions $p_j(t, s)$ of the $\mathscr{K}$-controlled curves of
a homotopy $F^{(\t, \o, \varepsilon, \Sigma)}$  satisfy the terminal conditions
\begin{equation} \label{questionable-2} p_i(T, s) =  -  \frac{\partial C}{\partial x^i}\bigg|_{x(T,s)}\ , \end{equation}
provided,  of course,  that such terminal conditions are satisfied in the first place  by the components  $p_{io}(T)  = p_i(T, 0)$  of $\gamma_o(T)$.
 (see also \cite[Sect.\ 5.1]{CS}).
This  and \eqref{additional-bisbis}    has  the following  crucial consequence: {\it  if $\gamma_o$ satisfies $ p_i(T) =  -  \frac{\partial C}{\partial x^i}\big|_{x(T)}$,  all of the  needle variations of  $\gamma_o$, which are led by a $\Sigma$  forcing \eqref{questionable-2}, are  in the class ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma_o)$ described in  Corollary \ref{Corollone}}. In particular, there is a needle variation $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)$ in the   class ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma_o)$  for any  choice of $\t \in (0, T]$, $\o \in K$ and $\varepsilon_o$ sufficiently small.  Thus,  by Corollary \ref{Corollone},  a necessary condition for such a curve $\gamma_o = \gamma^{(U_o)}$ to be a solution of the Mayer problem is that  the inequality \eqref{712-bis} holds for {\it any} needle variation as above. \par
\smallskip
We finally observe that,  for the classical Mayer problem considered in this section, we have
$ \mathscr{P}_{j^{1}_{t} ( \gamma_o)}(u^a) = \left(p_i f^i(t, x^i, u^a) - p_i x^i_{(1)}\right)\big|_{j^1_t(\gamma_o)}$.
Hence, if for each $(t, x^i,  p_i) \in \mathbb{R} \times \mathbb{R}^{2 N'}$,  we   denote by  $\mathscr{H}(t, x^i,  p_i): K \to \mathbb{R}$  the  classical  Pontryagin function
$$\mathscr{H}(t, x^i,  p_i)(u^a) \= \sum_{i = 1}^{N'} p_i f^i(t, x^i, u^a)\ , $$
for any needle variation we have
$ \mathscr{P}_{j^{1}_{t} ( \gamma_o)}(\o^a)    = \mathscr{H}(t, x^i,  p_i)|_{ \gamma_o(t)} (\o^a)- \left( p_i x^i_{(1)}\right)\big|_{j^1_{t}(\gamma_o)}$.
 From this,  we immediately derive   the  following version of the classical  Pontryagin Maximum Principle.
\begin{cor}[Pontryagin Maximum Principle]
 A  $ \widetilde \mathscr{K}$-controlled curve   $ \gamma_o \=  \gamma^{( U_o)}$,   with components $p_j(t)$ satisfying  $ p_i(T) =  -  \frac{\partial C}{\partial x^i}\big|_{x(T)}$,  is    a solution to the      Mayer  problem  determined by the above described triple  $( \widetilde \mathscr{K},  L, C)$ only if  for any $\t \in (0, T]$ and  $\o \in K \subset \mathbb{R}^M$  the following inequality holds:
 \begin{equation}   \label{PMPclassical} \mathscr{H}|_{\gamma_o(\t)}(\o) \leq \mathscr{H}|_{ \gamma_o(\t)}(u_o)  \ . \end{equation}
\end{cor}
\par
\medskip
  \section{A discussion of  a  basic  example and  some concluding remarks}\label{Sect8}
  \ \\[-1.5 cm]
 \subsection{Comparison of  different approaches to an elementary problem: \\ \phantom{aaa} the controlled linearised pendulum}\hfill\par
\label{sect8.1}
Let $x(t) \in \mathbb{R}$, $t \in [0,T]$, be the coordinate which describes the position in time of
a linearised pendulum controlled by a force $u(t)$, that is a dynamical system   subjected to the differential constraint $\ddot x(t)= - x(t) + u(t)$.
Assume also that  the force $u(t)$ is bound  to take values in  $K = [-1, 1] \subset \mathbb{R}$ and that  the  initial position for the pendulum  is constrained to be  $x(0)= 0$ and  the initial velocity  $\dot x(0)$ is   bound to be in $[-v_{\text{max}}, v_{\text{max}}]$ for some  $v_{\text{max}} > 0$.
We  want to  discuss the Mayer problem  corresponding to finding  a time-dependent force $u(t)$, under which
 the position $x(t)$ at  $t = T$ is maximised or, equivalently,  the terminal  cost  $C(x(T)) \= - x(T)$ is minimised. \par
\smallskip
The classical approach to such  a problem is the following.  First, let us reduce the differential constraint to a system of first order. This can be done by introducing an auxiliary variable, i.e. by representing the dynamical system with  curves  $(x^1(t), x^2(t)) \in \mathbb{R}^2$ with    $x^1(t) = x(t)$ and   $x^2(t) = \dot x^1(t)$. In this way the evolution of the system is described by curves
$ (t, x^1(t), x^2(t))$,  subjected to the differential constraints
\begin{equation} \label{firsthalf} \begin{array}{l} \dot x^1(t) = x^2(t)\ ,\\[10pt]  \dot x^2(t) = - x^1(t) + u(t)\ , \end{array} \qquad x^1(0) = 0 \ .
\end{equation}
 In these coordinates the terminal cost   is  determined  by the function $C(x^1, x^2) = - x^1$. \par
\smallskip
Second, the Pontryagin auxiliary variables $p_1(t)$ and $p_2(t)$ are introduced and the  evolutions of the system is now described by curves $\gamma(t) = (t, x^1(t), x^2(t), p_1(t), p_2(t))$  in $\mathbb{R} \times \mathscr{Q}$,  $\mathscr{Q} = \mathbb{R}^4$, constrained by the  \eqref{firsthalf} and, at the same time,  by
\begin{equation} \label{secondhalf} \begin{array}{l} \dot p_1(t) = p_2(t)\ ,\\[10pt] \dot p_2(t) = - p_1(t)\ ,\end{array} \ \qquad \begin{array}{l} p_1(T) = - \frac{\partial C}{\partial x^1}\big|_{x^1(T)} = 1\ ,
\\[10pt] p_2(T) = - \frac{\partial C}{\partial x^2}\big|_{x^1(T)}  = 0\ .\end{array}
\end{equation}
The  \eqref{secondhalf}  and  the  \eqref{firsthalf}  are uncoupled. This  allows to determine explicitly the components $p_i(t)$ for each curve $\gamma(t) = (t, x^1(t), x^2(t), p_1(t), p_2(t))$.
They are
$$p_1(t) = \cos(T - t) \ ,\qquad p_2(T) = \sin(T - t)\ .$$
Due to this, for each given  $\gamma_o(t) = (t, x^1_o(t), x^2_o(t), p_{o1}(t), p_{o2}(t))$  satisfying   the above  constraints, the associated Pontryagin function $\mathscr{H}: K \to \mathbb{R}$ takes the form
$$\mathscr{H}(\o) = \cos(T-t) x^2_o(t) + \sin(T-t) (- x^1_o(t) + \o)\ .$$
Then, the usual  PMP implies that an  optimal control curve $u_o(t)$  must  satisfy  the following conditions:
\begin{equation} \begin{array}{ll} u_o(t) = +1  & \text{when}\ \sin(T-t) > 0\ ,\\[15pt]
u_o(t) = - 1 & \text{when}\ \sin(T - t) < 0 \ .
\end{array}
\label{oc}
\end{equation}

 The meaning of this result  is the following: {\it for any  initial velocity $ v \in [-v_{\text{max}}, v_{\text{max}}]$,  if $u(t)$ is different from \eqref{oc},  there exists at least one needle modification $\widetilde u(t)$ of $u(t)$,  such
 that the controlled curve  determined by  the pair  $\widetilde U = \big(\widetilde u(t), \sigma = (x(0) = 0, \dot x(0) = v)\big)$ has a   cost which is smaller
than the cost of the curve determined by  $U = \big(u(t), \sigma = (x(0) = 0, \dot x(0) = v)\big)$}.  Thus,  if  an optimal control $(u_o(t), \sigma)$ exists,  it  must have $u_o(t)$ as in \eqref{oc}. After establishing this, by varying only the initial datum $\sigma$ (i.e. the initial velocity $v_o$), it is quite straightforward to find that an  optimal control exists and it is  $U = \big(u_o(t), \sigma = (x(0) = 0, \dot x(0) = v_{\text{max}})\big)$.
  \par
 \smallskip
Let us now see how our results offer an alternative way to solve the same  problem.
 Let us consider just one auxiliary variable, say $p$, and the controlled  Lagrangian on $J^5(\mathscr{Q}|\mathbb{R}) \times K$,  $\mathscr{Q} = \mathbb{R}$,  $K = [-1,1]$, of actual order $r= 2$:
\begin{equation} L(t, x, \dot x, \ddot x, p,  u) \=  p (\ddot x + x - u)\ .\end{equation}
The corresponding controlled Euler-Lagrange equations  are  only  two and are
\begin{equation}
\ddot x + x - u = 0\ ,\qquad \ddot p + p  = 0\ .\end{equation}
Our  problem can be now recognised as the generalised Mayer problem determined by the triple $(\mathscr{K}, L, C)$, where $C: J^5(\mathscr{Q}|\mathbb{R}) \to \mathbb{R}$ is the smooth function $C(j^5_t(x)) = - x(t)$ and $\mathscr{K}$ is the set of
pairs $U = (u(t), \sigma)$, given by a  control curve taking values in $K = [-1, 1] $ and  initial conditions  $\sigma = j^5_{t = 0}(\gamma) =  (x(0), \dot x(0), \ddot x(0), \ldots, p(0), \dot p(0), \ddot p(0), \ldots)$  subjected to no restrictions  except for the value $x(0) = 0$.
\par
\smallskip
In this setting, given a controlled curve $\gamma_o = \gamma^{(U_o)}$,    the condition \eqref{additional},  which characterises the needle variations  $\mathcal{N}\hskip-2pt\text{\it eedle}^{(\t, \o, \varepsilon_o, \Sigma)} (\gamma_o)= \{ F^{(\t, \o, \varepsilon, \Sigma)}, 0 < \varepsilon \leq \varepsilon_o\}$ in the class ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma_o)$ is very simple and we give it in the next formula \eqref{86},  where we denote by $(x(t,s), p(t,s), \dot x(t, s), \dot p(t,s), \ldots)$ the components of  the jets homotopy $F^{(\t, \o, \varepsilon, \Sigma)(5)}(t,s)$,  associated with  the curve  $U(s) \in \mathscr{K}$
$$U(s) = \big(u(t,s), (x(0, s) = 0, p(0, s), \dot x(0, s) = 0, \dot p(0, s) , \ldots)\big)  \ . $$
It is
\begin{equation}\label{86} \int_0^1 \bigg( \frac{\partial x}{\partial s}\bigg|_{(t = T, s)}  - p(T, s) \frac{\partial \dot x}{\partial s} \bigg|_{(t = T, s)} + \dot p(T, s) \frac{\partial x}{\partial s} \bigg|_{(t = T, s)} \bigg) ds \geq 0\ .\end{equation}
Since we are free to choose any initial condition for the variable $p$, we may  consider  a family $\Sigma = \Sigma(\varepsilon, s)$ of initial data  so that  the corresponding functions $p(t, s)$ satisfies the terminal conditions
\begin{equation} \label{questionable-2bis} p(T, s) = 0\ ,\qquad \dot p(T, s) = -1 .\end{equation}
For such $\Sigma$, the condition \eqref{86} is automatically satisfied. This means that, for any choice of $\t$, $\o$ and $\varepsilon_o$, the class ${\cG\!\text{\it ood}\cN\!\text{\it eedles}}(\gamma_o)$ is not empty and contains all needle variations satisfying \eqref{questionable-2bis}. Note also that \eqref{questionable-2bis} together with the differential constraint $\ddot p + p = 0$ completely determines the function $t \mapsto p(t,s)$  which is
\begin{equation} \label{questionable-ter} p(t, s) = \sin(T - t)\qquad \text{for any}\ s\ .\end{equation}
On the other hand,  given a controlled curve $\gamma_o(t) = (t,  x_o(t), p_o(t))$  with $p_o(t)$ as in  \eqref{questionable-ter},  the corresponding function $\mathscr{P}_{j^2(\gamma_o)}: K \to \mathbb{R}$ is
\begin{equation} \label{eqsol} \mathscr{P}_{j^2(\gamma_o)}(\o) =  - \sin(T-t) \left(\ddot x + x - \o\right)\ .\end{equation}
From  the above observations and our Generalised Pontryagin Maximum Principle  (Corollary \ref{Corollone}), it follows that a curve $\gamma_o(t)$, determined by a control curve $u_o(t)$  is a solution to our Mayer problem only if it is as in \eqref{oc},
 as prescribed by the classical approach a la Pontryagin. As before, this  condition completely determines a (non-smooth) optimal control curve $u_o(t)$ and, by the same argument of before,  it follows that there is an optimal control and it is the pair $(u_o(t), \sigma_o)$ with $\sigma_o \= (x(0) = 0, \dot x(0) = v_{\text{max}})$.
   \begin{rem} \label{remark81} The control curve  $u_o(t)$ determined via \eqref{eqsol}  is clearly non smooth and hence not fitting the   simplifying  assumptions  adopted throughout this paper.  However, using the results of this paper and  standard approximation techniques, one can  rigorously prove that   the  above (discontinuous)
 curve $u_o(t)$ is the only measurable control curve,  for which there exists  no needle modification corresponding to a  curve with   a strictly smaller terminal cost.  A detailed proof of this claim is given  in \cite{CGS1}.
 \end{rem}
  We stress the fact that this second (new) approach to the addressed Mayer  problem  involves {\it  just one} auxiliary variable, instead of the three used in the classical approach. In fact, the same circle of
ideas can easily find   solutions to the large class of similar Mayer problems with  one control variable $u \in [-1,1]$,  one  dependent variable $x(t)$, $t \in [0,T]$,  constrained by a differential problem of order $m$ of the form
$$\sum_{\ell = 0}^m a_\ell \frac{d^\ell x}{d t^\ell} = u\ ,\qquad x(0) = \frac{d x}{dt}\bigg|_{t = 0} = \ldots =  \frac{d^{m-1} x}{dt^{m-1}}\bigg|_{t = 0} = 0$$
with constant coefficients $a_\ell$,  and the cost function $C = - x$. By considering just one auxiliary variable $p$ and  the controlled Lagrangian
$L (t, x_{(\ell)}, p) \= p \big(\sum_{\ell = 0}^m a_\ell x_{(\ell)}  - u\big)$,
one can find  the optimal control $u_o(t)$, $t \in [0,T]$,  of such a  Mayer problem with the same arguments of before. It is
$u_o(t) = \text{sign}(p_o(t))$,
where   $p_o(t)$  is the unique solution to the  differential problem
\begin{multline}\sum_{\ell = 0}^m (-1)^\ell a_\ell \frac{d^\ell p}{d t^\ell} = 0\qquad \text{in}\ \ \ [0,T]\ \\
\text{with terminal conditions} \  p(T) = \frac{d p}{dt}\bigg|_{t = T} = \ldots =  \frac{d^{N-2} p}{dt^{N-2}}\bigg|_{t = T} = 0\ \ , \quad \frac{d^{N-1} p}{dt^{N-1}}\bigg|_{t = T} = -1\ .
\end{multline}
Of course, the same solution can be easily found also using the classical approach and the classical PMP,  provided that, instead of the above single auxiliary variable $p$, one introduces and handles $2m-1$ auxiliary variables: In fact, one needs $m-1$ auxiliary variables  to reduce the  constraint to a system of  first order   equations, and  the $m$ Pontryagin auxiliary variables $p_j$.
\par
\medskip
We conclude showing that there exists also  a third different approach to  the  above  linearised pendulum  problem.  In fact, with no need of  auxiliary variables, this problem
can be immediately seen to be  a generalised Mayer problem  (in the sense of this paper) with differential constraints given  by the  controlled  Lagrangian
\begin{equation} L: J^3(\mathbb{R}|\mathbb{R})\times K \to \mathbb{R}\ ,\qquad L(t, x, \dot x, u) \= \frac{1}{2} \dot x^2 - \frac{1}{2} x^2 + u x\ ,\qquad K = [-1,1]\ .\end{equation}
We now  restrict to the cases in which  $T \neq \pi k$ for any  $k \in \mathbb{N}$. Under this assumption,  a direct inspection of the general solutions of the differential constraints
 shows that, for a given control  map $u:[0, T] \to K$, the  map
\begin{equation} \label{surjective} \varphi: \mathbb{R} \to \mathbb{R}\ ,\qquad \varphi(v) \= x^{(U)}(T)\ ,\qquad U = \big(u(t), \sigma = (x(0) = 0, \dot x(0) = v)\big)\ ,\end{equation}
is surjective (here, as usual, we denote by  $x^{(U)}(t)$ the unique solution of the differential constraints with initial datum $\sigma$ and control curve $u(t)$).
Due to the particularly simple form of the cost function, this information immediately leads to the conclusion   that {\it if there exists an optimal control $U_o = (u_o(t), \sigma_o)$, then the  initial velocity must take an  extremal value}. However,  there is also
an enlightening (but  longer) argument based on the generalised PMP  yielding to the same conclusion. Using the surjectivity of the map
\eqref{surjective},  one can  see that for   $v \neq  \pm v_{\text{max}}$ and $u(t)$ arbitrary,  there exist {\it good} needle variation for any pair $(\t, \o) \in  (0, T) \times K$, provided that $\o$ is  sufficiently close to $u(\t)$.
From this and the explicit expression of the map $\mathscr{P}_{j^5_\t(\gamma^{(U)})}: K \to \mathbb{R}$, it follows that  if $v \in (0, v_{\text{max}})$ and  if  $u(\t) \neq - \text{sign}(x(\t))$ at some $\t \in (0, T)$, then  there is  {\it an appropriate needle modification  and  an appropriate change of the  initial  velocity}, which gives  a curve with a strictly lower  terminal cost. By studying the terminal costs  determined by the control curves of the form $u(t) = -\text{sign}(x(t))$, one concludes (once again) that the desired optimal control $U_o = (u_o(t), \sigma_o)$ must have initial velocity $v_o = \pm  v_{\text{max}}$.\par
\smallskip
It now remains to  look for an optimal control $U_o$ in the restricted family of  pairs $U = (u(t), \sigma_o)$ in which  the  initial value is completely fixed $\sigma_o = (x(0) = 0, \dot x(0) = \pm v_{\text{max}})$. In this subclass,
$\dot x(0) = v_{\text{max}}$ is  no longer modifiable and there is no way of constructing {\it good} needle variations.  Our Corollary \ref{Corollone}  gives no exploitable condition in this situation.  Thus, the   easiest way to conclude  is now to go back to one of the previous approaches and  determine explicitly  the   control curve $u_o(t)$ using  auxiliary variables.  Nonetheless, with a not  so  big effort (the    details are omitted just for not  weighing  the reader down), all terms     in \eqref{712}  can be made fully explicit for any  needle variation and,   from Theorem \ref{POMPone},   the  previously determined optimal control is once again derived.
\par
\smallskip
 \subsection{Concluding remarks}\hfill\par
In Sect.\ \ref{sect8.1} we showed how a very simple case of a control problem with a differential constraint of  higher order can be   studied
with   no need of  reducing  it to an equivalent  system of   first order constraints. The same approach can be adopted  in much  less trivial situations.
Just to fix the ideas, consider a  control problem determined by a  differential constraint  of the third order
\begin{equation} \label{esempio-0} \dddot x = f(t, x, \dot x, \ddot x, u) \end{equation}
with  $u  = (u^a)$ varying in a compact set $K \subset \mathbb{R}^m$ and terminal cost function $C = C(x(T), \dot x(T), \ddot x(T))$. By introducing  a dual variable $p$, the constraint \eqref{esempio-0} can be identified  as one of the Euler-Lagrange equations of
 the controlled Lagrangian
\begin{equation} \label{esempio-1} L(t, x, \dot x, \ddot x, p, u) \= p\big( \dddot x - f(t, x, \dot x, \ddot x, u)\big)\ . \end{equation}
Indeed,   the Euler-Lagrange equation corresponding to $p$ is precisely \eqref{esempio-0}, while  the Euler-Lagrange equation  corresponding to  $x$ is
\begin{multline}  \label{esempio-2} \frac{\partial L}{\partial x} - \frac{d}{dt} \left(\frac{\partial L}{\partial \dot x}\right) +  \frac{d^2}{dt^2} \left(\frac{\partial L}{\partial \ddot x}\right)
-  \frac{d^3}{dt^3} \left(\frac{\partial L}{\partial \dddot x}\right) =\\
=  p \left(- \frac{\partial f}{\partial x}  +  \frac{d}{dt} \left( \frac{\partial f}{\partial \dot x}\right) -\frac{d^2}{dt^2} \left( \frac{\partial f}{\partial \ddot x}\right)\right)+ \dot p\left( \frac{\partial f}{\partial \dot x} - 2\frac{d}{dt} \left( \frac{\partial f}{\partial \ddot x}\right) \right)
- \ddot p \frac{\partial f}{\partial \ddot x}
- \dddot p = 0\ .
\end{multline}
Given a control curve $u_o(t)$ and an initial condition $\sigma_o$, there is a uniquely associated controlled  curve $\gamma(t) =  (t, x(t), p(t))$, in which  $x(t)$ satisfies \eqref{esempio-0} and the  initial condition $  j^2_{t = 0}(x) = \sigma_o$, and   $p(t)$ satisfies \eqref{esempio-2} and the  terminal conditions
\begin{equation}
\begin{split}
 & p(T) =\left. \frac{\partial C}{\partial \ddot x}\right|_{
j^{2}_{T}(x)}\ , \hskip 2 cm
 \dot p(T)=  \left.-\frac{\partial C}{\partial \dot x}\right|_{
j^{2}_{T}(x)}
- \left. p(T)\frac{\partial f}{\partial \ddot x} \right|_{
(j^{2}_{T}(x), u(T))}\ ,\\
 \label{esempio-3} & \ddot p(T) =  \left.\frac{\partial C}{\partial x}\right|_{j^2_T(x)}  \hskip -0.4 cm +  \left. p(T)\frac{\partial f}{\partial \dot x} \right|_{
(j^{2}_{T}(x), u(T))}  \hskip -0.5 cm -   \left.  \dot p(T) \frac{\partial f}{\partial \ddot x} \right|_{
(j^{2}_{T}(x), u(T))}  \hskip -0.5 cm -   \left.p(T)  \frac{d}{dt}\left(\frac{\partial f}{\partial \ddot x} \right)\right|_{
(j^{2}_{T}(x), u(T))}\hskip - 0.4 cm .
\end{split}
\end{equation}
These conditions are the higher order analogues of the terminal condition \eqref{questionable-2} used in the classical case of first order differential constraints. In fact, they are specially designed  to  make the left hand side of \eqref{additional} equal to  $0$ for any generalised needle variation that consists of homotopies  of  curves  satisfying the above  two-point boundary problem (see \cite{CGS1}). This means that any such generalised needle variation is in   ${\cG\!\text{\it ood}\cN\!\text{\it eedles}} (\gamma)$ and that the generalised PMP given by   Corollary \ref{Corollone} holds at all points of  a solution  $\gamma(t) = (t, x(t), p(t))$  of the above problem, in perfect analogy with  the  case of differential  constraints of  first order.   \par
We stress the fact  that,   for each control curve $u(t)$ and  associated solution $x(t)$ to  \eqref{esempio-1}, the corresponding curve   $p(t)$ is  completely determined by the terminal conditions \eqref{esempio-3} and  the {\it linear} equation \eqref{esempio-2} with time-dependent coefficients. Such  linearity of the equation  for  $p$ is  a general and quite useful fact. Indeed, it  holds {\it  for any control problem determined by an  $r$-th order  differential  system of  $n$ equations
 the form }
 \begin{equation} \label{esempio-4} \frac{d^r x^i}{d t^r} = f^i\left(t,x^j(t), \ldots, \frac{d^{r-1} x^j}{d t^{r-1}},u^a(t)\right)\ , \end{equation}
provided that  such constraints are coupled with all other  Euler-Lagrange equations of the controlled Lagrangian
 \begin{equation} \label{esempio-5} L\left(t,x^j(t), \ldots, \frac{d^{r-1} x^j}{d t^{r-1}}, p_j, u^a\right) \=  p_i\left( x^i_{(r)}  - f^i\left(t,x^j(t), \ldots, \frac{d^{r-1} x^j}{d t^{r-1}}, u^a\right)\right)\ . \end{equation}
On the other hand, as  we mentioned in Remark \ref{remark81},  standard approximation techniques yield to versions of the above generalised PMP
that hold under much weaker regularity assumptions  (\cite{CGS1}).   We   expect that   the above described  two-point boundary problems together with   such  extended versions of the PMP
 can be    helpful also for the  direct computations of the optimal controls  under higher order constraints.  Investigations on  this aspect are left to future work.

redpajama_set_name: RedPajamaArXiv