This question is very closely related to another one I just asked. The general question is to what extent there is a theory of differential equations for smooth correspondences (between a smooth manifold and $\mathbb R$, say). But I'm wondering about a specific well-studied case.
Background
Let $N$ be a compact smooth manifold with tangent bundle $TN$ and cotangent bundle $T^\*N$. In the usual way, pick a Lagrangian $L: TN \to \mathbb R$, and suppose that it is nondegenerate in the sense that $\frac{\partial L}{\partial v}$, thought of as a map $TN \to T^\*N$, is a fiber bundle isomorphism, where $v$ is a (vector of) fiber coordinate(s). Then, in the usual way, we can define a Hamiltonian $H: T^\*N \to \mathbb R$ by $H = pv - L$, where $pv$ is the canonical pairing between a cotangent vector and a tangent vector, and I use $\frac{\partial L}{\partial v}$ to identify $TN$ with $T^\*N$. In the usual way, define on $N$ the second-order ordinary differential equation $\frac{d}{dt}\bigl[ \frac{\partial L}{\partial v}\bigr] = \frac{\partial L}{\partial q}$ and $v = \frac{dq}{dt}$, or equivalently $\frac{dq}{dt} = \frac{\partial H}{\partial p}$ and $\frac{dp}{dt} = -\frac{\partial H}{\partial q}$. (These are all written in local coordinates, where $q$ is a local coordinate on $N$ and $v = dq$ and $p = \frac{\partial}{\partial q}$ are the corresponding coordinates on $TN$ and $T^\*N$. But the ODE is coordinate-invariant.)
Since $N$ is compact and $L$ is nondegenerate, the ODE has global solutions, and each solution is determined by its initial conditions, which are given equivalently by a point in $TN$ and a point in $T^\*N$. In the usual way, define an action map $S: TN \times \mathbb R \to \mathbb R$ by $S(v,q,t) = \int_0^t L(\phi(v,q,s))ds$, where $\phi: TN \times \mathbb R \to TN$ is the "flow" map for the ODE.
Let $\pi$ be the projection $TN \to N$, so that $\pi(v,q) = q$, and using the flow map $\phi$, define a map $TN \times \mathbb R$ to $N \times N \times \mathbb R$ via $(v,q,t) \mapsto (q,\pi(\phi(v,q,t)),t)$. Generically, this map is a local isomorphism, in the following sense: for generic $(v,q,t)$ (say, a dense open subset of $TN\times \mathbb R$ when $\frac{\partial^2 L}{\partial v^2}$ is positive-definite), there is a small open neighborhood such that the map to $N\times N \times \mathbb R$ takes the neighborhood diffeomorphically to its image. Pick one such small neighborhood, and use it to push forward the action function $S$. Abusing notation, I will call this pushforward $S$. Then $S(q_1,q_2,t)$ satisfies the Hamilton-Jacobi equation: $\frac{\partial S}{\partial t} = - H(\frac{\partial S}{\partial q_2},q_2) = - H(-\frac{\partial S}{\partial q_1},q_1)$.
My question
Above, I defined a local function $S: U \to \mathbb R$, where $U$ is a small neighborhood of $N\times N\times \mathbb R$, and it satisfied a partial differential equation. But really I should have talked about the correspondence
$$ N\times N\times \mathbb R \overset{(\pi, \pi\circ \phi, t)}{\longleftarrow} TN \times \mathbb R \overset{S}{\longrightarrow} \mathbb R $$
Is there language with which one can say that this correspondence satisfies the Hamilton-Jacobi equations? For example, what happens near non-generic (sometimes called "focal") points?
Bonus questions
(If $N$ is not compact, then the flow map does not have global-time solutions. But I can still do everything; I just have to replace the space $TN \times \mathbb R$ by an open subspace. In fact, $\phi$ still defines on $TN \times \mathbb R$ the structure of an action groupoid, and both $(\pi, \pi\circ \phi, t)$ and $S$ are groupoid homomorphisms, so that the above correspondence is a span of groupoids. Does this enter the discussion in any interesting way?)
If $\frac{\partial L}{\partial v}$ does not define a bundle isomorphism, then the Hamiltonian is not well-defined as a function $H: T^\*N\to \mathbb R$. But it does make sense as a correspondence, by:
$$ T^\*N \overset{ \frac{\partial L}{\partial v}}{\longleftarrow} TN \overset{ v\frac{\partial L}{\partial v} - L}{\longrightarrow} \mathbb R$$
Imposing the condition that $\frac{\partial^2 L}{\partial v^2}(v,q)$ is an invertible matrix for each $(v,q)$, so that the ODE is still nondegenerate second-order, does the language of correspondences allow me to talk about the Hamilton-Jacobi equations when the Hamiltonian is not a function but the above correspondence?
Alternately, I could start with a function $H: T^\*N \to \mathbb R$, and construct a correspondence $L$, etc. The Legendre transform should really be thought of as a transformation of correspondences, not of functions.
Finally, when $\frac{\partial^2 L}{\partial v^2}$ is sometimes degenerate, then the ODE degenerates, sometimes in complicated ways. Can this be accommodated by making the flow $\phi$ into a correspondence rather than a function?