of Theorem \[main\] {#section-proof}
=========================

The proof of Theorem \[main\] falls naturally into two parts. In the first part we deal with the continuity of families of the type , where we actually consider a slightly more general setting. In the second part we show the spectral flow formula in Theorem \[main\].

Continuity
----------

To simplify notation, we set $E=L^2(I,\mathbb{R}^{2n})$ and $H=H^1(I,\mathbb{R}^{2n})$. The aim of this step is to prove the following proposition, which we will later apply in the cases $X=I$ and $X=I\times I$.

\[prop-continuity\] Let $X$ be a metric space and $\gamma_1,\gamma_2:X\rightarrow\Lambda(n)$ two families of Lagrangian subspaces in $\mathbb{R}^{2n}$. Then

$$\mathcal{A}:X\rightarrow \mathcal{CF}^\textup{sa}(E),\quad (\mathcal{A}_\lambda u)(t)=Ju'(t),$$ where $$\mathcal{D}(\mathcal{A}_\lambda)=\{u\in H: u(0)\in\gamma_1(\lambda), u(1)\in\gamma_2(\lambda)\},$$ is continuous with respect to the gap-metric on $\mathcal{CF}^\textup{sa}(E)$.

We want to use and consider

$$\delta(\operatorname{graph}(\mathcal{A}_\lambda),\operatorname{graph}(\mathcal{A}_{\lambda_0})).$$ Note at first that for $u\in\mathcal{D}(\mathcal{A}_\lambda)$ and $v\in\mathcal{D}(\mathcal{A}_{\lambda_0})$

$$\begin{aligned}
\label{gapcontI}
\begin{split}
\|(u,\mathcal{A}_\lambda u)-(v,\mathcal{A}_{\lambda_0}v)\|_{E\oplus E}&=\|(u-v,J(u'-v'))\|_{E\oplus E}\\
&\leq \left(\|u-v\|^2_{E}+\|J\|\|u'-v'\|^2_{E}\right)^\frac{1}{2}\\
&=\|u-v\|_{H},
\end{split}\end{aligned}$$

where we have used that $\|J\|=1$. Let us recall that the topology of $G_n(\mathbb{R}^{2n})$ is induced by the metric $d(L,M)=\|P_L-P_M\|$, where $P_L, P_M\in M(2n,\mathbb{R})$ are the orthogonal projections onto $L$ and $M$, respectively. Hence, by the continuity of $\gamma_1$ and $\gamma_2$, there are two families of orthogonal projections $\hat{P},\tilde{P}:X\rightarrow M(2n,\mathbb{R})$ such that

$$\operatorname{im}(\hat{P}_\lambda)=\gamma_1(\lambda),\quad \operatorname{im}(\tilde{P}_\lambda)=\gamma_2(\lambda),\quad\lambda\in 