By generic freeness (\cite[\href{https://stacks.math.columbia.edu/tag/051S}{Tag 051S}]{stacks-project}), there exists nonzero $b\in \B$ such that $\B[\G]_b$ is a free $\B_b$-module, say of rank $\kappa$.
Then, $\B[\G]\otimes_\B k(\p)$ is a $k(\p)$-vector space of dimension $\kappa$ for every $\p\in D(b)$. The assumption that $\G_\xi$ is nontrivial means that $\B[\G]\otimes_\B k(\B)$ is not reduced to $k(\B)$. So $\kappa > 1$ and $\B[\G]\otimes_\B k(\p)$ is not reduced to $k(\p)$ for any $\p\in D(b)$, i.e., $\G_x$ is nontrivial for $x\in D(b)$. Thus $\U=\U'\cap D(b)$ has the required property.
\end{proof}

\begin{lemma} \label{lemma: nonsolvable spreads out}
If $\G_\xi$ is not solvable, there exists a nonempty open subset $\U$ of $\X$ such that $\G_x$ is not solvable for every $x\in \U$.
\end{lemma}
\begin{proof}
Since $\G_{\xi}$ is not solvable, there exists an $n\geq 1$ such that $H=\mathcal{D}^n(\G_\xi)$ is nontrivial and perfect. The closed subgroup $H$ of $\G_{\xi}$ spreads out to a closed subgroup $\H$ over a nonempty open subset of $\X$. In detail, there exists a nonempty affine open $\U'$ of $\X$ and a closed subgroup scheme $\mathcal{H}$ of $\G_{\U'}=\G\times_\X \U'$ such that $\mathcal{H}_\xi=H$. This follows, for example, from \cite[Theorems 8.8.2 and 8.10.5]{Grothendieck:EGAIV3}.

Lemma \ref{lemma: perfect spreads out} applied to $\H$, yields a nonempty open subset $\U$ of $\U'$ such that $\mathcal{H}_x$ is nontrivial and perfect for every $x\in \U$. Thus, for every $x\in \U$, the algebraic group $\G_x$ contains the closed nontrivial perfect subgroup $\mathcal{H}_x$ and can therefore not be solvable.
\end{proof}

We are now prepared to prove the main result of this subsection.

\begin{proof}[Proof of Proposition \ref{prop: not solvable spreads out}]
Because solvability (\cite[Cor. 6.31]{Milne:AlgebraicGroupsTheTheoryOfGroupSchemesOfFiniteTypeOverAField}) and the formation of the identity component (\cite[Prop. 1.34]{Milne:AlgebraicGroupsTheTheoryOfGroupSchemesOfFiniteTypeOverAField}) is compatible with base change, we see that $(\G_\xi)^\circ$ is not solvable. As in the proof of Lemma \ref{lemma: nonsolvable spreads out}, the closed subgroup $H=(\G_\xi)^\circ$ of $\G_\xi$ spreads out to a closed subgroup scheme over a nonempty open subset of $\X$, i.e., there exists a nonempty affine open subset $\U_1$ of $\X$ and a closed subgroup $\H$ of $\G_{\U_1}=\G\times_\X\U_1$ such that $\H_\xi=(\G_\xi)^\circ$. Because $\H_\xi$ is (geometrically) connected, there exists a nonempty open subset $\U_2$ of $\U_1$ such that $\H_x$ is (geometrically) connected for every $x\in \U_2$ (\cite[Theorem 9.7.7]{Grothendieck:EGAIV3}). Moreover, there exists a nonempty open subset $\U_3$ of $\U_1$ such that $\dim(\G_x)=\dim(\G_\xi)$ and $\dim(\H_x)=\dim(H_\xi)(=\dim(\G_\xi))$ for all $x\in\U_3$ (\cite[\href{https://stacks.math.columbia.edu/tag/05F7}{Tag~05F7}]{stacks-project}). In summary, this shows that we can find a nonempty open affine subset $\U'$ of $\U_1$ such that $\H_x=(\G_x)^\circ$ for all $x\in \U'$.

Applying Lemma \ref{lemma: nonsolvable spreads out} to the affine group scheme $\H_{\U'}=\H\times_{\U_1}\U'$ over $\U'$ yields a nonempty open susbset $\U''$ of $\U'$ such that $\H_x=(\G_x)^\circ$ is not solvable for all $x\in \U''$. In particular, $(\G_c)^\circ$ is not solvable for every $c\in \U=\U''\cap \X(k)$.
\end{proof}

%Let	$\G$ be an affine group scheme of finite type over $\X$. If $(\G_\xi)^\circ$ is not solvable, then there exists a Zariski open subset $\U$ of $\X$ such that $(\G_x)^\circ$ is not solvable for every $x\in \U$.
%	??

\subsubsection{Exceptional parameter values for solving in a family of linear differential equations}
\label{subsubsec:Exceptional parameter values for solving }

Throughout Subsection \ref{subsubsec:Exceptional parameter values for solving } we make the following assumptions:

\begin{itemize}
\item $k\subseteq K$ is an inclusion of algebraically closed fields of characteristic zero;
\item $\de(y)=Ay$ is a linear differential equation over $K(x)$, i.e., $A\in K(x)^{n\times n}$;
\item  $\B\subseteq K$ is a finitely generated $k$-algebra and $f\in\B[x]$ is a monic polynomial such that $A\in\B[x]_f^{n\times n}$;
\item $\X=\spec(\B)$;
\item for $c\in\X(k)$ we denote with $A^c\in k(x)^{n\times n}$ the matrix obtained from $A$ by applying $c\colon \B\to k$ to the coefficients of the entries of $A$.

\end{itemize}
%Consider an inclusion $k\subseteq K$ of algebraically closed fields of characteristic zero and a differential equation $\de(y)=Ay$ with $A\in K(x)^{n\times n}$. Let $\B\subseteq K$ be a finitely generated $k$-algebra and $f\in\B[x]$ a monic polynomial such that $A\in\B[x]_f^{n\times n}$.

We first treat the case of solving in Liouvillian extensions. Recall that a subset of $\X(k)$ is called ad$\times$Jac-closed (or ad-closed) if its complement is ad$\times$Jac-open (or ad-open).

\begin{cor} \label{cor: Liouvillian solutions preserved}
Assume that the differential equation $\de(y)=A y$ (over $K(x)$) does not have a basis of solutions consisting of Liouvillian functions, then the set of all $c\in\X(k)$ such that the differential equation $\de(y)=A^cy$ (over $k(x)$) has a basis of solutions consisting of Liouvillian functions, is contained in an ad$\times$Jac-closed subset of $\X(k)$.
\end{cor}
\begin{proof}
Let $R/K(x)$ be a Picard-Vessiot ring for $\de(y)=Ay$. By Lemma \ref{lemma: spread out PVring}, there exists
\begin{itemize}
\item a finitely generated $k$-subalgebra $\B'$ of $K$ containing $\B$ and contained in the algebraic closure of the field of fractions of $\B$;
\item a monic polynomial $f'\in\B'[x]$ such that $f$ divides $f'$ in $\B'[x]$;
\item an affine group scheme $\G'$ of finite type over $\B'$;
\item a differential $\G'$-torsor $\R'/\B'[x]_{f'}$ for $\de(y)=Ay$
\end{itemize}
such that
$\R'$ is a flat $\B'[x]_{f'}$-module, $\R'\otimes_{\B'[x]_{f'}}K'(x)$ is $\de$-simple, where $K'\subseteq K$ is the algebraic closure of the field of fractions of $\B'$ and $\R'\otimes_{\B'[x]_{f'}}K(x)\simeq R$.

Note that $\R'\otimes_{\B'[x]_{f'}}K'(x)$ is Picard-Vessiot ring over $K'(x)$ with differential Galois group $\G'_{K'}$ (Lemma \ref{lemma: generic}). So it follows from Lemma \ref{lemma: base change of PV ring over constants} that $\R'\otimes_{\B'[x]_{f'}}K(x)\simeq R$ is a Picard-Vessiot ring over $K(x)$ with differential Galois group $\G'_K$. Because $\de(y)=Ay$ (over $K(x)$) does not have a basis consisting of Liouvillian functions, we know that $(\G'_K)^\circ$ is not solvable (\cite[Theorem 1.43]{SingerPut:differential}). As the formation of the identity component (\cite[Prop. 1.34]{Milne:AlgebraicGroupsTheTheoryOfGroupSchemesOfFiniteTypeOverAField}) and  solvability (\cite[Cor. 6.31]{Milne:AlgebraicGroupsTheTheoryOfGroupSchemesOfFiniteTypeOverAField}) is compatible with base change, this implies that $\G'_{K'}$ is not solvable. By Proposition \ref{prop: not solvable spreads out} there exists a Zariski open subset $\U'_1$ of $\X'(k)$ such that $(\G'_{c'})^\circ$ is not solvable for every $c'\in\U'$.

Set $\X'=\spec(\B')$. Theorem \ref{theo: main specialization} applied to the differential torsor $\R'/\B'[x]_{f'}$ for $\de(y)=Ay$ yields an ad$\times$Jac-open subset $\U'_2$ of $\X'(k)$ such that $R'^{c'}=\R'\otimes_{\B'[x]_{f'}}k(x)$ is Picard-Vessiot for all $c'\in \U'_2$. By Lemma \ref{lemma: lift opens}, there exists an ad$\times$Jac-open subset $\U$ of $\X(k)$ such that $\U$ is contained in the image $\U_1'\cap\U_2'$ under $\X'(k)\to \X(k)$. For any $c\in \U$, there thus exists a $c'\in\U'_1\cap\U_2'$ mapping to $c$. We then have $A^c=A^{c'}$ and $R'^{c'}/k(x)$ is a Picard-Vessiot ring for $\de(y)=A^cy$ with differential Galois group $G'^{c'}=\G'_{c'}$. As $(\G'_{c'})^\circ$ is not solvable, we see that $\de(y)=A^cy$ does not have a basis of solutions consisting of Liouvillian functions for every $c\in \U$. Thus the set of all $c\in\X(k)$ such that $\de(y)=A^cy$ has a basis of solutions consisting of Liouvillian functions, is contained in the complement of $\U$.
\end{proof}

\begin{rem}
If, in the context of Corollary \ref{cor: Liouvillian solutions preserved}, the differential Galois group of $\de(y)=Ay$ (over $K(x)$) is connected, we can make do with an ad-closed subset of $\X(k)$.
\end{rem}
\begin{proof}
As in Remark \ref{rem: no Jac for connected in relations} we see that the differential Galois group $G'^\gen$ of $\R'^\gen$ is connected and so $\U_2'$ can be chosen to be ad-open by Corollary \ref{cor: no Jac if connected}.
\end{proof}

We next treat the case of solving in algebraic extensions.

\begin{cor} \label{cor: algebraic solutions preserved}
Assume that the differential equation $\de(y)=A y$ (over $K(x)$) does not have a basis of solutions consisting of algebraic functions, then the set of all $c\in\X(k)$ such that the differential equation $\de(y)=A^cy$ (over $k(x)$) has a basis consisting of algebraic functions, is contained in an ad$\times$Jac-closed subset of $\X(k)$.
\end{cor}
\begin{proof}
This could be deduced directly from Corollary \ref{cor: algebraic relations preserved}. Alternatively, noting that a differential equation has a basis of algebraic solutions if and only if its differential Galois group is finite, this can be proved exactly like Corollary \ref{cor: Liouvillian solutions preserved} but replacing Proposition~\ref{prop: not solvable spreads out} with the following statement: With the notation of Subsection \ref{subsubsec: Families of non-solvable algebraic groups}, if $\G_{\overline{\xi}}$ is finite, then there exists a nonempty Zariski open subset $\U$ of $\X(k)$ such that $\G_c$ is finite for every $c\in \U$.
\end{proof}

\begin{rem}
Again, if in the context of Corollary \ref{cor: algebraic solutions preserved}, the differential Galois group of $\de(y)=Ay$ (over $K(x)$) is connected, then we can make do with an ad-closed subset of $\X(k)$.
\end{rem}

\section{Proof of Matzat's conjecture}
\label{sec: Proof of Matzat's conjecture}

In this section we show that every differential embedding problem of finite type over $(k(x),\frac{d}{dx})$ has a solution (Theorem \ref{theo: solve embedding problems}) and deduce Matzat's conjecture from this.
The idea for the proof is to first solve the differential embedding problem over a sufficiently large field of constants $k'\supseteq k$ and then to go back down to $k$ using Theorem~\ref{theo: main specialization}.

\medskip

Throughout Section \ref{sec: Proof of Matzat's conjecture} we assume that $k$ is an algebraically closed field of characteristic zero. Let us recall some background on differential embedding problems. Let $F$ be a differential field with $F^\de=k$. If $R\subseteq S$ is an inclusion of Picard-Vessiot rings over $F$, then there is a restriction map $G(S/F)\twoheadrightarrow G(R/F)$ on the differential Galois groups which is a quotient map, i.e., the dual map is injective.

%Recall that a morphism $G\to H$ of algebraic groups over $k$ is a quotient map if the dual map $k[H]\to k[G]$ is injective. We use $G\twoheadrightarrow H$ to denote quotient maps.

\begin{defi} \label{defi: differential embedding problem}
A \emph{differential embedding problem} of finite type over $F$ is a pair $(\f\colon G\twoheadrightarrow H,\ R)$, consisting of a quotient map $\f\colon G\twoheadrightarrow H$ of linear algebraic groups over $k$ and a Picard-Vessiot ring $R/F$ with differential Galois group $H$. A \emph{solution} is a Picard-Vessiot ring $S/F$ containing $R$ together with an isomorphism $G\simeq G(S/F)$ such that
\begin{equation} \label{eq: embedding problem}
\xymatrix{
G \ar^-\simeq[rr] \ar@{->>}[rd] & & G(S/F) \ar@{->>}[ld] \\
& H=G(R/F)
\end{equation}
commutes. In other words, the restriction map $G(S/F)\twoheadrightarrow G(R/F)$ realizes the given morphism $\f\colon G\twoheadrightarrow H$.
\end{defi}
The attribute ``of finite type'' in Definition \ref{defi: differential embedding problem} refers to the assumption that $G$ (and hence $H$) is a group scheme of finite type (over $k$). In general, to deal with Matzat's conjecture, it is important to allow more general differential embedding problems (not necessarily of finite type). See [8]. However, for our purpose differential embedding problems of finite type are sufficient. On the ring side, the commutativity of (\ref{eq: embedding problem})
is expressed by the commutativity of
\xymatrix{
S \ar[r] & S\otimes_k k[G] \\
R \ar[r] \ar[u] & R\otimes_k k[H] \ar[u]
where $R\otimes_k k[H]\to S\otimes_k k[G],\ r\otimes a\mapsto r\otimes\f^*(a)$ with $\f^*\colon k[H]\to k[G]$ the dual of $\f$.

As detailed in the following remark, a differential embedding problem over $k(x)$ can always be extended to a differential embedding problem over $k'(x)$.

\begin{rem} \label{rem: embedding problem}
Let $(\f\colon G\twoheadrightarrow H,\ R)$ be a differential embedding problem of finite type over $k(x)$ and let $k'$ be an algebraically closed field extension of $k$. Then $R'=R\otimes_{k(x)}{k'(x)}$ is a Picard-Vessiot ring over $k(x)$ with differential Galois group $H_{k'}$ (Lemma \ref{lemma: base change of PV ring over constants}). Therefore, $(\f_{k'}\colon G_{k'}\twoheadrightarrow H_{k'}, R')$ is a differential embedding problem of finite type over $k'(x)$.
\end{rem}

%?? remove, because this is earlier ??
%\begin{lemma} \label{lemma: spread out closed embedding}
%	Let $G$ be an algebraic group over $k$ and let $k'/k$ be a field extension. If $\f'\colon G_{k'}\to \Gl_{n,k'}$ is a closed embedding of algebraic groups over $k'$, then there exists a finitely generated $k$-subalgebra $\B$ of $k'$ and a closed embedding $\f\colon G_\B\to \Gl_{n,\B}$ of group schemes over $\B$ such that $\f_{k'}=\f'$.
%	The dual $\f'^*\colon k'[X,\frac{1}{\det{X}}]\to k'[G]=k'\otimes_kk[G]$ of $\f'$ is a surjective morphism of $k'$-Hopf algebras. Let $f_1,\ldots,f_m\in k[G]$ be generators of $k[G]$ as a $k$-algebra. Let $\B\subseteq k'$ be a finitely generated $k$-subalgebra such that $\f'^*(\frac{1}{\det(X)})$ and $\f'^*(X_{ij})$ lie in $\B\otimes_k k[G]\subseteq k'\otimes_k k[G]$ for all $1\leq i,j\leq n$. Since $\f'^*$ is surjective, $1\otimes f_1,\ldots,1\otimes f_m\in k'[\f'^*(X),\f'^*(\frac{1}{\det(X)})]=k'\otimes_k k[G]$. Enlarging $\B$ if necessary, we can assume that $1\otimes f_1,\ldots,1\otimes f_m\in \B[\f'^*(X),\f'^*(\frac{1}{\det(X)})]$. Thus the restriction of $\f'^*$ to $\B[X,\frac{1}{\det(X)}]\to \B\otimes_kk[G]$ is surjective. Let $\f\colon \Gl_{n,\B}\to G_\B$ be the dual. Note that $$\B[G]\otimes_{\B}\B[G]=(k[G]\otimes_k k[G])\otimes_k \B\subseteq (k[G]\otimes_k k[G])\otimes_k k'= k'[G]\otimes_{k'} k'[G].$$ The commutative diagram
%	$$
%	\xymatrix{
%	k'[X,\frac{1}{\det(X)}] \ar[d] \ar[r] & 		k'[X,\frac{1}{\det(X)}]\otimes_{k'}k'[X,\frac{1}{\det(X)}] \ar[d]\\
%	k'[G] \ar[r] & k'[G]\otimes_{k'} k'[G]
%	}
%	$$
%	restricts to a commutative diagram
%		$$
%	\xymatrix{
%		\B[X,\frac{1}{\det(X)}] \ar[d] \ar[r] & 		\B[X,\frac{1}{\det(X)}]\otimes_{\B}\B[X,\frac{1}{\det(X)}] \ar[d]\\
%		\B[G] \ar[r] & \B[G]\otimes_{\B} \B[G]
%	}.
%	$$
%Thus $\f^*\colon \B[X,\frac{1}{\det(X)}]\to \B[G]$ is a surjective morphism of Hopf-algebras over $\B$ and so $\f$ is a closed embedding of group schemes over $\B$.
%The following simple example illustrates Lemma \ref{lemma: spread out closed embedding}.
%	Let $k'/k$ be a field extension and $b\in k'\smallsetminus\{0\}$. Consider the closed embedding $\f'\colon\mathbb{G}_{a,k'}\to \Gl_{2,k'}$ of algebraic groups over $k'$ given by
%		\begin{equation} \label{eq: embed Ga}
%	g\mapsto \begin{pmatrix}
%	1 & bg \\
%	0 & 1
%	\end{pmatrix}.
%	\end{equation}
%	For $\B=k[b]\subseteq k'$, formula (\ref{eq: embed Ga}) defines a morphism $\mathbb{G}_{a,\B}\to \Gl_{2,\B}$ of group schemes over $\B$ that need not be a closed embedding, e.g., if $b$ is transcendental over $k$, the fibre over $b=0$ is not a closed embedding. However, for $\B=k[b,b^{-1}]\subseteq k'$, formula (\ref{eq: embed Ga}) defines a closed embedding $\mathbb{G}_{a,\B}\to \Gl_{2,\B}$ of group schemes over $\B$.

To apply Theorem \ref{theo: main specialization} we first need to ``spread out'' a solution of the extended differential embedding problem into a family with nice properties. This is achieved in the following lemma. Recall that actions of affine group schemes on differential algebras were defined in Section \ref{subsec: differential torsors}.
%so that the relevant properties will be preserved under specialization. This ``spreading out'' is achieved in Proposition \ref{prop: spread out solution to differential embedding problem} which relies on the following lemma.
%The following necessarily rather long and technical proposition explains how a solution to a differential embedding problem over $k'$ can be ``spread out'' into a family with nice properties.

\begin{lemma} \label{lemma: spread out solution to differential embedding problem}
Let $(\f\colon G\twoheadrightarrow H,\ R)$ be a differential embedding problem of finite type over $k(x)$. Let $k'$ be an algebraically closed field extension of $k$ and let $S'/k'(x)$ be a solution of the induced differential embedding problem $(\f_{k'}\colon G_{k'}\twoheadrightarrow H_{k'},\ R')$ over $k'(x)$, where $R'=R\otimes_{k(x)}k'(x)$. Then there exist
\begin{enumerate}
\item a monic polynomial $h\in k[x]$, and a $k[x]_h$-$\de$-subalgebra $R_0$ of $R$ with an action of $H$ on $R_0/k[x]_h$
% turning $R_0/k[x]_h$ into a differential $H$-torsor
such that $R_0\otimes_{k[x]}k(x)=R$  (equivalently, $S^{-1}R_0=R$, where $S=k[x]_h\smallsetminus \{0\}$) and the induced action of $H$ on $S^{-1}R_0/S^{-1}k[x]_h$ is the natural action of $H$ on $R/k(x)$,
\item a finitely generated $k$-subalgebra $\mathcal{B}$ of $k'$ and a monic polynomial $f\in \mathcal{B}[x]$ such that $h\in k[x]\subseteq \mathcal{B}[x]$ divides $f$ in $\mathcal{B}[x]$,
\item a matrix $\mathcal{A}\in \B[x]_f^{n\times n}$ and a differential $G_\B$-torsor $\mathcal{S}/\B[x]_f$ for $\de(y)=\cA y$ such that $\mathcal{S}$ is flat over $\B[x]_f$
and $S^\gen=\mathcal{S}\otimes_{\B[x]_f}K(x)$ is $\de$-simple, where $K=\overline{k(\mathcal{B})}\subseteq k'$ is the algebraic closure of the field of fractions of $\B$,

%		 $\mathcal{B}[x]_f$-$\de$-subalgebra $\mathcal{S}$ of $S'$ that is
%		a generically Picard-Vessiot differential $G_\B$-torsors for $\de(y)=\mathcal{A} y$,
%%		with an action of $G_{\mathcal{B}}$ on $\mathcal{S}/\mathcal{B}[x]_f$ turning $\mathcal{S}/\mathcal{B}[x]_f$ into a differential $G_\B$-torsor
%		 such that $\mathcal{S}\otimes_{\mathcal{B}[x]_f}k'(x)=S'$ and the action induced\footnote{Note that the action of $G_\B$ on $\SSS/\B[x]_f$ induces an action of $G_{k'}$ on $\SSS\otimes_\B k'/ (\B[x]_f)\otimes_\B k'$, but $\SSS\otimes_\B k'=\SSS\otimes_{\B[x]_f} k'[x]_f$ and $(\B[x]_f)\otimes_\B k'=k'[x]_f$ and so (using (ii) of Lemma~\ref{lemma: actions}) we obtain an induced action of $G_{k'}$ on $\SSS\otimes_{\B[x]_f}k'(x)/k'(x)$.} via $\mathcal{B}\to k'$ of $G_{k'}$ on $S'/k'(x)$ is the natural action, given by the fact that $G_{k'}$ is isomorphic to the differential Galois group of $S'/k'(x)$,

\item a morphism $\mathcal{R}\to \mathcal{S}$ of $\mathcal{B}[x]_f$-$\de$-algebras that is equivariant with respect to the morphism $\f_{\mathcal{B}}\colon G_{\mathcal{B}}\to H_{\mathcal{B}}$, where $\mathcal{R}=R_0\otimes_{k[x]_h}\mathcal{B}[x]_f=(R_0\otimes_k\B)_f$ and $\mathcal{R}/\B[x]_f$ has an $H_\B$-action induced from \rm{(i)} above. (The equivariance means that for every $\mathcal{B}$-algebra $\mathcal{T}$ and $g\in G_{\B}(\T)$ the diagram
\xymatrix{
\SSS\otimes_\B\T \ar^g[r] & \SSS\otimes_\B\T \\
\R\otimes_\B\T \ar[u] \ar^-{\f(g)}[r]& \R\otimes_\B \T \ar[u]
\end{enumerate}
%such that $\mathcal{S}\otimes_{\mathcal{B}[x]_f}k'(x)=S'$ and the functorial action of $G_\mathcal{B}$ induces the functorial action of $G_{k'}=(G_\mathcal{B})_{k'}$ on $S'$.??
\end{lemma}
\begin{proof}
We begin with (i). 	Choose $A\in k(x)^{m\times m}$ such that $R/k(x)$ is a Picard-Vessiot ring for $\de(y)=Ay$. Let $h\in k[x]$ be a monic polynomial such that $A\in k[x]_h^{m\times m}$ and let $Y\in \Gl_m(R)$ satisfy $\de(Y)=AY$. Then $R_0=k[x]_h[Y,\frac{1}{\det(Y)}]$ is a $\de$-subring of $R$ because $\de(Y)=AY\in R_0^{m\times m}$.
For a $k$-algebra $T$ an element $g\in H(T)$ acts on $R\otimes_k T$ by $Y\otimes 1\mapsto Y\otimes [g]$ for some matrix $[g]\in \Gl_m(T)$. Thus $g\colon R\otimes_k T \to R\otimes_k T$ restricts to a $k[x]_k\otimes_k T$\=/$\de$\=/automorphism of $R_0\otimes_k T$. This defines an action of $H$ on $R_0/k[x]_h$ that clearly induces the given action on $R/k(x)$.

To address the remaining points, fix $A'\in k'(x)^{n\times n}$ and $Y'\in \Gl_n(S')$ such that $S'/k'(x)$ is a Picard-Vessiot ring for $\de(y)=A'y$ and $\de(Y')=A'Y'$. As
$R\subseteq R'\subseteq S'=k'(x)[Y',\frac{1}{\det(Y')}]$, there exists a finitely generated $k$-subalgebra $\B_0$ of $k'$ and a monic polynomial $f'_0\in \B_0[x]$ such that all entries of $Y$ and $\frac{1}{\det(Y)}$ lie in $\B_0[x]_{f'_0}[Y',\frac{1}{\det(Y')}]\subseteq S'$. Set $f_0=hf_0'\in\B_0[x]$. Then $R_0=k[x]_h[Y,\frac{1}{\det(Y)}]\subseteq \B_0[x]_{f_0}[Y',\frac{1}{\det(Y')}]\subseteq S'$.

Now Lemma \ref{lemma: spread out PVring} yields a finitely generated $k$-subalgebra $\B$ of $k'$ with $\B_0\subseteq \B$, a monic polynomial $f\in \B[x]$ such that $f_0$ divides $f$ in $\B[x]$, a differential $G_\B$-torsor $\mathcal{S}/\B[x]_f$ for $\de(y)=A'y$ with fundamental solution matrix $\Y$ such that $\mathcal{S}$ is flat over $\B[x]_f$, $S^\gen=\mathcal{S}\otimes_{\B[x]_f}K(x)$ is $\de$-simple and $\mathcal{S}\otimes_{\B[x]_f}k'(x)\simeq S'$ via $\Y\mapsto Y'$. So, $\mathcal{S}$ can be identified with $\B[x]_f[Y',\frac{1}{\det(Y')}]\subseteq S'$ and $R_0\subseteq \mathcal{S}$.

%	all the items in (ii) and (iii) with $\cA=A'\in \B[x]_f^{n\times n}$ and an isomorphism
%	$\mathcal{S}\otimes_{\B[x]_f}k'(x)=S^\gen\otimes_{K(x)}k'(x)\simeq S'$

%	\vspace{30mm}

%	The contributions to $\B$ and $f$ came from various different sources. We go through them one by one:
%	\renewcommand{\labelenumi}{{\rm (\alph{enumi})}}
%	\item  Let $\B_1$ be a finitely generated $k$\=/subalgebra of $k'$ and $f_1\in \B[x]$ a monic polynomial such that $\mathcal{A}\in \B_1[x]_{f_1}$. Then $\B_1[x]_{f_1}[\Y,\frac{1}{\det(\Y)}]$ is a $\de$-subring of $S'$.
%Set $f=f_0h$ so that also $A'\in \B_0[x]_f^{n\times n}$.
%%	\item 	As $R\subseteq R'\subseteq S'=k'(x)[\Y,\frac{1}{\det(Y)}]$, there exists a finitely generated $k$-subalgebra $\B_2$ of $k'$ and a monic polynomial $f'_2\in \B_2[x]$ such that all entries of $Y$ and $\frac{1}{\det(Y)}$ lie in $\B_2[x]_{f_2}[\Y,\frac{1}{\det(\Y)}]$. Set $f_2=hf_2'\in\B_2[x]$. Then $R_0=k[x]_h[Y,\frac{1}{\det(Y)}]\subseteq \B_2[x]_{f_2}[\Y,\frac{1}{\det(\Y)}]$.
%	\item Consider the ideal $I'$ of $k'(x)[X,\frac{1}{\det(X)}]$ given by $I'=\{p\in k'(x)[X,\frac{1}{\det(X)}]|\ p(\Y)=0\}$. Choose $p_1,\ldots,p_r\in I'$ such  $I'=(p_1,\ldots,p_r)$. Let $\B_3$ be a finitely generated $k$\=/subalgebra of $k'$ and let $f_3\in \B_3[x]$ be monic such that $p_1,\ldots,p_r\in \B_3[x]_{f_3}[X,\frac{1}{\det(X)}]\subseteq k'(x)[X,\frac{1}{\det(X)}].$
%	\item We consider $G_{k'}$ as a closed subgroup of $\Gl_{n,k'}$ via the fundamental solution matrix $\Y$. As explained in Section \ref{subsec:differential Galois theory}, the closed embedding $G_{k'}\to \Gl_{n,k'}$ corresponds to the morphism $k'[X, \frac{1}{\det(X)}]\to k'[G]=(S'\otimes_{k'(x)}S')^\de,\ X\mapsto \Z=\Y^{-1}\otimes\Y$. By Lemma~\ref{lemma: spread out closed embedding} there exists a finitely generated $k$-subalgebra $\B_4$ of $k'$ and a closed embedding $G_{\B_4}\to\Gl_{n,\B_4}$ that induces $G_{k'}\to\Gl_{n,k'}$. This means that $$k'[G]=k'[\Z,\tfrac{1}{\det(\Z)}]=k'\otimes_{\B_4}\B_4[\Z,\tfrac{1}{\det(\Z)}]=k'\otimes_{\B_4}\B_4[G]$$
%	and so the coaction $S'\to S'\otimes_{k'}k'[G]=S'\otimes_k k[G],\ \Y\mapsto \Y\otimes \Z$ restricts to a map
%	$\B_4[x][\Y,\frac{1}{\det(\Y)}]\to \B_4[x][\Y,\tfrac{1}{\det(\Y)}]\otimes_{\B_4}\B_4[G]$. Note that
%	\begin{align*} \B_4[x]&[\Y,\tfrac{1}{\det(\Y)}]\otimes_{\B_4}\B_4[G]=\B_4[x][\Y,\tfrac{1}{\det(\Y)}]\otimes_{\B_4}(\B_4\otimes _k k[G])=\\
%	&=\B_4[x][\Y,\tfrac{1}{\det(\Y)}]\otimes_k k[G]\subseteq S'\otimes_k k[G]= S'\otimes_{k'} k'[G].
%	\end{align*}

%\renewcommand{\labelenumi}{{\rm (\roman{enumi})}}

%	Let $\B_5$ be the $k$-subalgebra of $k'$ generated by $\B_1,\B_2,\B_3$ and $\B_4$. Furthermore, set $f_5=f_1f_2f_3$ and consider the finitely generated $\B_5[x]_{f_5}$-algebra $\B_5[x]_{f_5}[\Y,\frac{1}{\det(\Y)}]\subseteq S'$.	By generic flatness (\cite[Theorem~14.4]{Eisenbud:view}), there exists a non-zero $f_6\in\B_5[x]_{f_5}$ such that $(\B_5[x]_{f_5})_{f_6}[\Y,\frac{1}{\det(\Y)}]$ is flat over $(\B_5[x]_{f_5})_{f_6}$. Write $f_6=\frac{f_6'}{f_5^\ell}$ with $f_6'\in\B_5[x]$ and $\ell\geq 1$. Then $(\B_5[x]_{f_5})_{f_6}=\B_5[x]_{f_6'}$. Let $\B$ be the $k$-subalgebra of $k'$ generated by $\B_5$ and the inverse (in $k'$) of the leading coefficient $b$ of $f'_6$.
%	 	% Set $f_2=\frac{1}{b}f_2'f_1\in \B_2[x]$. Then $(\B_1[x]_{f_1})_{f_2'}=\B_2[x]_{f_2}$
%	 In general, if $R\to S$ is a flat ring map and $f\in R$, then $S_f=S\otimes_R R_f$ is a flat $R_f$-module (\cite[\href{https://stacks.math.columbia.edu/tag/00HI}{Tag 00HI}]{stacks-project}). Therefore, since $\B_5[x]_{f_6'}[\Y,\frac{1}{\det(\Y)}]$ is a flat $\B_5[x]_{f_6'}$\=/module, $(\B_5[x]_{f_6'})_b[\Y,\frac{1}{\det(\Y)}]$ is a flat $(\B_5[x]_{f_6'})_{b}$\=/module. For the monic polynomial $f=\frac{1}{b}f_6'\in \B[x]$ we have $(\B_5[x]_{f_6'})_{b}=\B[x]_{f}$ and so $\B[x]_f[\Y,\frac{1}{\det(\Y)}]$ is a flat $\B[x]_{f}$-module.
%	 Set $\SSS=\B[x]_f[\Y,\frac{1}{\det(\Y)}]$. Since $\B_1[x]_{f_1}\subseteq \B[x]_f$ it follows from (a) that $\SSS$ is a $\B[x]_f$-$\de$-subalgebra of $S'$. We will next show that the map $\SSS\otimes_{\B[x]_f}k'(x)\to S'$ is an isomorphism. Since $S'=k'(x)[\Y,\frac{1}{\det(Y)}]$ it is clearly surjective. So it suffices to show that it is injective. Let $\mathcal{I}$ be the ideal of $\B[x]_f[X,\frac{1}{\det(X)}]$ given by $\mathcal{I}=\{p\in\B[x]_f[X,\frac{1}{\det(X)}]|\ p(\Y))=0 \}$. Then
%	 $$\SSS\otimes_{\B[x]_f}k'(x)=(\B[x]_f[X,\tfrac{1}{\det(X)}]/\mathcal{I})\otimes_{\B[x]_f}k'(x)=k'(x)[X,\tfrac{1}{\det(X)}]/(\mathcal{I}).$$
%	 On the other hand, $S'=k'(x)[X,\frac{1}{\det(X)}]/I'$. Since $I'=(p_1,\ldots,p_r)$ and $p_1,\ldots,p_r\in \B_3[x]_{f_3}[X,\frac{1}{\det(X)}]\subseteq \B[x]_f[X,\frac{1}{\det(X)}]$ by (c), we have $p_1,\ldots,p_r\in \mathcal{I}$ and so $(\mathcal{I})=I'$. This shows that $\SSS\otimes_{\B[x]_f}k'(x)\to S'$ is injective and thus an isomorphism.
%	 By (d), the coaction $S'\to S'\otimes_{k'}k'[G]=S'\otimes_k k[G]$ restricts to $\B_4[x][\Y,\frac{1}{\det(\Y)}]\to\B_4[x][\Y,\frac{1}{\det(\Y)}]\otimes_{\B_4}\B_4[G]=\B_4[x][\Y,\frac{1}{\det(\Y)}]\otimes_kk[G]$. Since $\B_4[x]\subseteq \B[x]_f$ it also restricts to
%	 $\B[x]_f[\Y,\frac{1}{\det(\Y)}]\to\B[x]_f[\Y,\frac{1}{\det(\Y)}]\otimes_{\B}\B[G]=\B[x]_f[\Y,\frac{1}{\det(\Y)}]\otimes_kk[G]$. So $\SSS\to\SSS\otimes_{\B}\B[G],\ \Y\mapsto \Y\otimes \Z$ defines an action of $G_\B$ on $\SSS/\B[x]_f$. To see that $\SSS/\B[x]_f$ is a differential $G_\B$-torsor, let us first show that $\SSS\otimes_{\B[x]_f}\SSS\to S'\otimes_{k'(x)}S'$ is injective. Note that
%	 $$(\SSS\otimes_{\B[x]_f}\SSS)\otimes_{\B[x]_f}k'(x)=(\SSS\otimes_{\B[x]_f}k'(x))\otimes_{k'(x)}(\SSS\otimes_{\B[x]_f}k'(x))=S'\otimes_{k'(x)}S'.$$
%	 It thus suffices to show that the map $\SSS\otimes_{\B[x]_f}\SSS\to (\SSS\otimes_{\B[x]_f}\SSS)\otimes_{\B[x]_f}k'(x)$ is injective. In general, if $R\to S$ is a flat ring map and $R\to S_1$ is injective, then $S\to S\otimes_R S_1$ is injective (by flatness of $S/R$). It therefore suffices to show that $\SSS\otimes_{\B[x]_f}\SSS$ is flat over $\B[x]_f$. But $\SSS$ is flat over $\B[x]_f$ and the tensor product of two flat modules is flat. So $\SSS\otimes_{\B[x]_f}\SSS$ is flat over $\B[x]_f$ and $\SSS\otimes_{\B[x]_f}\SSS\to S'\otimes_{k'(x)}S'$ is injective. We also have an inclusion $\SSS\otimes_\B \B[G]=\SSS\otimes_k k[G]\subseteq S'\otimes_k[G]=S'\otimes_{k'}k'[G]$. Moreover, the isomorphism
%	 $S'\otimes_{k'(x)}S'\to S'\otimes_{k'}S'$ restricts to an isomorphism $\SSS\otimes_{\B[x]_f}\SSS\to \SSS\otimes_\B\B[G]$. Note that $\SSS\otimes_{\B[x]_f}\SSS\to \SSS\otimes_\B\B[G]$ is surjective, because $\B[G]=\B[\Z,\frac{1}{\det(\Z)}]$, where $\Z=\Y^{-1}\otimes\Y\in \Gl_n(S'\otimes_{k'(x)}S')$, and $\SSS\otimes_{\B[x]_f}\SSS\to \SSS\otimes_\B\B[G]$ maps $\Y^{-1}\otimes\Y$ to $1\otimes \Z$. Thus $\SSS/\B[x]_f$ is a differential $G_\B$-torsor. Let us next show that it is generically Picard-Vessiot. Let $k_0$ denote the algebraic closure of the field of fractions of $\B$. We have to show that $\SSS\otimes_{\B[x]_f}k_0(x)/k_0(x)$ is Picard-Vessiot. For this it suffices (cf. the discussion following Definition \ref{def: family of differential Gtorsors}) to show that $\SSS\otimes_{\B[x]_f}k_0(x)$ is $\de$-simple. But
%	 $$(\SSS\otimes_{\B[x]_f}k_0(x))\otimes_{k_0(x)}k'(x)=\SSS\otimes_{\B[x]_f}\otimes k'(x)=S'$$
%	 is $\de$-simple and so $\SSS\otimes_{\B[x]_f}k_0(x)$ must be $\de$-simple.

By now we have established (i), (ii) and (iii) of the proposition. Let us move on to (iv). %As $\B_2[x]_{f_2}\subseteq\B[x]_f$ we obtain $R_0\subseteq \SSS$ from (b).
Setting $\R=R_0\otimes_{k[x]_h}\B[x]_f$, the inclusion $R_0\subseteq \mathcal{S}$ yields a morphism $\R\to \SSS$ of $\B[x]_f$-$\de$-algebras. Since $S'/k'(x)$ is a solution of the differential embedding problem $(\f_{k'}\colon G_{k'}\twoheadrightarrow H_{k'},\ R')$ the diagram
\xymatrix{
S' \ar[r]  & S'\otimes_{k'}k'[G_{k'}] \\
R' \ar[r] \ar[u] & R'\otimes_{k'}k'[H_{k'}] \ar[u]
commutes. Therefore also
\xymatrix{
\SSS \ar[r]  & \SSS\otimes_\B \B[G_\B]\ar@{=}[r] & \SSS\otimes_{k}k[G] \ar@{^(->}[r]& S'\otimes_{k}k[G]=S'\otimes_{k'}k'[G_{k'}] \\
R_0 \ar[rr] \ar[u] & & R_0\otimes_{k}k[H] \ar[u]  \ar@{^(->}[r] & R'\otimes_k k[H]=R'\otimes_{k'}k'[H_{k'}]	\ar[u]
\xymatrix{
\SSS \ar[r] & \SSS\otimes_\B \B[G_\B] \\
\R \ar[r] \ar[u] & \R\otimes_\B \B[H_\B] \ar[u]
commutes. This establishes (iv).

\end{proof}

%Proposition \ref{prop: spread out solution to differential embedding problem} above is necessarily rather lengthy and technical. The main point to take away here is that the solution $S'$ of the induced differential embedding problem over $k'(x)$ can be ``spread out'' into a family with nice properties so that in the next step we can specialize to get back down to $k$.

%	In the situation of Lemma \ref{lemma: descend to S}, there exists a basic open subset $U$ of $\X$ such that $R_\f/k(x)$ is a Picard-Vessiot ring with differential Galois group $G_\f$ for all $\f\in U$.

%	Let $A\in k'(x)^{n\times n}$ and let $a_1,\ldots, a_r\in k'(x)$ be a $k'$-basis of the $k'$-vector space generated by the entries of $A$. Write $A=a_1M_1+\ldots +a_r M_r$ with $M_1,\ldots M_r\in k'^{n\times n}$ and let $\Lie(A)$ denote the
%	Then
%Let $k\subseteq k'$ be an inclusion of algebraically closed fields and let $M_1,\ldots, M_r\in k'^{n\times n}$. Then there exist $s_1,\ldots,s_m\in k'$ such that for every finitely generated $k$-subalgebra $S$ of $k'$ containing $s_1,\ldots,s_m$ the following holds: $M_1,\ldots, M_r\in S^{n\times n}$ and there exists a Lie-subalgebra $\ida$ of $\mathfrak{gl}_n(S)$ and a big subset $X$?? of ?? such that $\ida\otimes_Sk'=\mathfrak{g}(M_1,\ldots,M_r)$ and

The following theorem was proved in [5] under the assumption that $k$ has infinite transcendence degree over $\mathbb{Q}$. Thanks to Theorem \ref{theo: main specialization} we are able to remove this unnecessary assumption.

\begin{theo} \label{theo: solve embedding problems}
Let $k$ be an algebraically closed field of characteristic zero. Then every differential embedding problem of finite type over $(k(x),\frac{d}{dx})$ is solvable.
\end{theo}
\begin{proof}
Let $(\f\colon G\twoheadrightarrow H,\ R)$ be a differential embedding problem of finite typer over $k(x)$. Let $k'$ be an algebraically closed field extension of $k$ such that $k'$ has infinite transcendence degree over $\mathbb{Q}$. Consider the induced differential embedding problem $(\f_{k'}\colon G_{k'}\twoheadrightarrow H_{k'},\ R')$, where $R'=R\otimes_{k(x)}k'(x)$. According to \cite[Cor. 4.6]{BachmayrHartmannHarbaterPop:Large} it has a solution $S'/k'(x)$. Let $h,R_0,\B,f,\mathcal{A},\R$ and $\SSS$ be as in Lemma \ref{lemma: spread out solution to differential embedding problem} and set $\X=\spec(\B)$.
Then $\SSS/\B[x]_f$ satisfies all the assumptions of Notation \ref{notation: setup} and it follows from Theorem~\ref{theo: main specialization} that there exists a $c\in\X(k)$ such that $S^c=\SSS\otimes_{\B[x]_f}k(x)$ is a Picard-Vessiot ring. In fact, $S^c/k(x)$ is a Picard-Vessiot ring with differential Galois group $G^c=(G_{\B})_c=G$.

The morphism $\R\to \SSS$ of $\B[x]_f$-$\de$-algebras yields a morphism
$\R\otimes_{\B[x]_f}k(x)\to \SSS\otimes_{\B[x]_f}k(x)$ of $k(x)$-$\de$-algebras. But $$\R\otimes_{\B[x]_f}k(x)=(R_0\otimes_{k[x]_h}\B[x]_f)\otimes_{\B[x]_f}k(x)=R_0\otimes_{k[x]_h}k(x)=R$$ and $\SSS\otimes_{\B[x]_f}k(x)=S^c$.
We thus obtain an embedding $R\to S^c$ of Picard-Vessiot rings over $k(x)$. By (iv) of Lemma \ref{lemma: spread out solution to differential embedding problem} the diagram
\xymatrix{
\SSS \ar[r] & \SSS\otimes_\B \B[G_\B] \\
\R \ar[r] \ar[u]& \R\otimes_\B\B[H_\B] \ar[u]
commutes. Therefore also its base change
\xymatrix{
S^c\ar[r] & S^c\otimes_k k[G] \\
R \ar[r] \ar[u]& R\otimes_k k[H] \ar[u]
via $\B[x]_f\to k(x)$ commutes. Thus $S^c/k(x)$ is a solution of $(G\twoheadrightarrow H,\ R)$.
\end{proof}
We are now prepared to prove Matzat's conjecture in full generality.

\begin{theo} \label{theo: Matzat's conjecture}
Let $k$ be an algebraically closed field of characteristic zero and let $F$ be a one-variable function field over $k$, equipped with a non-trivial $k$-derivation. Then the absolute differential Galois group of $F$ is the free proalgebraic group on a set of cardinality $|F|$.
\end{theo}
\begin{proof}
The case when $k$ has infinite transcendence degree (over $\mathbb{Q}$) is proved in \cite[Theorem 2.9]{Wibmer:SubgroupsOfFreeProalgebraicGroupsAndMatzatsConjecture}. So we can assume that $k$ has finite transcendence degree. In particular, $k$ is countable.
In \cite[Prop. 2.8]{Wibmer:SubgroupsOfFreeProalgebraicGroupsAndMatzatsConjecture} it is shown that if Matzat's conjecture is true for $(k(x),\frac{d}{dx})$, then it is true for $F$. So we have reduced to proving the theorem for $(k(x),\frac{d}{dx})$ with $k$ countable. According to \cite[Cor. 3.9]{BachmayrHarbaterHartmannWibmer:FreeDifferentialGaloisGroups}, the absolute differential Galois group of a countable differential field $F$ is free on a countably infinite set if and only if every differential embedding problem over $F$ of finite type is solvable. It therefore suffices to show that every differential embedding problem of finite type over $(k(x),\frac{d}{dx})$ is solvable. This is exactly Theorem \ref{theo: solve embedding problems}.
\end{proof}

\section{A short solution of the inverse problem}
\label{sec: inverse problem}

The \emph{solution of the inverse problem} states that every linear algebraic group over $k$ is a differential Galois group over $k(x)$. Using the Riemann-Hilbert correspondence, this was proved for $k=\C$ already in 1979 ([43]) but it took more than 25 years and contributions of many authors to finally solve the inverse problem for an arbitrary algebraically closed field $k$ of characteristic zero ([22]).

In this short section, we explain how Theorem \ref{theo: main specialization} can be used to deduce the solution of the inverse problem over $k$, from the solution of the inverse problem over $\C$. Of course, our solution is only short if one accepts Theorem \ref{theo: main specialization} and the solution of the inverse problem over $\C$, as given.

\begin{theo}
Let $k$ be an algebraically closed field of characteristic zero. Then every linear algebraic group over $k$ is a differential Galois group over $k(x)$.
\end{theo}
\begin{proof}
Let $G$ be a linear algebraic group over $k$. Then $G$ descends to a finitely generated field, i.e., there exists a subfield $k_0$ of $k$ finitely generated over $\mathbb{Q}$ and a linear algebraic group $G_0$ over $k_0$ such that $(G_0)_k=G$.
Passing to the algebraic closure $k_1\subseteq k$ of $k_0$, we obtain a countable algebraically closed field $k_1$ and a linear algebraic group $G_1$ over $k_1$ such that $(G_1)_k=G$.

%We may, and henceforth do, assume that $k_0$ is algebraically closed.
By Lemma \ref{lemma: base change of PV ring over constants}, it suffices to show that $G_1$ is a differential Galois group over $k_1(x)$. Since $k_1$ is countable, there exists an embedding of $k_1$ into $\mathbb{C}$ that we now fix.

By [43], there exists a Picard-Vessiot ring $R/\C(x)$ for some equation $\de(y)=A'y$, ($A'\in\C(x)^{n\times n}$) with differential Galois group $(G_1)_\C$. The Picard-Vessiot ring $R/\C(x)$ can now be spread out by Lemma \ref{lemma: spread out PVring}, i.e., there exists
\begin{itemize}
\item a finitely generated $k_1$-subalgebra $\B$ of $\C$,
\item a monic polynomial $f\in \B[x]$ with $A'\in\B[x]_f^{n\times n}$
\item and a differential $(G_1)_\B$-torsor $\R/\B[x]_f$ for $\de(y)=A'y$ such that $\R$ is flat over $\B[x]_f$ and $\R\otimes_{\B[x]_f}K(x)$ is $\de$-simple, where $K$ is the algebraic closure of the field of fractions of $\B$.
\end{itemize}
Set $\X=\spec(\B)$.
By the specialization theorem (Theorem \ref{theo: main specialization}), there exists a $c\in \X(k_1)$ such that $R^c=\R\otimes_{\B[x]_f}k_1(x)$ is Picard-Vessiot. So $R^c/k_1(x)$ is a Picard-Vessiot ring for $\de(y)=A'^cy$ with differential Galois group $((G_1)_\B)^c=((G_1)_\B)_{k_1}=G_1$. In particular, $G_1$ is a differential Galois group over $k_0(x)$ as desired.
\end{proof}

\section{Appendix A: Specializations of solutions of linear differential equations}
Throughout Appendix A, we assume the setup of Notation \ref{notation: setup}.

% $k$ is an algebraically closed field of characteristic zero, $\B$ is a finitely generated $k$-algebra that is an integral domain and $\X=\spec(\B)$.
%Moreover, $f\in \B[x]$ is a monic polynomial, $\mathcal{A}\in\B[x]_f^{n\times n}$, $\G$ is an affine group scheme of finite type over $\B$ and $\R/\B[x]_f$ is a differential $\G$-torsor for $\de(y)=\mathcal{A}y$ with fundamental matrix $\Y\in\Gl_n(\R)$ such that $\R/\B[x]_f$ is generically Picard-Vessiot. Furthermore, $\K$ is the field of fractions of $\B$.

\medskip

Let $F$ be a differential field, $A\in F^{n\times n}$ and $R/F$ a Picard-Vessiot ring for $\de(y)=Ay$ with fundamental matrix $Y\in\Gl_n(R)$. For a fixed positive integer $m$, we set
\operatorname{AlgRel}(Y,m,F)=\{h\in F[X]\mid h(Y)=0,\ \deg(h)\leq m\}.
Then $\algrel(Y,m,F)$ is a finite dimensional $F$-vector space; the vector space of algebraic relations of degree at most $m$ among the entries of $Y$.

If $c\in\X(k)$ and $\m$ is a maximal $\de$-ideal of $R^c$, then $R^c/\m$ is a Picard-Vessiot ring over $k(x)$ for $\de(y)=A^cy$ with fundamental solution matrix $\overline{Y^c}$, the image of $Y^c$ in $R^c/\m$. As any two maximal $\de$-ideals of $R^c$, only differ by multiplication with a matrix in $\Gl_n(k)$,
we see that $\dim_{k(x)}\algrel(\overline{Y^c},m,k(x))$ does not depend on the choice of $\m$.
The goal of Appendix~A is to investigate the relation between $\algrel(\overline{Y^c},m,k(x))$ and $\algrel(Y^{\gen},m,K(x))$. In particular, we will show (Theorem \ref{theo:basisunderspecialization}) that there exists an ad\=/open subset $\U$ of $\X(k)$ such that $$\dim_{k(x)}\algrel(\overline{Y^c},m,k(x))=\dim_{K(x)}\algrel(Y^{\gen},m,K(x))$$ for any $c\in \U$.

\medskip

By considering the vector $\bfv$ of all monomials of degree at most $m$ in the entries of a fundamental solution matrix $Y$, the study of the algebraic relations of degree at most $m$ among the entries of $Y$, reduces to the study of the linear relations satisfied by the entries of $\bfv$. To study the behaviour of the linear relations under specialization, the key idea is to find a useful bound on the degree of the rational functions occurring as the coefficients in a basis of the linear relations. To describe this bound and its behaviour under specialization, we need to bound the degree of the logarithmic derivative of exponential solutions of linear differential operators. This is discussed in the following section.

%We shall investigate the specializations of $\calS(\Y,m,\bar{\K}(x))$.
%Let $\bfm_1,\dots,\bfm_\nu$ denote all monomials in $X$ with degree not greater than $m$, so $\nu={n^2+m \choose m}$.
%Note that $(\bfm_1(\Y),\dots,\bfm_\nu(\Y))^t\in\R^\nu$ is a solution of
%\label{eq:symmetric power system}
%where $\mathcal{A}'\in\B[x]_f^{\nu\times\nu}$ is constructed via $\mathcal{A}$.
%Indeed, using the Leibniz rule and that $\de(\Y)=\mathcal{A}\Y$, one sees that if $\m_i$ is a monomial of degree $d$, then $\de(\bfm_i(\Y))$ is a linear combination of monomials of degree $d$ in $\Y$ with coefficients that are $\mathbb{Z}$-linear combinations of the entries of $\mathcal{A}$.
%This means that instead of focusing on the algebraic relations of degree at most $m$ among the entries of a fundamental solution matrix, we can focus on the linear relations among a single solution. We therefore introduce the following notation.

\subsection{Exponential bounds for linear differential operators} \label{subsec: exponential bound}

Throughout Section \ref{subsec: exponential bound} we denote with $k'$ an algebraically closed field of characteristic zero.
We will work with the (non-commutative) ring $k'(x)[\de]$ of linear differential operators with coefficients in $k'(x)$ (as defined in \cite[Section 2.1]{SingerPut:differential}).
Thus a (scalar) linear differential equation
with $\lambda_0,\ldots,\lambda_\mu\in k'(x)$, can be written more succinctly as $Ly=0$, where
$$L=\de^\mu+\lambda_{\mu-1}\de^{\mu-1}+\ldots+\lambda_0\in k'(x)[\de]$$
is the corresponding linear differential operator.

A nonzero solution $h$ of $Ly=0$ (in some Picard-Vessiot extension of $k'(x)$) is called an \emph{exponential solution} of $Ly=0$ if $\de(h)/h\in k'(x)$. The reader is referred to Section 4.1 of [44] for more background on exponential solutions and their computation.

Recall that the \emph{degree} of a nonzero rational function $a=\frac{a_1}{a_2}\in k'(x)$ with $a_1,a_2,\in k'[x]$ relatively prime, is defined as $\deg(a)=\max\{\deg(a_1),\deg(a_2)\}$. By convention, $\deg(0)=-\infty$.

%	To this end, we introduce the following definition.
%	\label{defi:exponentialsols}
%	A nonzero element $h$ of a Picard-Vessiot ring $R/K$ is \emph{exponential over $K$} if $\delta(h)/h\in K$. A vector $\bfw\in R^m$ is \emph{exponential over $K$} of it is of the form $\bfw=h\tilde{\bfw}$ with $h\in R$ exponential over $K$ and $\tilde{\bfw}\in K^m$.
%	%
%	%solution $\bfv$ of $\delta(y)= Ay$ is said to be exponential over $\bar{\K}(x)$ if $\bfv$ is the product of an exponential element over $\bar{\K}(x)$ and a vector with entries in $\bar{\K}(x)$.
%Recall that the \emph{degree} of a nonzero rational function $a=\frac{f}{g}\in k'(x)$ with $f,g,\in k'[x]$ relatively prime, is defined as $\deg(a)=\max\{\deg(f),\deg(g)\}$. By convention, $\deg(0)=-\infty$.

\begin{defi}
\label{defi:exponentialbounds}
An integer $N$ is an \emph{exponential bound} for $L y=0$, if
$\deg(\de(h)/h)\leq N$ for any exponential solution $h$ of $L y=0$ (belonging to some Picard-Vessiot extension of $k'(x)$).
%  \max\{\deg(\delta(h)/h) \mid \mbox{$0\neq h$ is exponential and $\L(h)=0$}\}\leq N
%where $\deg(0)=-\infty$ and if $\L y=0$ has no exponential solution then set $N=0$.
\end{defi}
%Suppose that $\L \in \B[x][\pa]$ and $N$ is an exponential bound of $\L y=0$. We shall show that there is a basic open subset $\U_1$ of $\X(k)$ such that $N$ is also an exponential bound of $\L^c y=0$ for all $c\in \U_1$.
The main point of this section is to describe an exponential bound $N(L)$ for $Ly=0$ that is well-behaved under specialization. This bound is also described in the second paragraph on page 109 of [44].

The elements $u\in k'(x)$ of the form $u=\delta(h)/h$ for some exponential solution $h$ of $L y=0$ are exactly the solutions of the Riccati equation associated with $L y=0$ (\cite[Def. 4.6]{SingerPut:differential}).
Another description of these $u$'s is, as the set of elements of $k'(x)$ such that $\de-u\in k'(x)[\de]$ is a right-hand factor of $L$.

To describe the bound $N(L)$ and its behavior under specialization, we need to introduce some notation from [46] and [45]. Set
\[
E=\bigcup_{r\in \bZ_{>0}} k'[x^{-1/r}]
\]
and let $e\in E$. The \emph{ramification index} $\ram(e)$ of $e$ is the minimal $r$ such that $e\in k'[x^{-1/r}]$. Set $\bar{\de}=x\de$. Then $k'(x)[\de]=k'(x)[\bar{\de}]$, i.e., every operator in $\de$ can be rewritten as an operator in $\bar{\de}$. For $L\in k'(x)[\bar{\de}]$ we set
%   \begin{array}{cccc}
%             S_e:& \bar{\K}(x)[\bar{\pa}] &\longrightarrow & \bar{\K}(x)[\bar{\pa}] \\
%                  &    L  &\longmapsto & L(\bar{\pa}+e).
%   \end{array}
%Suppose that $L\in \bar{\K}(x)[\bar{\pa}]$.
and we consider $S_e(L)$ as an operator in $k'((x^{1/r}))[\bar{\de}]$, where $r=\ram(e)$. We write
S_e(L)=\sum_{i\geq \ell } x^{i/r} N_{i,e,L}(\bar{\de}),
where $N_{i,e,L}\in k'[T]$ (with $T$ a new variable) and $N_{\ell,e,L}\neq 0$. Following \cite[Section~3.4]{vanHoeij:Formalsolutionsandfactorization} $N_{\ell,e,L}$ is called the \emph{Newton polynomial} of $S_e(L)$ at $0$ for slope $0$. Let $m_{e,0}(L)$ be the multiplicity of $0$ in $N_{\ell,e,L}(T)$.  Following \cite[Def. 3.1]{vanHoeij:Factorizationofdifferentialoperatos}, we define the generalized exponents of $L$:

\begin{defi}% \mbox{}
\label{defi:Newton Polynomial at 0}
%\item Following \cite[Section 3.4]{vanHoeij:Formalsolutionsandfactorization} $N_{\ell,e,L}$ is called the \emph{Newton polynomial} of $S_e(L)$ at $0$ for the slope $0$, denoted by $\NP(S_e(L),0)$.
An element $e\in E$ is a \emph{generalized exponent} of $L$ at $0$ if   $m_{e,0}(L)>0$.
\end{defi}
The number $m_{e,0}(L)$ is called the \emph{multiplicity} of $e$ in $L$.
By (3.3) on page 542 of [45], we have
\begin{equation}
\label{eq:sum of multiplicities}
\sum_{e\in E} m_{e,0}(L)=\ord(L) (=\mu).
\end{equation}
%Any $f\in k'((x^{1/r}))$ can uniquely be written as $f=e+g$, with $e\in k'[x^{-1/r}]$ and $g\in x^{1/r}k'[[x^{1/r}]]$. Following \cite[page 16]{vanHoeij:Formalsolutionsandfactorization}, we call $\mpp(f)=e$ the \emph{principal part} of $f$.

\begin{ex} \label{ex: generalized exponents for Bessel}
Let us determine the generalized exponents for the linear differential operator $L=\de^2+\frac{1}{x}\de+1-(\frac{\alpha}{x})^2\in k'(x)[\de]$ corresponding to Bessel's differential equation, where $\alpha$ is an arbitrary element of $k'$. Rewriting $L$ in terms of $\bar{\de}$, we have
$L=\frac{1}{x^2}\bar{\de}^2+1-(\frac{\alpha}{x})^2$. So, after normalizing (which does not effect the generalized exponents), the relevant operator is $L'=\bar{\de}^2+x^2-\alpha^2$. For $e\in E$ we have
$L'(\bar{\de}-e)=(\bar{\de}-e)^2+x^2-\alpha^2=\bar{\de}^2-2e\bar{\de}-x\de(e)+e^2+x^2-\alpha^2$. Thus, choosing $e\in \{\alpha,-\alpha\}$, we have $L'(\bar{\de}-e)=\bar{\de}^2-2e\bar{\de}+x^2$, which has Newton polynomial $T^2-2eT$. By (\ref{eq:sum of multiplicities}), the generalized exponents of $L$ are $\alpha$ and $-\alpha$. In case $\alpha=0$, the generalized exponent $e=0$ has multiplicity two.
\end{ex}

\begin{rem}
\label{rem:exponentialpart}
Due to Lemma 3.4 of [45], if $\bar{\de}-\bar{u}\in k'((x^{1/r}))[\bar{\de}]$ is a right-hand factor of $L\in k'(x)[\bar{\de}]\subseteq k'((x^{1/r}))[\bar{\de}]$, then $\bar{u}=e+d$, where $e\in k'[x^{-1/r}]$ is a generalized exponent of $L$ at $0$ and $d\in x^{1/r}k'[[x^{1/r}]]$.
\end{rem}

In order to define the generalized exponents at a point $p\in\mathbb{P}^1(k')=k'\cup\{\infty\}$ different from $0$, we introduce (following \cite[Section 3.4]{vanHoeij:Factorizationofdifferentialoperatos}) the $k'$-algebra automorphism
$$l_p: k'(x)[\de] \rightarrow k'(x)[\de]$$ as follows: if $p\in k'$, then $l_p(x)=x+p$ and $l_p(\de)=\de$, otherwise $l_\infty(x)=1/x$ and $l_\infty(\de)=-x^2\de$. Denote $m_{e,p}(L)=m_{e,0}(l_p(L))$.
\begin{defi}
\label{defi:exponential part at p}
If $m_{e,p}(L)>0$, then $e$ is called a \emph{generalized exponent of $L$ at $p$} and $m_{e,p}(L)$ is called the multiplicity of $e$ in $L$ at $p$.
\end{defi}
Since we are only interested in the factors of $L\in k'(x)[\de]$ that are of the form $\de-u$ with $u\in k'(x)$, we only need to consider the generalized exponents $e$ of $L$ with $\ram(e)=1$.
We will next explain how Remark~\ref{rem:exponentialpart} can be used to obtain a possible principal part of $u$ at $p$ from a generalized exponent of $L$ at $p$.

Before proceeding, let us recall some terminology for rational function. The \emph{principal part} of an element $u\in k'(x)$ at $p\in k'$ is $\sum_{i=\ell}^{-1}u_i(x-p)^i$, when $u=\sum_{i=\ell}^\infty u_i(x-p)^i$ is written as an element of $k'((x-p))$. The \emph{residue} $\res_p(u)$ of $u$ at $p$ is $\res_p(u)=u_{-1}$.
The \emph{order} $\ord_p(u)$ of $u$ at $p$ is $\ord_p(u)=-\ell$, where $u_\ell\neq 0$. By convention, $\ord_p(0)=0$.

The residue at infinity is defined as $\res_\infty(u)=\res_0(-\frac{1}{x^2}u(\frac{1}{x}))$, while the order at infinity is $\ord_\infty(u)=\ord_0(u(\frac{1}{x}))$. These definitions are such that the sum of all residues of $u$ is zero (see e.g. \cite[Cor. 4.3.3]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}).
%(see Theorem 4.3 on page 177 of \cite{AltmanKleiman:IntroductiontoGrothendieckDaulityTheory} for example).

The principal part of $u$ at $\infty$ is $\sum_{i=\ell}^1u_ix^{-i}$, when $u=\sum_{i=\ell}^\infty u_ix^{-i}$ is written as an element of $k'((x^{-1}))$. This definition is such that $\res_\infty(u)$ can be determined (as $-u_1$) from the principal part at infinity.

Assume that $e$ is a generalized exponent of $L$ at $p$ with $\ram(e)=1$. We set
\[
\mpp(e,p)=
\begin{cases}
\frac{l_{-p}(e)}{x-p} & \text{ if } p\in k'\\
-\frac{l_\infty(e)}{x} & \text{ if } p=\infty. %\,\,\mbox{and}\,\, \deg(l_\infty(e))>1
\end{cases}
\]
%where $c_0\in k'$ denotes the constant term of $l_\infty(e)\in k'[x]$.

\begin{lemma} \label{lemma: get pp of u}
Let $u\in k'(x)$ be such that $\de-u$ is a right-hand factor of $L$. Then, for every $p\in \mathbb{P}^1(k')$, the principal part of $u$ at $p$ is of the form $\mpp(e,p)$ for some generalized exponent $e$ of $L$ at $p$ with $\ram(e)=1$.
\end{lemma}
\begin{proof}
We write $L=L_1\cdot(\de-u)$, with $L_1\in k'(x)[\de]$. First assume that $p\in k'$. Applying $l_p$ yields
for some $L_2\in k'(x)[\bar{\de}]$.
%$$l_p(\L)=l_p(\bar{R})\cdot (\frac{x+p}{x}\bar{\pa}-(x+p)l_p(u))=\tilde{R}\cdot (\bar{\pa}-xl_p(u)).$$
By Remark~\ref{rem:exponentialpart}, $xl_p(u)=e+d$, where $e\in k'[x^{-1/r}]$ is a generalized exponent of $L$ at $p$ and $d\in x^{1/r}k'[[x^{1/r}]]$. As $xl_p(u)\in k'(x)$, we must have $r=1$, i.e., $\ram(e)=1$.
Applying $l_{-p}$ to $xl_p(u)=e+d$ we find $u=\frac{l_{-p}(e)}{x-p}+\frac{l_{-p}(d)}{x-p}$.
Thus $\frac{l_{-p}(e)}{x-p}$ is the principal part of $u$ at $p$.

Now let us consider the case $p=\infty$.
%This proves the claim for the case $p\in \bar{\K}$. Similarly, one can prove the case $p=\infty$.
We have $$l_\infty(L)=l_\infty(L_1)\cdot(-x^2\de-l_\infty(u))=l_\infty(L_1)\cdot(-x\bar{\de}-\l_\infty(u))=L_2\cdot\big(\bar{\de}-\tfrac{-l_\infty(u)}{x}\big).$$
Therefore, as above, by Remark \ref{rem:exponentialpart}, we have $\frac{-l_\infty(u)}{x}=e+d$, where $e\in k'[x^{-1}]$ is a generalized exponent of $L$ at $\infty$ with $\ram(e)=1$ and $d\in xk'[[x]]$. Applying $(l_\infty)^{-1}=l_\infty$ we obtain $u=-\frac{l_\infty(e)+l_\infty(d)}{x}$. This implies the claim.
\end{proof}
%Remark that if $e$ is a generalized exponential part of $\L$ at $p$ then $p$ is a singular point of $\L$, i.e. $p$ is a pole of some $\lambda_i$.
For $p\in\mathbb{P}^1(k')$ we set
\pp(L,p)=\left\{\mpp(e,p) \mid \mbox{$e$ is a generalized exponent of $L$ at $p$ with $\ram(e)=1$}\right\}.
With $\sing(L)\subseteq k'$ we denote the set of all singular points of $L$, i.e., the elements or $k'$ that are poles of one of the coefficients $\lambda_i$ of $L$.
%%For $f\in \pp(L,p)$, we set $\ord(f)=\deg(h)$, where $h\in k'[T]$ is such that $f=h(\frac{1}{x-p})$ (for $p\in k'$) or $f=h(x)$ (for $p=\infty$).
%??singular points defined where
%Let $B_1\subseteq k'$ be the set of (finite) singular points of $L$ and
Write $\sing(L)\cup \{\infty\}=\{p_1,\dots,p_l\}$ and define
\[
\begin{array}{cccc}
\Phi_L: \pp(L,p_1)\times \dots \times\pp(L,p_l) &\longrightarrow & k' \\
(f_1,\dots,f_l) &\longmapsto & -\sum_{i=1}^l\res_{p_i}(f_i)
\end{array}
\]
N(L)=\sum_{p\in \sing(L)\cup\{\infty\}} \max_{h\in \pp(L,p)} \ord_p(h)+\max \{\{0\}\cup (\im(\Phi_L)\cap \bZ)\}.

\begin{lemma} \label{lemma: exponential bound}
The number $N(L)$ is an exponential bound for $Ly=0$.
\end{lemma}
\begin{proof}
Let $h$ be an exponential solution of $Ly=0$ and set $u=\de(h)/h\in k'(x)$. We have to show that $\deg(u)\leq N(L)$. As $u$ is a solution of the Riccati equation associated with $Ly=0$, it follows from (4.3) on page 107 of [44], that $u$ is of the form
\begin{equation}
\label{eq:formoffactor}
\end{equation}
where $P,Q,R,S\in k'[x]$, $\deg(R)<\deg(S)$, the zeros of $S$ are in $\sing(L)$ and the zeros of $P$ are not in $\sing(L)$.

Note that the partial fraction decomposition of $\frac{\delta(P)}{P}$ is of the form $\sum_{i=1}^m\frac{c_i}{x-\alpha_i}$, with $c_i\in\mathbb{N}$, $c_1+\ldots+c_m=\deg(P)$ and $\alpha_i\in k'\smallsetminus\sing(L)$. The partial fraction decomposition of $\frac{R}{S}$ is a sum of terms of the form $\sum_{i=1}^m\frac{b_i}{(x-\alpha)^i}$ with $b_i\in k'$ and $\alpha\in\sing(L)$. The polynomial $Q$ can be thought of as the contribution at $\infty$.

%From (\ref{eq:formoffactor}), we have $\deg(u)\leq \deg(P)+\deg(Q)+\deg(S)$. It thus suffices to bound the degrees of $P,Q,S$.

By Lemma \ref{lemma: get pp of u} we have

$$\ord_p(u)\leq \max_{h\in \pp(L,p)}\{\ord_p(h)\}$$ for any $p\in\mathbb{P}(k')$.
As $\ord_p(Q+\frac{R}{S})\leq\ord_p(u)$ for $p\in \sing(L)\cup\{\infty\}$, this yields
$\ord_p(Q+\frac{R}{S})\leq \max_{h\in \pp(L,p)}\{\ord_p(h)\}$ for $p\in \sing(L)\cup\{\infty\}$. Thus
\begin{equation} \label{eq: bound for QRS}
\deg(Q+\tfrac{R}{S})\leq\sum_{p\in \sing(L)\cup\{\infty\}}\ord_p(Q+\tfrac{R}{S})\leq \sum_{p\in \sing(L)\cup\{\infty\}} \max_{h\in \pp(L,p)}\ord_p(h).
\end{equation}
To also bound $\deg(P)$, let $B\subseteq k'$ be the set of poles of $u$ that are not in $\sing(L)$. Then $B$ is the set of zeros of $P$. Moreover, $Q$ and $\frac{R}{S}$ have residue zero at any point of $B$.
$$\sum_{p\in B}\res_p(u)=\sum_{p\in B}\res_p(\tfrac{\de(P)}{P})=\deg(P).$$
As $\sing(L)\cup B\cup\{\infty\}$ contains all poles of $u$,
%\rf{Here $\sing(L)\cup B$ seems to be $\sing(L)\cup B\cup \{\infty\}$}
we have
0=\sum_{p\in \sing(L)\cup B\cup\{\infty\}} \res_p(u)=\deg(P)+\sum_{p\in \sing(L)\cup \{\infty\}}\res_p(u).

On the other hand, $\res_p(u)=\res_p(h)$ for some $h\in \pp(L,p)$.
Therefore $\deg(P)\in \im(\Phi_L)\cap\mathbb{Z}$. So $\deg(P)\leq \max\{\{0\}\cup(\im(\Phi_L)\cap\mathbb{Z})\}$.
Combing this with (\ref{eq:formoffactor}) and (\ref{eq: bound for QRS}) yields the claim of the lemma.
%	is the residue of some element of $\pp(L,p)$ by Lemma \ref{lemma: get pp of u}.
%	Suppose that $\pa-u$ is a right hand factor of $\L$ and $e'\in \pp(\L,p)$. If $p$ is a singular point of $\L$, then since $e'$ is a possible principal part of $u$ at $p$,
%	$$\ord_p(u)\leq \max_{e'\in \pp(\L,p)}\{\ord(e')\}.$$
%	This enables us to bound $\deg(Q)$ and $\deg(R)$.
%	If $p$ is a pole of $u$ but not a singular point of $\L$, as $u$ is of the form (\ref{eq:formoffactor}), $p$ is a zero of $P$ and $\res_p(u)$ is a positive integer. This implies that
%	$\deg(P)=\sum \res_p(u)$ where the sum takes over all poles of $u$ which are not singular points of $\L$. Let $B_1$ be the set of singular points of $\L$ and $B_2$ the set of poles of $u$ which are not in $B_1$. Then $B_1\cup B_2$ contains all poles of $u$ and so
%	$$
%	0=\sum_{p\in B_1\cup B_2\cup\{\infty\}} \res_p(u)=\deg(P)+\sum_{p\in B_1\cup \{\infty\}}\res_p(u).
%	$$
%	On the other hand, for $p\in B_1\cup\{\infty\}$, $\res_p(u)$ is the residue of some element in $\pp(\L,p)$. Let
%	\[
%	\begin{array}{cccc}
%	\Phi: \pp(\L,p_1)\times \dots \times\pp(\L,p_l) &\longrightarrow & k' \\
%	(e_1,\dots,e_l) &\longmapsto & -\sum_{i=1}^l\res_{p_i}(e_i)
%	\end{array}
%	\]
%	where $\{p_1,\dots,p_l\}=B_1\cup \{\infty\}$.
%	By $\deg(P)$ lies in the image of
\end{proof}

\begin{ex} \label{ex: N(L) for Bessel}
Let us determine the exponential bound $L(N)$ from Lemma \ref{lemma: exponential bound} for the linear differential operator $L=\de^2+\frac{1}{x}\de+1-(\frac{\alpha}{x})^2\in k'(x)[\de]$ corresponding to Bessel's differential equation. Note that $\sing(L)=\{0\}$.
We already determined the generalized exponents of $L$ at $0$ in Example \ref{ex: generalized exponents for Bessel}. They are $\alpha$ and $-\alpha$. Thus $\pp(L,0)=\{\frac{\alpha}{x},\frac{-\alpha}{x}\}$.

To compute $N(L)$, we also need to determine the generalized exponents at $\infty$. We have $l_\infty(L)=(-x^2\de)^2-x^3\de+1-(\alpha x)^2=x^2\bar{\de}^2+1-(\alpha x)^2$. So, after normalizing, the relevant operator is $L'=\bar{\de}^2+\frac{1}{x^2}-\alpha^2$. For $e\in E$, we have $L'(\bar{\de}-e)=\bar{\de}^2-2e\bar{\de}-x\de(e)+e^2+\frac{1}{x^2}-\alpha^2$. Let $i$ and $-i$ denote the roots of the polynomial $T^2+1$ in $k'$. For $e=\frac{i}{x}-\frac{1}{2}$ we find
$L'(\bar{\de}-e)=\bar{\de}^2-(\frac{2i}{x}-1)\bar{\de}+\frac{1}{4}-\alpha^2$, which has Newton polynomial $2iT$. Similarly, for $e=\frac{-i}{x}-\frac{1}{2}$, one finds the Newton polynomial $-2iT$.
Thus, by (\ref{eq:sum of multiplicities}), the generalized exponents of $L$ at $p=\infty$ are $\frac{i}{x}-\frac{1}{2}$ and $\frac{-i}{x}-\frac{1}{2}$. Therefore $\pp(L,\infty)=\{i+\frac{1}{2x},\ -i+\frac{1}{2x}\}$. The image of $\Phi_L\colon \pp(L,0)\times\pp(L,\infty)\to k'$ is $\{-\alpha-\frac{1}{2},\ \alpha-\frac{1}{2}\}$.

Let us first assume that $\alpha-\frac{1}{2}$ is not an integer. Then $\im(\Phi_L)\cap\mathbb{Z}=\emptyset$ and it follows that $N(L)=1$. More precisely, if $u\in k'(x)$ is a solution of the Riccati equation associated with $Ly=0$ and $u=\frac{\de(P)}{P}+Q+\frac{R}{S}$ is written as in (\ref{eq:formoffactor}), then the proof of Lemma \ref{lemma: exponential bound} shows that $\deg(P)=0$, i.e., $\frac{\de(P)}{P}=0$. Moreover, the only possibilities for $Q+\frac{R}{S}$ are $i+\frac{\alpha}{x},\ -i+\frac{\alpha}{x},\ i-\frac{\alpha}{x},\ -i-\frac{\alpha}{x}$. These are not solutions of the Riccati equation
$$ \de(u)+u^2+\tfrac{1}{x}u+1-(\tfrac{\alpha}{x})^2=0$$
associated with $Ly=0$. Thus, there are no exponential solutions in this case.

Now assume that $\alpha-\frac{1}{2}\in\mathbb{Z}$. Then $\max\{\{0\}\cup (\im(\Phi_L)\cap \mathbb{Z})\}=|\alpha|+\frac{1}{2}$. Therefore $N(L)=|\alpha|+\frac{1}{2}$. In this case there are indeed exponential solutions. The interested reader can find their explicit form in the Appendix of [25].
\end{ex}

%   \pp(\L,\infty)=\left\{\mpp(e,\infty) \mid \begin{array}{c}\mbox{$e$ is a generalized exponential part of $\L$ at $\infty$,}\\
%    \deg(l_\infty(e))>1\end{array}\right\}.

Our next goal is to show that the exponential bound from Lemma \ref{lemma: exponential bound} is well-behaved under specialization. We return to the setup of Notation \ref{notation: setup}.

Let $\L=\de^\mu+\lambda_{\mu-1}\de^{\mu-1}+\ldots+\lambda_0$ be a linear differential operator with $\lambda_0,\ldots,\lambda_{\mu-1}\in \B[x]_f\subseteq K(x)$. So $\L\in K(x)[\de]$
and for any $c\in \X(k)$ we have a linear differential operator
$$\L^c=\de^\mu+\lambda_{\mu-1}^c\de^{\mu-1}+\ldots+\lambda_0^c\in k(x)[\de].$$

\begin{ex}
Let $\B=k[\alpha]$ (with $\alpha$ transcendental over $k$), $f=x$ and $\L=\de^2+\frac{1}{x}\de+1-(\frac{\alpha}{x})^2\in \B_f[\de]$. From Example \ref{ex: N(L) for Bessel} we know that $N(\L)=1$ and $N(\L^c)=1$ for any $c\in\X(k)=k$ with $c-\frac{1}{2}\notin \mathbb{Z}$. On the other hand, $N(\L^c)=|c|+\frac{1}{2}$ in case $c-\frac{1}{2}\in\mathbb{Z}$.
So $N(\L)$ specializes well only on an ad-open subset of $\X(k)$.
\end{ex}

%Then we can think of $\L$ as an element of $\overline{\K}$

%The previous discussion implies that $N$ is an exponential bound of $\L y=0$. Enlarging $\B$ if necessary, we assume that $\B$ contains $B_1$ and all coefficients of the elements in $\pp(\L,p)$ for all $p\in B_1\cup \{\infty\}$.

\begin{prop}
\label{prop: exponential bound}
There exists an ad-open subset $\U$ of $\X(k)$ such that $N(\L^c)=N(\L)$ for all $c\in \U$. In particular, $N(\L)$ is an exponential bound for $\L^c$ for all $c\in\U$.
\end{prop}
\begin{proof}
Enlarging $\B$ if necessary (Remark \ref{rem: extend B}), we may assume that $\sing(\L)\subseteq \B$ and that all coefficients of all generalized exponents at points in $\sing(\L)\cup\{\infty\}$ belong to $\B$.
There exists a nonempty Zariski open subset $\U_1$ of $\X(k)$ such that
%From the above discussion, one sees that there is a nonempty open subset $\U$ of $\X(k)$ such that
for any $c\in \U_1$,
\begin{enumerate}
%\item $\ord(\L)=\ord(\L^c)$;
\item $\sing(\L)^c=\sing(\L^c)$ and $p^c\neq q^c$ for $p,q\in \sing(\L)$ (one can use resultants for this step);
%q$; is the set of all singular points of $\L^c$;
%\item $p^c\neq q^c$ for any $p,q\in B_1$ with $p\neq q$;
\item $\ram(e^c)=\ram(e)$ and $\ord_0(e^c)=\ord_0(e)$ for every generalized exponent $e$ of $\L$ at every point of $\sing(\L)\cup\{\infty\}$;
\item $m_{e^c,p^c}(\L^c)=m_{e,p}(\L)$ for every $p\in \sing(\L)\cup \{\infty\}$ and every generalized exponent $e$ of $\L$ at $p$.
\end{enumerate}
For (iii), note that the units of the ring $\B((x))$ of formal Laurent series over $\B$, are exactly those Laurent series whose lowest nonzero coefficient is a unit in $\B$. So $f$ may not be a unit in $\B((x))$. However, if $a\in\B$ is the lowest nonzero coefficient of $f$, then $f$ is a unit in $\B_{a}((x))$ and therefore $\B[x]_f\subseteq \B_{a}((x))$. It follows that for $p\in\sing(\L)\cup\{\infty\}$ and $e\in \B[x^{-1/r}]$, the operator $S_e(l_p(\L))\in K((x^{1/r}))[\bar{\de}]$ has coefficients in $\B_{a}((x^{1/r}))$. Thus, all that is required to guarantee (iii), is that $c$ does not specialize $a$ or any coefficient of the Newton polynomial of $S_e(l_p(\L))$ for slope $0$ to zero.

Assume that $c\in \U_1$. By (iii), $e^c$ is a generalized exponent of $\L^c$ at $p^c$ with multiplicity $m_{e,p}(\L)$, for every generalized exponent $e$ of $\L$ at $p\in\sing(\L)\cup\{\infty\}$. From formula (\ref{eq:sum of multiplicities}), it follows that every generalized exponent of $\L^c$ at $p^c$ is equal to $e^c$ for some generalized exponent $e$ of $\L$ at $p$. Hence $\pp(\L^c,p^c)=\pp(\L,p)^c$ for every $p\in \sing(\L)\cup\{\infty\}$. Furthermore, $\im(\Phi_{\L^c})=\im(\Phi_{\L})^c$.

In general, $\im(\Phi_\L)^c\cap\mathbb{Z}$ can be larger than $\im(\Phi_\L)\cap\mathbb{Z}$. However, if $\Gamma$ is the subgroup of $\Ga(\B)$ generated by $\{1\}\cup \im(\Phi_\L)$, then $\im(\Phi_\L)^c\cap \bZ=\im(\Phi_\L)\cap \bZ$  for $c\in W_\X(\Ga,\Gamma)$.
Therefore, for $\U$ an ad-open subset of $\U_1\cap W_\X(\Ga,\Gamma)$ and $c\in \U$, we have
$\im(\Phi_{\L^c})\cap\bZ=\im(\Phi_\L)\cap\bZ$ and consequently $N(\L^c)=N(\L)$.
% Denote
%   \begin{array}{cccc}
%    \Phi^c: \pp(\L^c,p_1^c)\times \dots \times\pp(\L^c,p_l^c) &\longrightarrow & k \\
%                     (\bar{e}_1^c,\dots,\bar{e}_l^c) &\longmapsto & -\sum_{i=1}^l\res_{p_i^c}(\bar{e}_i^c).
%    \end{array}
%Then for $c\in \U$, one has that $\img(\Phi^c)=\img(\Phi)^c$. The above discussion implies an exponential bound of $\L^c y=0$ can be chosen to be
%   \sum_{\bar{p}\in \B_1^c\cup \{\infty\}} \max_{\bar{e}\in \pp(\L^c,\bar{p})} \ord(\bar{e})+\max \{\{0\}\cup (\img(\Phi^c)\cap \bZ)\}
%which is equal to $N$ for any $c\in \U\cap \Z(\B,\Gamma)$.
\end{proof}

\subsection{Linear relations}

For a vector $\bfv\in R^\nu$, where $R$ is a Picard-Vessiot ring over a differential field $F$, we set
\linrel(\bfv,F)=\{h\in F[z_1,\dots,z_\nu] \mid \mbox{$h$ is linear homogeneous and $h(\bfv)=0$}\}.
Then $ \linrel(\bfv,F)$ is an $F$-vector space of dimension at most $\nu$; the vector space of linear relations among the entries of $\bfv$.
The main goal of this section is to describe, in the case $F=k(x)$, a bound $N$ such that $\linrel(\bfv,F)$ has a basis consisting of elements of the form $a_1z_1+\ldots+a_\nu z_\nu$, with $a_1,\ldots,a_\nu\in k(x)$ and $\deg(a_i)\leq N$ for $i=1,\ldots,\nu$.

By the cyclic vector lemma, any linear differential system $\de(y)=Ay$, with $A\in k(x)^{m\times m}$ is equivalent to a scalar linear differential equation $Ly=0$ with $L=\de^m+\lambda_{m-1}\de^{m-1}+\ldots+\lambda_0\in k(x)[\de]$, i.e., there
exists a matrix $T\in\Gl_m(k(x))$ such that $\delta(T^{-1})T+T^{-1}AT$ is of the form
\[
\begin{pmatrix}
0& 1& 0 &  &  \\
& \ddots & \ddots & \ddots &  \\
&  & \ 0 & 1 & 0 \\
& &  & 0 & 1\\
-\lambda_0 & -\lambda_1 & \dots & \dots & -\lambda_{\mu-1}
\end{pmatrix}\in k(x)^{m\times m}.
\]
We call such a $T$ a \emph{transformation matrix} from $\de(y)=Ay$ to $Ly=0$. Furthermore, $\deg(T)$ is defined as the maximum of all degrees of entries of $T$.

To a linear differential system $\de(y)=Ay$, with $A\in k(x)^{m\times m}$, one can associate, for every $s=1,\ldots,m$, a new linear differential system $\de(y)=(\bigwedge^s A)y$ with $\bigwedge^s A\in k(x)^{{m\choose s}\times {m \choose s}}$. If one works with differential modules (as in \cite[Section 2.2]{SingerPut:differential}) and $M$ is the differential module associated with $\de(y)=Ay$, then $\bigwedge^sM$ is the differential module associated with $\de(y)=(\bigwedge^sA)y$.

\begin{lemma} \label{lemma: linear relations}
Let $\bfv\in R^\nu$ be a solution of $\de(y)=A'y$, where $A'\in k(x)^{\nu\times \nu}$ and $R/k(x)$ is a Picard-Vessiot ring (not necessarily for $\de(y)=A'y$). Let $s$ be the dimension of the $k(x)$-vector space generated by the entries of $\bfv$ and let $T\in k(x)^{\mu\times\mu}$ $(\mu={ \nu \choose s})$ be a transformation matrix from $\de(y)=(\bigwedge^sA')y$ to $Ly=0$, where $L\in k(x)[\de]$. Furthermore, let $N$ be an exponential bound for $L$.

Then $\linrel(\bfv,k(x))$ has a $k(x)$-basis consisting of elements of the form $a_1z_1+\ldots+a_\nu z_\nu$, with $a_1,\ldots,a_\nu\in k(x)$ and
$\deg(a_i)\leq 2\mu\deg(T)+\mu(\mu-1) N$ for $i=1,\ldots,\nu$.
\end{lemma}
\begin{proof}
%	Let $K$ be a differential field with $k'=K^\de$ algebraically closed, $A\in K^{n\times n}$ and $R/K$ a Picard-Vessiot ring for $\de(y)=Ay$. Let $\bfv=(v_1,\ldots,v_\nu)^t\in R^\nu$ satisfy $\de(y)=A'y$ for some $A'\in K^{\nu\times\nu}$. Set
%	%
%	% $\calS(Y_\gen,m,\overline{\K}(x))$ it suffices to investigate the following vector space
%	$$
%	\tilde{\calS}(\bfv,K)=\{f\in K[z_1,\dots,z_\nu] \mid \mbox{$f$ is linear homogeneous and $f(\bfv)=0$}\}.
%	$$
%	%where $\bfv$ is a solution of $\delta(y)=A y$.
%	%In the following, we fix a nonzero solution $\bfv=(v_1,\dots,v_n)^t$ of $\delta(y)=Ay$ where $v_i\in \R$, the Picard-Vessiot ring of $\delta(y)=AY$ over $\bar{\K}(x)$.
%	Then $ \tilde{\calS}(\bfv,K)$ is a $K$-vector space of dimension at most $\nu$.
%Assume that $\dim_{K}\tilde{\calS}(\bfv,K)=\nu-s$.
Write $\bfv=(v_1,\ldots,v_\nu)^t\in R^\nu$.
Without loss of generality, we may assume that $v_1,\dots,v_s$ are linearly independent over $k(x)$. For $i=s+1,\dots,\nu$, write
\begin{equation} \label{eq: vj}
v_i=\sum_{l=1}^s a_{i,l} v_l, \,\,a_{i,l}\in k(x).
\end{equation}
Set $f_i=z_i-\sum_{l=1}^s a_{i,l}z_l$ for $i=s+1,\dots,\nu$. Then $\{f_{s+1},\dots,f_\nu\}$ is a $k(x)$-basis of $\linrel(\bfv,k(x))$ and our goal is to bound $\deg(a_{i,l})$.
%he degree of the $a_{i,l}$'s in the case that $K=k'(x)$. In other words, we would like to find a bound $N$ (depending on ??) such that $\tilde{\calS}(\bfv,k'(x))$ has a basis consisting of linear homogeneous polynomials in $z_1,\ldots,z_\nu$ with coefficients that are polynomials in $x$ of degree at most $N$.

%Since enlarging $R$ does not change $\tilde{\calS}(\bfv,K)$, we may assume, without loss of generality, that $R$ contains a fundamental solution matrix for $\de(y)=A'y$. In other words, $R$ contains the Picard-Vessiot ring $R'$ for $\de(y)=A'y$.
Let $V$ be the $k$-subspace of $R^\nu$ generated by $\{g(\bfv)|\ g\in G(k)\}$, where $G$ is the differential Galois group of $R/k(x)$. We claim that $\dim_{k}V=s$. Set
$$\operatorname{Rel}(V)=\{(a_1,\ldots,a_\nu)\in k(x)^\nu|\ a_1u_1+\ldots+a_\nu u_\nu=0 \ \forall\ \bfu=(u_1,\ldots, u_\nu)^t\in V\}.$$
From (\ref{eq: vj}) it follows that $u_i=\sum_{l=1}^s a_{i,l} u_i$ for every $(u_1,\ldots, u_\nu)^t\in V$ and $i=s+1,\ldots,\nu$. On the other hand, $v_1,\ldots,v_s$ are $k(x)$-linearly independent. Thus $\operatorname{Rel}(V)$ is a $k(x)$-vector space of dimension $\nu-s$.

We will show (cf. \cite[Prop. 1.5]{BeukersBrownawellHeckman:SiegelNormality}) that also $\dim_{k(x)} \operatorname{Rel}(V)=\nu-\dim_{k}V$. Let $\bfv _1,\ldots,\bfv_r$ be a basis of $V$ and let $\mathbf{V}\in R^{\nu\times r}$ be the matrix with columns $\bfv _1,\ldots,\bfv_r$.
As $\bfv _1,\ldots,\bfv_r$ are solutions of $\de(y)=A'y$, their $k$-linear independence, implies their $E$\=/linear independence, where $E$ is the field of fractions of $R$ (\cite[Lemma 1.7]{SingerPut:differential}).
Thus there exists an $r\times r$-submatrix $\mathbf{W}\in\Gl_r(E)$ of $\mathbf{V}$. As $g\in G(k)$ acts on $\mathbf{V}$ and $\mathbf{W}$ via right multiplication with a matrix in $\Gl_r(k)$, we see that $\mathbf{V}\mathbf{W}^{-1}$ is fixed by $g$. So $\mathbf{V}\mathbf{W}^{-1}\in k(x)^{\nu\times r}$ by the differential Galois correspondence. We have
$$\operatorname{Rel}(V)=\{\mathbf{a}\in k(x)^\nu|\ \mathbf{a}\mathbf{V}=0\}=\{\mathbf{a}\in k(x)^\nu|\ \mathbf{a}\mathbf{V}\mathbf{W}^{-1}=0\}.$$
Since $\mathbf{V}\mathbf{W}^{-1}\in k(x)^{\nu\times r}$ has linearly independent columns, we see that $\dim_{k(x)}\operatorname{Rel}(V)=\nu-r$. Therefore $r=s$, i.e., $\dim_{k}V=s$ as claimed.

Let $\bfv _1,\ldots,\bfv_s$ be a $k$-basis of $V$.
%In particular, we can find $s$ ($\leq \nu$) $K^\de$-linearly independent solutions $\bfw_1,\dots,\bfw_s\in R^\nu$ of $\de(y)=A'y$.
For a vector or a matrix $\bfw$, denote by $\bfw^{(i)}$ the $i$-th row of $\bfw$.
% Assume that $\bfw_1,\dots,\bfw_s$ be $s$ solutions of $\delta(y)=Ay$ which are linearly independent over $\bar{\K}$.
For $I=(i_1,\dots,i_s)$ with $1\leq i_1<i_2<\dots<i_s\leq \nu$, set $\bfv_{I}=\det((\bfv_j^{(i_l)})_{1\leq l,j\leq s})$. A calculation, that is probably best understood by using the exterior power of the associated differential module (\cite[Lemma 2.27]{SingerPut:differential}), shows that
\begin{equation} \label{eq: exterior}
\delta(\bfv_I)=\sum_{\substack{J=(j_1,\dots,j_s)\\ 1\leq j_1 <j_2<\dots<j_s\leq \nu}} b_{I,J} \bfv_J,
\end{equation}
where  $b_{I,J}\in k(x)$ and $\bigwedge^s A'=(b_{I,J})\in k(x)^{\mu\times\mu}$.
That is, the vector $(\bfv_I)_I\in R^{\mu}$ is a solution of $\delta(y)=(\bigwedge^s A') y$.
% In particular, let $V$ be the vector space spanned by the image of $\bfv$ under the action of the Galois group. Then $\dim_{\bar{\K}(x)}(V)=s$. We take $\bfv_1,\dots,\bfv_s$ to be a basis of $V$.
We extend the definition of the $a_{i,l}$'s from (\ref{eq: vj}) to all values of $l\in\{1,\ldots,\nu\}$ by
1 \text{ if } i=l,\\
0 \text{ otherwise}
\end{cases}
for $i=1,\ldots,s$ and $l=1,\ldots,s$. Then $(\ref{eq: vj})$ is true for all values of $i$ and so
$\bfv_j^{(i)}=\sum_{l=1}^sa_{i,l}\bfv_j^{(l)}$ for $i=1,\ldots,\nu$ and $j=1,\ldots,s$, or in matrix form
$$\Big(\bfv_j^{(i)}\Big)_{1\leq i\leq \nu \atop 1\leq j\leq s}=\Big(a_{i,j}\Big)_{1\leq i\leq \nu \atop 1\leq j\leq s}\Big(\bfv_j^{(i)}\Big)_{1\leq i\leq s \atop 1\leq j\leq s}.$$
For $I=(i_1,\dots,i_s)$ with $1\leq i_1<i_2<\dots<i_s\leq \nu$, we thus have
\begin{equation} \label{eq: fo exterior}
\bfv_I=c_I \bfv_{(1,2,\dots,s)},
\end{equation}
with $c_I=\det((a_{i_l,j})_{1\leq l,j\leq s})\in k(x)$. In particular,
\begin{equation}
\label{eq:coefficients}
1 & \text{ for } I=(1,2,\dots,s), \\
(-1)^{s-j}a_{i,j} & \text{ for } I=(1,\dots,j-1,j+1,\dots,s,i),
\end{cases}
\end{equation}
where $1\leq j \leq s$ and $s<i\leq \nu$.
%	Therefore, in order to bound the degree of $a_{i,j}$'s (in case $K=k'(x)$), it suffices to bound the degree of the vector $(c_I)_I\in K^{\nu\choose s}$.
%	To this end, we introduce the following definition.
%	\begin{defi}
%		\label{defi:exponentialsols}
%		A nonzero element $h$ of a Picard-Vessiot ring $R/K$ is \emph{exponential over $K$} if $\delta(h)/h\in K$. A vector $\bfw\in R^m$ is \emph{exponential over $K$} of it is of the form $\bfw=h\tilde{\bfw}$ with $h\in R$ exponential over $K$ and $\tilde{\bfw}\in K^m$.
%		%
%		%solution $\bfv$ of $\delta(y)= Ay$ is said to be exponential over $\bar{\K}(x)$ if $\bfv$ is the product of an exponential element over $\bar{\K}(x)$ and a vector with entries in $\bar{\K}(x)$.
%	\end{defi}
%	The reader is referred to Section 4.1 of [44] for more background on exponential solutions and their computation.
From (\ref{eq: exterior}) and (\ref{eq: fo exterior}) it follows that $\bfv_{(1,2,\dots,s)}\in R$ is exponential over $k(x)$, i.e., $\de(\bfv_{(1,2,\dots,s)})/\bfv_{(1,2,\dots,s)}\in k(x)$.
%	 and  so $(\bfv_I)_I=\bfv_{(1,2,\dots,s)}(c_I)_I\in R^{\nu \choose s}$ is an exponential solution of $\delta(y)=(\bigwedge^s A') y$. By the cyclic vector lemma, the linear differential system $\delta(y)=(\bigwedge^s A') y$ over $K$, is equivalent to a (scalar) linear differential equation
%	$$
%	\L y=\pa^\mu y+\sum_{i=0}^{\mu-1} \lambda_i \pa^iy=0
%	$$
%	over $K$, where $\mu={\nu \choose s}$. In other words, there exists a matrix $T\in \Gl_{\mu}(K)$, such that $\delta(T^{-1})T+T^{-1}(\bigwedge^s A)  T$ is of the form
%	\[
%	\begin{pmatrix}
%	0& 1& 0 &  &  \\
%	& \ddots & \ddots & \ddots &  \\
%	&  & \ 0 & 1 & 0 \\
%	& &  & 0 & 1\\
%	-\lambda_0 & -\lambda_1 & \dots & \dots & -\lambda_{\mu-1}
%	\end{pmatrix}\in K^{{\nu \choose s}\times {\nu \choose s}}.
%	\]
%where $\lambda_i\in \bar{\K}(x)$ and $\mu={n \choose s}$, i.e.

As $T$ transforms $\de(y)=(\bigwedge^s A')y$ into $Ly=0$, the solution $(\bfv_I)_I\in R^\mu$ of $\de(y)=(\bigwedge^s A')y$ is transformed to a vector $T^{-1}(\bfv_I)_I=(h,\de(h),\ldots,\de^{\nu-1}(h))^t\in R^\nu$ with  $L(h)=0$. As $h=\bfv_{(1,2,\dots,s)}c$ with $c\in k(x)$, we see that in fact $h$ is an exponential solution of $L(y)=0$. Write $\de(h)=r_1h$ with $r_1\in k(x)$. Then also $\de^i(h)=r_i h$ with $r_i\in k(x)$ for $i=1,\ldots,\mu-1$. So
T^{-1}(\bfv_I)_I=h\begin{pmatrix} 1 \\ r_1 \\ \vdots \\ r_{\mu-1} \end{pmatrix} \quad \text{ or } \quad  (\bfv_I)_I=hT\begin{pmatrix} 1 \\ r_1 \\ \vdots \\ r_{\mu-1} \end{pmatrix} .
The last equation implies $\bfv_{I}=hT^{(I)}(1,r_1,\ldots,r_{\mu-1})^t$, where $T^{(I)}$ denotes the $I$-th row of $T$.
%where $h$ is an exponential solution of $\L y=0$ and $r_i$ is an element in $\bar{\K}(x)$ satisfying $\delta^i(h)=r_ih$.
Combining this with (\ref{eq: fo exterior}) and (\ref{eq:coefficients}) yields
\begin{equation} \label{eq: formula for aij}
(-1)^{s-j} a_{i,j}=\frac{T^{(I)}\begin{pmatrix}1 \\ \vdots \\ r_{\mu-1} \end{pmatrix}}{T^{((1,2,\dots,s))}\begin{pmatrix}1 \\ \vdots \\ r_{\mu-1} \end{pmatrix}},
\end{equation}
where $I=(1,\dots,j-1,j+1,\dots,s,i)$.
%	From now on we assume that $K=k'(x)$ with $k'$ algebraically closed.
%	 Recall that the \emph{degree} of a nonzero rational function $a=\frac{f}{g}\in k'(x)$ with $f,g,\in k'[x]$ relatively prime, is defined as $\deg(a)=\max\{\deg(f),\deg(g)\}$. By convention, $\deg(0)=-\infty$.

We claim that $\deg(r_i)\leq i\deg(r_1)$ for $i=1,\ldots,\mu-1$. Indeed, writing $r_1=\frac{f_1}{g}$ with $f_1,g\in k[x]$ relatively prime, we will show by induction on $i$, that $r_i=\frac{f_i}{g^i}$ with $f_i\in k[x]$ and $\deg(f_i)\leq i\deg(r_1)$. We have
So $\deg(f_{i+1})=\deg(\de(f_i)g-if_i\de(g)+f_if_1)\leq (i+1)\deg(r_1).$

Recall that the degree of a rational function satisfies $\deg(a_1a_2)\leq \deg(a_1)+\deg(a_2)$ and $\deg(a_1+a_2)\leq \deg(a_1)+\deg(a_2)$ for $a_1,a_2\in k(x)$. % Moreover, $\deg(\de(a))\leq 2\deg(a)$ for $a\in k'(x)$.
%We let $\deg(T)$ denote the maximum of the degrees of all entries of $T$.
From $\deg(r_i)\leq i\deg(r_1)$, we obtain
$$\deg(T^{(I)}(1,r_1,\ldots,r_{\mu-1})^t)\leq\sum_{i=0}^{\mu-1}(\deg(T)+i\deg(r_1))\leq \mu\deg(T)+\tfrac{\mu(\mu-1)}{2}\deg(r_1).$$
%One has that $\deg(P_{i+1})\leq \max\{ \deg(P_i)+\deg(Q)-1,\deg(P_i)+\deg(P_1)\}\leq \deg(P_i)+\deg(r_1)\leq (i+1)\deg(r_1)$. This implies that $\deg(r_{i+1})\leq (i+1)\deg(r_1)$.
%Note that $\deg(r_i)\leq i\deg(r_1)=i\deg(\delta(h)/h)$ and
Using (\ref{eq: formula for aij}), we find
\begin{equation}
\label{eq:degreeboundforaij}
\deg(a_{i,j})\leq 2\mu \deg(T)+\mu(\mu-1) \deg(r_1).
\end{equation}

As $r_1=\de(h)/h$, with $h$ an exponential solution of $Ly=0$, this implies the claim of the lemma.
%	%where $\mu={n\choose s}$.
%	 So, to bound the degree of the $a_{i,j}$'s, it suffices to bound the degree of $\frac{\delta(h)}{h}$, where $h$ is an exponential solution of $\L y=0$.
\end{proof}

\begin{prop}
\label{prop:uniform bound for vector spaces}
Let $\bfv\in \R^\nu$ be such that $\bfv^\gen\in (R^\gen)^\nu$ is a solution of $\delta(y)=\mathcal{A'}y$, with $\cA'\in K(x)^{\nu\times \nu}$. Then there exists a positive integer $N$ and an ad-open subset $\U$ of $\X(k)$ such that for every $c\in \U$ the following holds: If $\m_c$ is a maximal $\de$\=/ideal of $R^c$ and $\overline{\bfv^c}\in (R^c/\m_c)^\nu$ is the image of $\bfv^c$ in $R^c/\m_c$, then
the $k(x)$-vector space $\linrel(\overline{\bfv^c},k(x))$ has a basis consisting of elements of the form $a_1z_1+\ldots+a_\nu z_\nu$, with $a_1,\ldots,a_\nu\in k(x)$ and $\deg(a_i)\leq N$ for $i=1,\ldots,\nu$.
%satisfying that the coefficients of each element in $\bB_c$ are of degree not greater than $N$, where $\m_c$ is a maximal $\delta$-ideal of $\R_c$.
\end{prop}
\begin{proof}
For $s=1,\dots,\nu$, let $\L_s \in K(x)[\de]$ be a monic differential operator, equivalent to $\delta(y)=(\bigwedge^s\cA')y$ and let $T_s\in \Gl_{{\nu\choose s}}(K(x))$ be a corresponding transformation matrix. Enlarging $\B$ if necessary (Remark \ref{rem: extend B}), we can assume that $\cA'$, $T_s$ and $\L_s$ $(1\leq s\leq \nu)$ have coefficients in $\B[x]_{fg}$, where $g\in \B[x]$ is a monic polynomial. So, for a nonempty Zariski open subset $\U'$ of $\X(k)$, the matrix $T_s^c$ lies in $\Gl_{{\nu\choose s}}(k(x))$ and is a transformation matrix from $\de(y)=(\bigwedge^s \cA')^cy=(\bigwedge^s\cA'^c)y$ to $\L_s^cy=0$. Note that  $\bfv^c$ is a solution of $\de(y)=\cA'^cy$ for every $c\in\X(k)$.

By Proposition~\ref{prop: exponential bound}, for each $s=1,\dots,\nu$, there exists an ad-open subset $\U_s$ of $\X(k)$ such that $N(\L_s)$ is an exponential bound for $\L_s^c y=0$ for any $c\in \U_s$.
Note that $\dim_{k(x)}\linrel(\overline{\bfv^c},k(x))$ is not greater than $\nu$ for any $c\in\X(k)$. It thus follows from Lemma \ref{lemma: linear relations} that
N=\max_{1\leq s\leq \nu} \left\{ 2{\nu\choose s}\deg(T_s)+{\nu\choose s}\left({\nu\choose s}-1\right) N(\L_s) \right\}
$$ and $\U$ any ad-open subset of $\U'\cap \U_1\cap\ldots\cap\U_s$ have the required property.
\end{proof}

\subsection{Algebraic relations}

We are now prepared to prove the main result of Appendix A.

\begin{theo}
\label{theo:basisunderspecialization}
%Let $\Y$ be a fundamental matrix of $\delta(y)=Ay$ over $\bar{\K}(x)$ and $\R=\B[x]_f[\Y,\frac{1}{\det(\Y)}]$.
%Assume that $\calS(Y,m,\bar{\K}(x))$ has a basis $\bff\subseteq \B[x,X]$.

For any $c\in\X(k)$, let $\m_c$ be a maximal $\de$-ideal of $R^c$ and let $\overline{Y^c}\in \Gl_n(R^c/\m_c)$ denote the image of $Y^c$ in $R^c/\m_c$.
Let $f_1,\ldots,f_r\in \B[x][X]$ be a $K(x)$\=/basis of $\algrel(Y^{\gen},m,K(x))$.
Then there exists an ad-open subset $\U$ of $\X(k)$ such that $f_1^c,\ldots,f_r^c$ is a $k(x)$\=/basis of $\algrel(\overline{Y^c},m,k(x))$
for any $c\in \U$.
% $\bff^c$ is a basis of $\calS(Y_c+\m_c,m,k(x))$ where $\m_c$ is a maximal $\delta$-ideal of $\R_c$.
\end{theo}
\begin{proof}
We first show that there exists an ad-open subset $\U_1$ of $\X(k)$ such that
\begin{equation} \label{eq: bound dim}
\dim_{k(x)}\algrel(\overline{Y^c},m,k(x))\leq  \dim_{K(x)}\algrel(Y^{\gen},m,K(x))
\end{equation}
for every $c\in\U_1$.

%We first show that there is a basic open subset $\U_1$ of $\X(k)$ such that for any $c\in \U_1$, the dimension of $\calS(Y_c+\m_c,m,k(x))$ is equal to the dimension of $\calS(\Y,m,\bar{\K}(x))$ as vector spaces.
Let $\bfm_1,\ldots,\bfm_s$ denote all monomials in $X$ of degree at most $m$ (so $s={n^2+m \choose m}$)
%As in the discussion of the beginning of this appendix, let $\mathcal{A}'\in \B[x]_f^{\nu\times\nu}$ be such that
and let $\nu$ be the dimension of the $K(x)$-vector space generated by $\bfm_1(Y^\gen),\ldots,\bfm_s(Y^\gen)$ (inside $R^\gen$).
We may assume, without loss of generality, that $\bfm_1(Y^\gen),\ldots,\bfm_\nu(Y^\gen)$ are $K(x)$-linearly independent.

%Then $\bfv=(\bfm_1(\Y),\ldots,\bfm_\nu(\Y))^t\in \R^\nu$ is a solution of $\de(y)=\mathcal{A}'y$, for an appropriate $\cA'\in \B[x]_f^{\nu\times\nu}$.
%For $c\in\X(k)$ let $\overline{\bfv^c}\in R^c/\m_c$ denote the image of $\bfv^c\in R^c$ in $R^c/\m_c$.

%Set $d=\dim_{\overline{\K}(x)}\calS(Y_\gen,m,\overline{\K}(x))$ and let
%$\bfm_1(Y_\gen),\dots,\bfm_s(Y_\gen)$ be a basis of the $\overline{\K}(x)$-vector space spanned by all monomials in $Y_\gen$ with degree at most $m$. So $d={n^2+m\choose m}-s$.

% $\bfm_1(\overline{Y^c}),\dots,\bfm_s(\overline{Y^c})$ are $k(x)$-linearly independent for any $c\in \U_1$.
% Note that $(\bfm_1(Y_\gen),\dots,\bfm_s(Y_\gen))^t\in R^s_\gen$ is a solution of $\de(y)=By$ for some $B\in \overline{\K}(x)^{\nu\times \nu}$.

As $\de(Y^\gen)=\cA Y^\gen$, the vector $(\bfm_1(Y^\gen),\ldots,\bfm_s(Y^\gen))^t\in (R^\gen)^s$ is a solution of $\de(y)=\cA_1y$ for some $\cA_1\in K(x)^{s\times s}$. Since $\bfm_i(Y^\gen)$ $(\nu+1\leq i \leq s)$ can be expressed as a $K(x)$-linear combination of $\bfm_1(Y^\gen),\ldots,\bfm_\nu(Y^\gen)$, it follows that the vector $(\bfm_1(Y^\gen),\ldots,\bfm_\nu(Y^\gen))^t$ is a solution of $\de(y)=\cA'y$ for some $\cA'\in K(x)^{\nu\times\nu}$.
Set $\bfv=(\bfm_1(\Y),\ldots,\bfm_\nu(\Y))^t\in \R^\nu$.
% and let
%$\U$ and $N$ be as in Proposition \ref{pr}
% $\widetilde{\bfv^c}=(\bfm_1(\widetilde{Y^c}),\ldots,\bfm_\nu(\widetilde{Y^c}))^t\in (R^c/\widetilde{\m_c})^\nu$ denote the image of $\bfv^c$ in $R^c/\widetilde{\m_c}$.

By Proposition \ref{prop:uniform bound for vector spaces} there exists a positive integer $N$ and an ad-open subset $\U'$ of $\X(k)$ such that for every $c\in \U'$ the following  holds: If $\widetilde{\m_c}$ is a maximal $\de$-ideal of $R^c$ and $\widetilde{\bfv^c}\in (R^c/\widetilde{\m_c})^\nu$ is the image of $\bfv^c$ in $R^c/\widetilde{\m_c}$, then $\linrel(\widetilde{\bfv^c},k(x))$ has a $k(x)$-basis of the form
$a_1z_1+\ldots+a_\nu z_\nu$ with $a_i\in k(x)$ and $\deg(a_i)\leq N$ for $i=1,\ldots,\nu$.

Recall that the \emph{wronskian} $\operatorname{wr}(h_1,\ldots,h_\mu)$ of elements $h_1,\ldots,h_\mu$ of some differential ring $R$, is defined as the determinant of the wronskian matrix

h_1 & \ldots & h_\mu \\
\de(h_1) & \ldots & \de(h_\mu) \\
\vdots & & \vdots \\
\de^{\mu-1}(h_1) & \ldots & \de^{\mu-1}(h_\mu)
\end{pmatrix}.
The crucial property of the wronskian is that, if $R$ is a field, then $h_1,\ldots,h_\mu$ are $R^\de$-linearly independent if and only if $\operatorname{wr}(h_1,\ldots,h_\mu)$ is nonzero (\cite[Lemma 1.12]{SingerPut:differential}).

Because $\bfm_1(Y^\gen),\dots,\bfm_\nu(Y^\gen)\in R^\gen$ are $K(x)$-linearly independent, the elements
$x^j\bfm_i(Y^\gen)\ (0\leq j \leq \nu N,\ 1\leq i\leq \nu)$ of $R^\gen$ are $K$-linearly independent. Thus their wronskian is nonzero.
Let $w\in \R$ be the wronskian of $x^j\bfm_i(\Y)\ (0\leq j\leq\nu N,\ 1\leq i\leq \nu)$.
By Lemma \ref{lemma: nonzero extends}, there exists a nonempty Zariski open subset $\U''$ of $\X(k)$ such that $w^c\in R^c$ is nonzero for every $c\in \U'$. Therefore, by Lemma \ref{lemma: max de ideals dense}, there exists, for every $c\in \U''$, a maximal $\de$-ideal $\widetilde{\m_c}$ of $R^c$ such that $w^c\notin\widetilde{\m_c}$. Let $\widetilde{Y^c}\in\Gl_n(R^c/\widetilde{\m_c})$ denote the image of $Y^c$ in $R^c/\widetilde{\m_c}$. As the image of $w$ in $R^c/\widetilde{\m_c}$ is nonzero for every $c\in\U''$, the family  $x^j\bfm_i(\widetilde{Y^c})\ (0\leq j\leq\nu N,\ 1\leq i\leq\nu)$ is $k$-linearly independent.

We claim that $\bfm_1(\widetilde{Y^c}),\ldots,\bfm_\nu(\widetilde{Y^c})$ are $k(x)$-linearly independent for every $c\in \U'\cap \U''$. Suppose this is not the case. Then $\linrel(\widetilde{\bfv^c},k(x))$ is nonzero for some $c\in\U'\cap\U''$. By the choice of $N$ and $\U'$ above, there exist $a_1,\ldots,a_\nu\in k(x)$ with $\deg(a_i)\leq N$ and $a_1\bfm_1(\widetilde{Y^c})+\ldots+a_\nu \bfm_\nu(\widetilde{Y^c})=0$. Clearing denominators, we find that the family $x^j\bfm_i(\widetilde{Y^c})\ (0\leq j\leq\nu N,\ 1\leq i\leq\nu)$ is $k$-linearly dependent; a contradiction.

Thus $\bfm_1(\widetilde{Y^c}),\ldots,\bfm_\nu(\widetilde{Y^c})\in R^c/\widetilde{\m_c}$ are $k(x)$-linearly independent. Since $\dim_{k(x)}\algrel(\overline{Y^c},m,k(x))$ does not depend on the choice of the maximal $\de$-ideal $\m_c$ of $R^c$, we obtain (\ref{eq: bound dim}) with $\U_1$ an ad-open subset of $\U'\cap \U''$.

As $f_i(Y^\gen)=0$, also $f_i^c(Y^c)=(f_i(\Y))^c=0$ for $i=1,\ldots,r$ and $c\in\X(k)$. So $f_1^c,\ldots,f_r^c\in \algrel(\overline{Y^c},m,k(x))$ for any $c\in\X(k)$.

The $K(x)$-linear independence of $f_1,\ldots,f_r\in \B[x][X]$ can be expressed through the non-vanishing of determinants. Thus, there exists a nonempty Zariski open $\U_2$ of $\X(k)$ such that $f_1^c,\ldots,f_r^c\in k(x)[X]$ are $k(x)$-linearly independent for any $c\in \U_2$. Combining this with (\ref{eq: bound dim}), we see that, for $c\in \U_1\cap\U_2$, equality holds in (\ref{eq: bound dim}) and that $f_1^c,\ldots,f_r^c$ is a $k(x)$-basis of $\algrel(\overline{Y^c},m,k(x))$.
We can thus choose $\U$ as any ad-open subset of $\U_1\cap\U_2$.
%Thus $\bfm_1(\widetilde{Y^c}),\ldots,\bfm_\nu(\widetilde{Y^c})$ are $k(x)$-linearly independent for every $c\in \U'\cap \U''$ and so $\dim_{k(x)}\algrel(\widetilde{Y^c},m,k(x))\leq \dim_{\overline{\K}(x)}\algrel(Y_\gen,m,\overline{\K}(x))$
%  $\bfv=(\bfm_1(\Y),\dots,\bfm_\nu(\Y))^t\in \R^\nu$
% Then $\bfv$ is a nonzero solution of $\delta(y)=B y$ for some $B\in \Mat_s(\bar{\K}(x))$ which can be constructed via $A$. By Proposition~\ref{cor:uniform bound for vector spaces}, there is an integer $N$ and a basic open subset $\VV$ of $\X(k)$ such that for every $c\in \VV$, $\linrel(\overline{\bfv}^c,k(x))$ has a basis consisting of elements of the form $a_1z_1+\ldots+a_\nu z_n$ with $a_i\in k(x)$ and $\deg(a_i)\leq N$ for $i=1,\ldots,\nu$.
% We claim that $\bfm_1(\widetilde{Y^c}),\ldots,\bfm_\nu(\widetilde{Y^c})\in R^c/\widetilde{\m_c}$ are $k(x)$-linearly independent. Suppose, for a contradiction, that there is a nontrivial dependence relation, i.e., $\linrel(\widetilde{\bfv^c},k(x))\neq \{0\}$. Because $c\in \mathcal{V}$, there exists $a_1,\ldots,a_\nu\in k(x)$ not all zero such that $\deg(a_i)\leq N$ for $i=1,\ldots,\nu$ and $a_1\bfm_1(\widetilde{Y^c})+\ldots+a_\nu\bfm_\nu(\widetilde{Y^c})=0$. Clearing denominators if necessary, we obtain polynomial $b_1,\ldots,b_\nu\in k[x]$ of degree at most $\nu N$ and a nontrivial dependence relation
% $b_1\bfm_1(\widetilde{Y^c})+\ldots+b_\nu\bfm_\nu(\widetilde{Y^c})=0$. In other words, the elements $x^j\bfm_i(\widetilde{Y^c}),\ (1\leq i\leq \nu N,\ 1\leq i\leq \nu)$ are $k$-linearly dependent; a contraction.
% satisfying that the coefficients of each element in $\bB_c$ are of degree not greater than $N$. Denote $H=\{x^j \bfm_i(\Y)\mid \forall\, 0\leq j\leq s N, 1\leq i \leq s\}$. Since $\bfm_1(\Y),\dots,\bfm_s(\Y)$ are linearly independent over $\bar{\K}(x)$, $H$ is linearly independent over $\bar{\K}$. Therefore the Wronskian determinant $D(\Y)$ of $H$ is nonzero. Let $q\in k$ be a regular point of $\delta(y)=Ay$. Then $\R$ can be embedded into $\bar{\K}[[x-q]]$. Enlarging $\B$ if necessary, we assume that $\phi(\R)\subset \B[[x-q]]$ where $\phi$ is the embedding map. Let $\alpha\in \B$ be such that for each $c\in \Z(\B,\alpha)$, $\det(\phi(\Y))^cD(\phi(\Y))^c\neq 0$ and $q$ is a regular point of $\delta(y)=A_c y$. Then $\phi(\Y)^c$ is a fundamental matrix of $\delta(y)=A_cy$ in $k[[x-q]]$. Suppose that $c\in \VV\cap \Z(\B,\alpha)$. Let $\phi_c$ be the $\delta$-$k(x)$-homomorphism from $\R_c$ to $k[[x-q]]$ given by $\phi_c(Y_c)=\phi(\Y)^c$. Let $M=\ker(\phi_c)$. Then $M$ is a maximal $\delta$-ideal of $\R_c$. Now suppose that $\bfm_1(Y_c+M),\dots,\bfm_s(Y_c+M)$ are linearly dependent over $k(x)$. Note that $\bfv^c+M=(\bfm_1(Y_c+M),\dots,\bfm_s(Y_c+M))^t$.  Then $\tilde{\calS}(\bfv^c+M,k(x)))\neq \{0\}$. The choice of $c$ implies that there are $a_1,\dots,a_s\in k(x)$, not all zero and $\deg(a_i)\leq N$, such that $\sum_{i=1}^s a_i \bfm_i(Y_c+M)=0$. Clearing the denominators of $a_i$ if necessary, we obtain the polynomials $\tilde{a}_i$, not all zero, with $\deg(\tilde{a}_i)\leq sN$ such that $\sum_{i=1}^s \tilde{a}_i\bfm_i(Y_c+M)=0$. In other words, the set $H_c=\{x^j \bfm_i(Y_c+M) \mid \forall\, 0\leq j \leq sN, 1\leq i \leq s\}$ is linearly dependent over $k$. Hence the Wronskian determinant $D(Y_c+M)$ of $H_c$ is zero, i.e. $\phi_c(D(Y_c))=0$. However,
%$$\phi_c(D(Y_c))=D(\phi_c(Y_c))=D(\phi(\Y)^c)=D(\phi(\Y))^c\neq 0,$$ a contradiction. Therefore $\bfm_1(Y_c+M),\dots,\bfm_s(Y_c+M)$ are linearly independent over $k(x)$. Set $\U_1=\VV\cap \Z(\B,\alpha)$. Our claim then follows from the fact that $R_c/M$ and $R_c/\m_c$ are isomorphic. The claim implies that for every $c\in \U_1$,
%$$\dim_{k(x)}(\calS(Y_c+\m_c,m,k(x)))\leq {n^2+m-1\choose m}-s=\dim_{\bar{\K}(x)}(\calS(\Y,m,\bar{\K}(x))).$$
%Obviously, $\bff^c\subset \calS(Y_c+\m_c,m,k(x))$. Let $\beta\in \B$ be such that for any $c\in \Z(\B,\beta)$, $|\bff|=|\bff^c|$ and $\bff^c$ is linearly independent over $k(x)$. Set $\U=\U_1\cap \Z(\B,\beta)$. Then for each $c\in \U$, one sees that $\bff^c$ is a basis of $\calS(Y_c+\m_c,m,k(x))$.
\end{proof}

\section{Appendix B: Specializations of logarithmically independent functions}

%The main goal of this appendix is to show that

\label{sec:specializationsofalgebraicfunctions}
In this appendix, we investigate the behavior of logarithmically independent algebraic functions under specialization.
Our main result is Theorem \ref{theo: main Appendix B}, which, roughly speaking, states that a finite family of logarithmically independent algebraic functions, remains logarithmically independent under many specializations.

%there exists a set $\U$ of specializations such that $f_1,\ldots,f_s$ are logarithmically independent if and only if the specializations $f_1^c,\ldots,f_s^c$ of $f_1,\ldots,f_s$ with respect to $c$ are logarithmically independent for all $c\in \U$. Indeed, $\U$ can be chosen to be the intersection of a $\Ga$-open subset with a Hilbert set.

\subsection{Logarithmic independence via residues}

\label{subsec: logarithmic independence via residues}

The point of this section is to present a criterion from [13] for the logarithmic independence of algebraic functions via differential forms and their residues.
In the following sections we will then show that this criterion is preserved under many specializations.

\medskip

Throughout Section \ref{subsec: logarithmic independence via residues} we make the following assumptions:
\begin{itemize}
\item $K$ is an algebraically closed field of characteristic zero;
\item $F$ is a finite field extension of $K(x)$, i.e., $F/K$ is a function field of one variable;
\item $f_1,\ldots,f_s\in F$.
\end{itemize}

%The goal of this section is to describe a criterion for the logarithmic independence of $f_1,\ldots,f_s$ via differential forms and their residues.

\medskip

Recall (\cite[Def. 4.2.10]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}) that the \emph{residue} $\res_P(\omega)$ of a differential form $\omega$ of $F/K$ at a place $P$ of $F/K$ is defined as
$\res_P(\omega)=a_{-1}\in K$, where $\omega=u\,dt$ with $t\in F$ a uniformizing variable at $P$ and $u=\sum_{i=\ell}^\infty a_it^i$ the $P$-adic expansion of $u\in F$. In other words, $\res_P(\omega)=\res_{P,t}(u)$.

Let $\cP$ be the (finite) set of places of $F/K$ consisting of all poles of the differential forms $f_1dx,\ldots,f_sdx$.

%For  $\q\in \cP$.
% Let $t_\q$ be a uniformizing variable at $\q$ for each $\q\in \cP$.
% For each $i=1,\dots, s$ and each $\q\in \cP$, write
%    f_i\frac{dx}{d t_\q}=\sum_{j\geq \nu} \alpha_{i,j,\q} t_\q^j
%where $\alpha_{i,j,\q}\in K$ and $\nu\in \bZ$.
%%We call $\alpha_{i,-1,\q}$ the residue of $f_idx$ at $\q$, denoted by $\res_\q(f_i dx)$.
Set $\bff=(f_1,\dots,f_s)$ and
\begin{align*}
Z_1(\bff,\cP)&=\left\{(d_1,\dots,d_s)\in \bZ^s\ \bigg|\ \sum_{i=1}^s d_i \res_P(f_idx)\in \bZ\ \forall\,P\in \cP \,\mbox{and}\,
\sum_{P\in\cP}\sum_{i=1}^s d_i \res_P(f_idx)=0\right\},\\
Z_2(\bff,\cP)&=\left\{(d_1,\dots,d_s)\in Z_1(\bff,\cP)\  \big| \ \mbox{$\sum_{P\in \cP} \left(\sum_{i=1}^s d_i \res_P(f_idx)\right) P$ is a principal divisor of $F/K$}\right\}.
\end{align*}
Note that $Z_1(\bff,\cP)$ and $Z_2(\bff,\cP)$ are submodules of $\bZ^s$ and thus are free $\bZ$-modules. Let $\{(e_{1,l},\dots,e_{s,l})\mid l=1,\dots,m\}$ be a basis of $Z_2(\bff,\cP)$ and for $l=1,\ldots,m$ write
$$\sum_{P\in \cP} \left(\sum_{i=1}^s e_{i,l}\res_P(f_idx)\right) P=(h_l) \ \text{ with } \ h_l\in F^\times.
For $l=1,\dots,m$, set
\omega_l=\left(\frac{\delta(h_l)}{h_l}-\sum_{i=1}^s e_{i,l} f_i\right) dx.

%Note that
%Then $\omega_l$ is a 1-form without simple pole. For $l=1,\dots,m$, write
%\frac{\delta(h_l)}{h_l}-\sum_{i=1}^s e_{i,l}f_i=\frac{1}{q}\left(\sum_{i=1}^\mu \sum_{j=1}^{[F:K(x)]} \beta_{i,j,l} x^i \eta^j\right)
%where $q\in K[x]$ is monic and $\beta_{i,j,l}\in K$. Denote
%M_{i,j}(\{\omega_l\})=\left\{(d_1,\dots,d_m)\in \bZ^m \mid \sum_{l=1}^m d_l\beta_{i,j,l}=0\right\}.
%From the proof of Proposition 2.4 of [13], one has the following lemma.??
\begin{lemma}
\label{lemma:logarithmicderivative}
The elements $f_1,\dots,f_s$ are logarithmically independent over $F$ if and only if $\omega_1,\dots,\omega_m$ are $\mathbb{Z}$-linearly independent.
In particular, if $Z_2(\bff,\cP)=0$, then $f_1,\dots,f_s$ are logarithmically independent over $F$.

% over $\bZ$, i.e. $\cap_{i,j} M_{i,j}(\{\omega_l\})=\{0\}$.
\end{lemma}
\begin{proof}
The proof of this lemma is contained in the proof of \cite[Prop. 2.4]{CompointSinger:ComputingGaloisGroupsOfCompletelyReducibleDifferentialEquations}. For the convenience of the reader we include the details.

First assume that $f_1,\ldots,f_s$ are logarithmically independent over $F$. Let $d_1,\ldots,d_m\in\bZ$ be such that $\sum_{l=1}^md_l\omega_l=0$. By definition of $\omega_l$, this implies $\sum_{l=1}^md_l\frac{\de(h_l)}{h_l}=\sum_{l=1}^m\sum_{i=1}^sd_le_{i,l}f_i$. For $h=\prod_{l=1}^mh_l^{d_l}\in F^\times$, we thus have $$\tfrac{\de(h)}{h}=\sum_{l=1}^md_l\tfrac{\de(h_l)}{h_l}=\sum_{i=1}^s\left(\sum_{l=1}^md_le_{i,l}\right)f_i.$$
The logarithmic independence of $f_1,\ldots,f_s$ implies that $\sum_{l=1}^md_le_{i,l}=0$ for $i=1,\ldots,s$.
The $\bZ$-linear independence of the $(e_{1,l},\dots,e_{s,l})$'s thus yields $d_1=\ldots=d_m=0$ as desired.

\medskip

Conversely, assume that $\omega_1,\ldots,\omega_m$ are $\bZ$-linearly independent. Let $d_1,\ldots,d_s\in\bZ$ and $h\in F^\times$ be such that $\frac{\de(h)}{h}=\sum_{i=1}^sd_if_i$. We will show that $(d_1,\ldots,d_s)\in Z_2(\bff,\cP)$. First note that the differential form $\frac{\de(h)}{h}dx=\frac{dh}{h}$ has only simple poles and the residues are all integers. In fact, the residue at a place $P$ of $F/K$ is the $P$-valuation of $h$. (This can, for example, be deduced from \cite[Prop. 4.2.7]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}.)
So $\sum_{i=1}^sd_i\res_P(f_idx)=\res_P(\sum_{i=1}^sd_if_idx)=\res_P(\frac{dh}{h})\in\mathbb{Z}$ for every place $P$ of $F/K$ and
where the sum is taken over all places of $F/K$. However, since $\res_P(\sum_{i=1}^sd_if_idx)=0$, unless $P$ is a pole of one of the forms $f_idx$, the sum can be restricted to $P\in\cP$. As principal divisors have degree zero (\cite[Theorem 1.4.11]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}), we see that $(d_1,\ldots,d_s)\in Z_1(\bff,\cP)$ and also $(d_1,\ldots,d_s)\in Z_2(\bff,\cP)$. Therefore, there exist $c_1,\ldots,c_m\in\mathbb{Z}$ such that $d_i=\sum_{l=1}^mc_le_{i,l}$ for $i=1,\ldots,s$.
%	$$(d_1,\ldots,d_s)=c_1(e_{1,1},\ldots,e_{s,1})+\ldots+c_m(e_{1,m},\ldots,e_{s,m})$$
%	with $c_1,\ldots,c_m\in\bZ$.
\begin{align*}
\sum_{l=1}^mc_l\omega_l &=\sum_{l=1}^mc_l\omega_l-\Big(\tfrac{\delta(h)}{h}-\sum_{i=1}^s d_if_i\Big)dx= \\
\end{align*}
By construction, the differential forms $\omega_l$ have no simple poles; so $\sum_{l=1}^mc_l\omega_l$ has no simple pole. On the other hand, $\frac{d(h^{-1}\prod_{l=1}^mh_l^{c_l})}{h^{-1}\prod_{l=1}^mh_l^{c_l}}$ has only simple poles. This is only possible if $\sum_{l=1}^mc_l\omega_l=0$.

Now the $\mathbb{Z}$-linear independence of the $\omega_l$'s yields that all $c_l$'s are zero. Hence also all $d_i$'s are zero and the $f_i$'s are logarithmically independent as desired.
\end{proof}

The following example illustrates Lemma \ref{lemma:logarithmicderivative}

\begin{ex} \label{ex: get elleptic curve}
Let $F=K(x,z)$ with $z^2=x^4+x+\alpha$ and $\alpha\in K$.
We assume that the discriminant $256\alpha^3-27$ of $x^4+x+\alpha$ is nonzero so that $x^4+x+\alpha$ has four distinct roots $\alpha_3,\alpha_4,\alpha_5,\alpha_6$ in $K$. % We also assume that $\alpha^3\neq \frac{27}{256}$ so that the projective curve $C'\subseteq \mathbb{P}^2_K$ defined by the affine equation $z^2=x^4+x+\alpha$
Let $\beta\in K$ with $\beta^4+\beta+\alpha\neq 0$. Set $b=\frac{(x-\beta)^2}{x^4+x+\alpha}=(\frac{x-\beta}{z})^2$ and $\eta=\frac{x-\beta}{z}$. We will investigate the logarithmic independence of $f_1=b+\eta$ and $f_2=b-\eta$.
%$$f_1=b+\eta \quad \text{ and } \quad f_2=b-\eta.$$
(This choice of $f_1,f_2$ is motivated by Example \ref{ex: elements for logarithmic test}.)

We first need to find the set $\cP$ of poles of $f_1dx$ and $f_2dx$. Note that the projective curve $C'\subseteq \mathbb{P}^2_K$ defined by the affine equation $z^2=x^4+x+\alpha$ has a singularity at infinity.

The transformation
$$ x=-\tfrac{v+1}{2u},\quad  z=(\tfrac{v+1}{2u})^2-\tfrac{u}{2}$$
yields a smooth model $C\subseteq \mathbb{P}_K^2$ defined by the affine equation $v^2=u^3-4\alpha u+1$. The inverse transformation is given by
$$ u=2(x^2-z), \quad v=-4(x^2-z)x-1.$$
These transformations yield an isomorphism between $C\smallsetminus\{(0:1:1), (0:1:0)\}$ and $C'\smallsetminus\{(0:1:0)\}$. The singular point $(0:1:0)$ of $C'$ has two preimages in $C$, namely $(0:1:1)$ and  $(0:1:0)$.
%Using Maple, we can find a smooth model and the corresponding birational transformations.
%Let $C\subseteq \mathbb{P}^2_K$ be the projective curve defined by the affine equation
%	 $v^2+u^3-4\alpha u-1=0$.
%	 \mw{In \cite[Example 4.1 (ii)]{Zannier:ICM2014} the true Weierstrass form (with the signs right) $y^2=x^3-\alpha x+\frac{1}{4}$ is given. Maybe with this equation the birational transforms would look little nicer, but I don't know how to compute them.}
%	  Then $C$ is smooth and birational to $C'$. Fixing a square root $\sqrt{\alpha}$ of $\alpha$ in $K$, the birational transformations are given by
%		$$
%		u=-\frac{2\sqrt{\alpha}z+x+2\alpha}{x^2},\quad  v= -\frac{(4\alpha+x)z+3\sqrt{\alpha}x+4\alpha^{3/2}}{x^3}
%		$$
%		and
%		$$
%		x=-\frac{u+2\sqrt{\alpha}v}{u^2-4\alpha},\quad  z=\frac{\sqrt{\alpha}u^4-16\alpha^{5/2}-u^2v-4\sqrt{\alpha}u-4\alpha v}{(u^2-4\alpha)^2}.
%		$$
The places of $F/K$ are in one-to-one correspondence with $C(K)$.
The inclusion $K(x)\subseteq F$ of function fields corresponds to the morphism
$$C\to \mathbb{P}^1_K,\ (u:v:w)\mapsto (v+w: -2u).$$
% $$C\to \mathbb{P}^1_K,\ (u:v:w)\mapsto (uw+2\sqrt{\alpha}v: 4\alpha w^2-u^2).$$

By the Hurwitz genus formula (\cite[Cor. 3.5.6]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}), this morphism has exactly four ramification points. They are $\alpha_3,\alpha_4,\alpha_5,\alpha_6\in \mathbb{A}^1(K)\subseteq\mathbb{P}^1(K)$. Let $P_3,P_4,P_5,P_6$ denote the (unique) places of $F/K$ extending the places of $K(x)$ corresponding to  $\alpha_3,\alpha_4,\alpha_5,\alpha_6$. The point of $C(K)$ corresponding to $P_i$ is $(2\alpha_i^2:-4\alpha_i^3-1:1)$ for $i=3,\ldots,6$.

For a place $P$ of $F/K$ let $\nu_P$ denote the corresponding valuation on $F$. Similarly, every $p\in K\cup\{\infty\}$ defines a valuation $\nu_p$ on $K(x)$.
For $a\in K(x)$ we have $\nu_{P_i}(a)=2\nu_{\alpha_i}(a)$ for $i=3,\ldots,6$. For any other place $P$ of $F/K$ (i.e., $P\notin\{ P_3,P_4,P_5,P_6\}$) we have $\nu_P(a)=\nu_p(a)$, where $p$ corresponds to the restriction of $P$. With this preparation, one sees immediately that the poles of $b=\frac{(x-\beta)^2}{x^4+x+\alpha}$ are $P_3,P_4,P_5,P_6$ and $\nu_{P_i}(b)=-2$ for $i=3,\ldots,6$.
Because $b=\eta^2$, it follows that the poles of $\eta$ are $P_3,P_4,P_5,P_6$ and $\nu_{P_i}(\eta)=-1$ for $i=3,\ldots,6$.

There are two places $P_1,P_2$ of $F/K$ that restrict to the infinite place of $K(x)$. They correspond to the points $(0:1:0)$ and $(0:1:1)$ of $C(K)$. Then the poles of $x$ are $P_1, P_2$ and $\nu_{P_i}(x)=-1$ for $i=1,2$.

Set $\cP=\{P_1,\ldots,P_6\}$. Then the poles of $bdx$ and $\eta dx$ belong to $\cP$, because outside of $\cP$ neither $b,\eta$ or $x$ has a singularity. As $\nu_{P_i}(\frac{1}{x})=1$ for $i=1,2$ we can use $x^{-1}$ as a uniformizer at $P_1,P_2$. Then $bdx=-bx^2d(x^{-1})$ and so $\nu_{P_i}(bdx)=\nu_{P_i}(-bx^2)=\nu_\infty(-bx^2)=0$. Hence $P_1,P_2$ are not poles of $bdx$.

for $i=3,\ldots,6$, we see that $z$ is a uniformizer at $P_3,P_4,P_5,P_6$.
From $z^2=x^4+x+\alpha$ it follows that $\de(z)=\frac{4x^3+1}{2z}$ and so
$$bdx=\tfrac{(x-\beta)^2 2z}{z^2(4x^3+1)}dz=\tfrac{2(x-\beta)^2}{(4x^3+1)z}dz.$$
Therefore $\nu_{P_i}(bdx)=-1$ for $i=3,\ldots,6$. Thus the poles of $bdx$ are $P_3,P_4,P_5,P_6$.

For $i=1,2$ we have $\nu_{P_i}(b)=2$ and so $\nu_{P_i}(\eta)=1$. It follows that
$$\nu_{P_i}(\eta dx)=\nu_{P_i}(-\eta x^2d(x^{-1}))=\nu_{P_i}(-\eta x^2)=-1$$
for $i=1,2$. So $P_1,P_2$ are poles of $\eta dx$. On the other hand,
$\eta dx=\frac{2\eta z}{4x^3+1}dz$ and so $\nu_{P_i}(\eta dx)=0$ for $i=3,\ldots,6$.
So the poles of $\eta dx$ are $P_1,P_2$.

In summary, we see that the poles of $f_1dx$ as well as of $f_2dx$ are exactly $\cP$.

\medskip

%		Let $I$ be the homogenous ideal in $K[u,v,w]$ generated by
%		$$
%		T=v^2w+u^3-4\alpha uw^2-w^3.
%		$$
%		Then $C=\operatorname{Proj}(K[u,v,w]/I)$ is an irreducible and smooth projective curve with $F$ as its rational function field.

%		 Now let us investigate the poles of $b dx$ and $\eta dx$. Note that  $b=(x-\beta)^2/(x^4+x+\alpha)$ and $\eta=(x-\beta)/z$. There are two places of $F/K$ lying above $1/x$, say $q_1,q_2$. As $z=\pm x^2\sqrt{1+1/x^3+\alpha/x^4}$, one can take $1/x$ to be a uniformizing variable at $q_i$ with $i=1,2$. From this, one sees that the places $q_1,q_2$ correspond to the points  $(-2\sqrt{\alpha}:-1:1)$ and $(2\sqrt{\alpha}:1:1)$ in $C(K)$ respectively. Let $\alpha_1,\dots,\alpha_4$ be all distinct roots of $x^4+x+\alpha=0$ in $K$. For each $\alpha_i$, there is exactly one place of $F/K$ lying above $x-\alpha_i$, say $q_{i+2}$. Since $z^2=(x-\alpha_i)\prod_{j\neq i}(x-\alpha_j)$, one can take $z$ to be a uniformizing variable at $q_i$ for all $i=3,\dots,6$. Furthermore, we have that $q_i$ corresponds to
%		$$
%		\left(-\frac{\alpha_i+2\alpha}{\alpha_i^2}, -\frac{3\sqrt{\alpha}\alpha_i+4\alpha^{3/2}}{\alpha_i^3},1\right)\in C(K).
%		$$
%		These $q_i$ are all possible poles of $bdx$ or $\eta dx$, because $q_1,q_2$ are all poles of $x$ and the poles of $b$ or $\eta$ must be the poles of $x$ or zeros of $x^4+x+\alpha$. Because $\ord_{q_i}(bdx)=0$ for $i=1,2$, none of $q_1,q_2$ is a pole of $b dx$. On the other hand, as $\ord_{q_i}(bdx)=-1$, all of $q_3,\dots,q_6$ are poles of $bdx$.

%\rf{$4\alpha_i^3+1$ is much simpler.}

We next compute the residues. As $\nu_{P_i}(x-\alpha_i)=2$ for $i=3,\dots,6$, the $P_i$-adic expansion of $x-\alpha_i$ is of the form  $c_iz^2+\dots$ with $c_i\in K^\times$. Substituting $x=\alpha_i+c_iz^2+\dots$ we find
%		$$
%		z^2=(c_iz^2+\dots)\prod_{j\neq i}(\alpha_i-\alpha_j+c_iz^2+\dots)=\left(\prod_{j\neq i}(\alpha_i-\alpha_j)c_i \right)z^2 (1+\dots).
%		$$
%		This implies that $c_i=\frac{1}{\prod_{j\neq i}(\alpha_i-\alpha_j)}$, i.e., $x=\alpha_i+\frac{1}{\prod_{j\neq i}(\alpha_i-\alpha_j)}z^2+\dots$ is the $P_i$-adic expansion $x$. Now
bdx=\tfrac{2(x-\beta)^2}{(4x^3+1)z}dz=\tfrac{2(\alpha_i-\beta+c_iz^2+\dots)^2}{4(\alpha_i+c_iz^2+\ldots)^3+1}\tfrac{1}{z}dz=\left ( \tfrac{2(\alpha_i-\beta)^2}{4\alpha_i^3+1}\tfrac{1}{z}+\dots\right)dz.
Therefore $\res_{P_i}(bdx)=\frac{2(\alpha_i-\beta)^2}{4\alpha_i^3+1}$ for $i=3,\dots,6$. We next compute $\res_{P_i}(\eta dx)$ for $i=1,2$.

As $\nu_{P_i}(z^2)=\nu_{P_i}(x^4+x+\alpha)=-4$, we see that $\nu_{P_i}(z)=-2$ for $i=1,2$. So the $P_i$-adic expansion of $z$ is of the form $z=c_i(x^{-1})^{-2}+\ldots$ with $c_i\in K^\times$ for $i=1,2$. We have
$$\eta dx=-\eta x^2d(x^{-1})=\tfrac{-(x-\beta)x^2}{z}d(x^{-1})=\tfrac{-(x^{-1})^{-3}+\beta(x^{-1})^{-2}}{c_i(x^{-1})^{-2}+\ldots}d(x^{-1})$$
and so $\res_{P_i}(\eta dx)=-c_i$.
% i.e., $\res_{P_1}(\eta dx)=-1$ and $\res_{P_2}(\eta dx)=-1$.

Plugging $z=c_i(x^{-1})^{-2}+\ldots$ into $z^2=x^4+x+\alpha$ we find $(c_i(x^{-1})^{-2}+\ldots)^2=(x^{-1})^{-4}+\ldots$ and so $c_i\in\{1,-1\}$ for $i=1,2$. Note that we cannot have $c_1=c_2$ because, otherwise $\frac{z}{x^2}$ and $\frac{1}{x}$ would be rational functions on $C$ that take the same value in $k$ on $P_1$ and $P_2$ and $F=K(\frac{z}{x^2},\frac{1}{x})$.
To find the exact value of $c_i$ we can evaluate $\frac{z}{x^2}=1-\frac{2u^3}{(v+1)^2}$ at the point $(0:1:1)$ corresponding to $P_2$. This yields $c_2=1$ and so $c_1=-1$. Thus $\res_{P_1}(\eta dx)=1$ and $\res_{P_2}(\eta dx)=-1$.

% So, without loss of generality, we assume that $c_1=1$ and $c_2=-1$.

%		As to $\eta dx$, one can verify that none of $q_i, i=3,\dots,6$ is a pole of $\eta dx$ and $\ord_{q_i}(\eta dx)=-1$ for $i=1,2$.
%		Furthermore, for $i=1,2$, the $q_i$-adic expansion of $z$ is of the from $x^2(1+\dots)$ or $-x^2(1+\dots)$. Without loss of generality, we may assume that $x^2(1+\dots)$ is the $q_1$-expansion of $z$ and $-x^2(1+\dots)$ is the $q_2$-expansion. A direct calculation yields that
%Then, for $i=1,2$ we have
%$$\eta dx=-\eta x^2d(x^{-1})=\tfrac{-(x-\beta)x^2}{z}d(x^{-1})=\tfrac{-(x^{-1})^{-3}+\beta(x^{-1})^{-2}}{c_i(x^{-1})^{-2}+\ldots}d(x^{-1})$$
%and so $\res_{P_i}(\eta dx)=-c_i$, i.e., $\res_{P_1}(\eta dx)=-1$ and $\res_{P_2}(\eta dx)=-1$.

With this information at hand we can now calculate
$$Z_1((f_1,f_2),\cP)=\left\{(d_1,d_2)\in \bZ^2\ \bigg|\ \sum_{i=1}^2 d_i \res_P(f_idx)\in \bZ\ \forall\,P\in \cP \,\mbox{and}\,
\sum_{P\in\cP}\sum_{i=1}^2 d_i \res_P(f_idx)=0\right\}.$$
Note that for $P_i $ ($i=3,\ldots,6$), the first condition is $(d_1+d_2)\frac{2(\alpha_i-\beta)^2}{4\alpha_i^3+1}\in\mathbb{Z}$, whereas for $P_1,P_2$ the first condition is vacuous, because $\res_{P_i}(f_j)\in\mathbb{Z}$ for $i=1,2$.
There indeed exist $\alpha,\beta\in K$ such that $\frac{2(\alpha_i-\beta)^2}{4\alpha_i^3+1}\in\mathbb{Q}$ for $i=3,\ldots,6$, for example, $\alpha=0$ and $\beta=\frac{1}{2}$.

r=\prod_{i=3}^6 \frac{(\alpha_i-\beta)^2}{4\alpha_i^3+1}.
A direct calculation shows that
$ Thus, the first condition mentioned above, implies that $r\in \bQ$ if $d_1+d_2\neq 0$.
%\mw{It seems hard to imagine that $\frac{2(\alpha_i-\beta)^2}{4\alpha_i^3-1}$ can be rational for all $i=3,\ldots, 6$ but it is not clear to me how to rule this out completely.}
%\rf{As you suggested, I replaced $\frac{(\alpha_i-\beta)^2}{4\alpha_i^3+1}$ by $\frac{(\beta^4+\beta+\alpha)^2}{256\alpha^3-27}$.}
Assume that $r\notin\mathbb{Q}$. Then
$$Z_1((f_1,f_2),\cP)=\{(-d,d)\in\mathbb{Z}^2|\ d\in\mathbb{Z}\}$$
and for $(-d,d)\in Z_1((f_1,f_2),\cP)$ we have
%\rf{Thanks. There should be a "2".}
$$\sum_{P\in \cP} \left(\sum_{i=1}^2 d_i \res_P(f_idx)\right) P=-2dP_1+2dP_2=2d(P_2-P_1)$$ and so
$$Z_2((f_1,f_2),\cP)=\{(-d,d)\in\mathbb{Z}^2|\ 2d(P_2-P_1) \text{ is a principal divisor of } F/K\}.$$

Recall (see e.g., \cite[Prop. 6.1.6]{Stichtenoth:AlgebraicFunctionFieldsAndCodes}) that the choice of a point of $C(K)$ defines a bijection between the degree zero divisor class group $\operatorname{Cl}^0(F/K)$ and $C(K)$. As usual, we choose the point to be $(0:1:0)\in C(K)$. Thus the point $(0:1:0)$ corresponding to $P_1$ is the neutral element of the group $C(K)$. Then $2d(P_2-P_1)$ is principal, i.e., equal to zero in $\operatorname{Cl}^0(F/K)$, if and only if $2d(0:1:1)=0$ in $C(K)$.
Therefore $Z_2((f_1,f_2),\cP)$ is trivial if and only if the point $(0,1)$ is not a torsion point of the elliptic curve $v^2=u^3-4\alpha u+1$.
In this case $f_1,f_2$ are logarithmically independent over $F$ by Lemma~\ref{lemma:logarithmicderivative}. It is not easy to exactly determine the values of $\alpha$ for which $(0,1)$ is a torsion point, but this question will be further discussed in Example \ref{ex: need Jac-open}.

%If $P_2-P_1$ does not define a torsion element in the divisor class group of $F/K$, then $Z_2((f_1,f_2),\cP)=0$ and so $f_1,f_2$ are logarithmically independent over $F$ by Lemma~\ref{lemma:logarithmicderivative}.

If $(0,1)$ is a torsion point, then
a basis of $Z_2((f_1,f_2),\cP)$ is given by $e_1=(-e,e)$, where $2e$ is the order of $(0,1)$ in $C(K)$. One can then write $2e(P_2-P_1)=(h_1)$ with $h_1\in F^\times$. In this case, $f_1,f_2$ are logarithmically independent if and only if
$$\tfrac{\de(h_1)}{h_1}-(-e)f_1-ef_2=\tfrac{\de(h_1)}{h_1}+2e\eta$$ is nonzero.
The latter questions will also be further discussed in Example \ref{ex: need Jac-open}.
% only one $\omega_1$ needs to
%%		$$
%%		\eta dx=\frac{x-\beta}{\pm x^2(1+\dots)}(-x^2) d\frac{1}{x}=(\pm x+\dots) d \frac{1}{x}.
%%		$$
%%		Then we have that $\res_{q_1}(\eta dx)=-1$ and $\res_{q_2}(\eta dx)=1$.
%		The discrimant of $x^4+x+\alpha$ is $256\alpha^3-27$ which is equal to $\prod_{1\leq i<j\leq 4}(\alpha_i-\alpha_j)^2$. Set
%		$$
%		\B'=\B[\alpha_1,\dots,\alpha_4,\frac{1}{(256\alpha^3-27)\alpha}]
%		$$
%		and let $\cI$ be the ideal in $\B'[u,v,w]$ generated by $T$. Since $T$ is monic viewed as a polynomial in $u$, one can verify that $\cI=I\cap \B'[u,v,w]$. So $\cI$ is a homogeneous prime ideal such that $I=\cI\otimes_{\B'}K$ and $\mathcal{C}=\operatorname{Proj}(\B'[u,v,w]/\cI)$ is an integral scheme. Suppose that $c\in\X'(k)$ where $\X'=\spec(\B')$. Then $T^c$ is irreducible over $k$ and thus
%		$$
%		F^c=k(x)[Z]/(Z^2-X^4-X-\alpha^c)=\B'[x]_f[z]\otimes_{\B'[x]_f} k(x).
%		$$
%		We also have that all fibres $C^c$ of $\mathcal{C}\rightarrow \spec(\B')$ are irreducible curves. The discriminant of $u^3-4\alpha u-1$ is also $256\alpha^3-27$. Hence the disciminant of $u^3-4\alpha^c u-1$ does not vanish. This implies that $C^c$ is smooth. Furthermore, using the birational map described above, one sees that $C^c$ has $F^c$ as its function field. We see that all $q_i$ are in $\mathcal{C}(\B')$, all $\res_{q_i}(bdx), \res_{q_i}(\eta dx)$ are in $\B'$ and all $q_i^c$ are distinct. Since $\alpha_1^c,\dots,\alpha_4^c$ are distinct, a direct computation implies that $1/x$ is a uniformizing variable at $q_i^c$ with $i=1,2$, and $z^c$ is a uniformizing variable at $q_i^c$ with $i=3,4,5,6$. Furthermore, we have that the $q_i^c$ are all possible poles of $b^c dx$ or $\eta^c dx$, and $(\res_{q_i}(bdx))^c=\res_{q_i^c}(b^c dx), (\res_{q_i}(\eta dx))^c=\res_{q_i^c}(\eta^c dx)$ for all $i$. Set $\cP=\{q_1,\dots,q_6\}$ and
%		$$
%		Z_1(\cP)=\{(d_1,d_2)\in \bZ^2 \mid \sum_{i=1}^2 d_i\res_p (f_idx)\in \bZ, \forall p\in \cP\,\,\mbox{and}\,\, \sum_{p\in \cP}\sum_{i=1}^2 d_i\res_p (f_idx)=0 \}.
%		$$
%		Then $Z_1(\cP)=\{(m,-m)\mid m\in \bZ\}$ and for each $(m,-m)\in Z_1(\cP)$,
%		$$
%		\sum_{p\in \cP} \left(\sum_{i=1}^2 m \res_p (f_idx)\right)p=m(q_2-q_1).
%		$$
%		From Example 2.4 of [50] and Proposition 12.1 of [51], $q_2-q_1$ is not a torsion in the Jacobian $J_C$ of $C$ but there are infinitely many $r \in k$ such that if $\alpha^c=r$ then $q_2^c-q_1^c$ is a torsion in $J_{C^c}$. Let $\mathcal{V}$ be the set of $c\in \X'(k)$ such that $q_2^c-q_1^c$ is not a torsion in $J_{C^c}$. Then $\mathcal{V}$ is an ab-open set. From the proof of Theorem~\ref{theo: main Appendix B}, for each $c\in\mathcal{V}$, $f_1^c, f_2^c$ are logarithmically independent and thus $R^c$ is Picard-Vessiot. On the other hand, there are infinitely many $c\in \X'(k)$ such that $R^c$ is not Picard-Vessiot. To see this, let $c\in \X'(k)$ be such that $q_2^c-q_1^c$ is a torsion in $J_{C^c}$, i.e. $m_c(q_2^c-q_1^c)=(h_c)$ for some nonzero integer $m_c$ and $h_c\in F^c$. We see that both $\left(\frac{m_c x}{\sqrt{x^4+x+r}}-\frac{\delta(h_c)}{h_c}\right)dx$ and $\frac{dx}{\sqrt{x^4+x+r}}$ are differentials with no poles, where $r=\alpha^c$. Since the dimension of the vector space spanned by all differentials with no poles which is equal to the genus of $C$ is one, there is $s \in k$ such that
%		$$
%		\frac{m_c x}{\sqrt{x^4+x+r}}-\frac{\delta(h_c)}{h_c}-\frac{s}{\sqrt{x^4+x+r}}=0.
%		$$
%		Among the set of $c\in \X'(k)$ with $\alpha^c=r$, we take $c\in \X'(k)$ to be such that $\alpha^c=r$ and $\beta^c=s/m_c$. Such $c$ exists because
%		$$
%		\X'=\spec(\B')=\spec(k[\alpha,\alpha_1,\dots,\alpha_4,\frac{1}{\alpha (256\alpha^3-27)}])\times_{\spec(k)} \spec(k[\beta])
%		$$ For such $c$, the above equality implies that
%		$$
%		m_c(f_1^c-f_2^c)=m_c \eta^c=m_c\left(\frac{x}{\sqrt{x^4+x+r}}-\frac{s/m_c}{\sqrt{x^4+x+r}}\right)=\frac{\delta(h_c)}{h_c}.
%		$$
%		In other words, for such $c$, $f_1^c, f_2^c$ are logarithmically dependent and thus $R^c$ is not Picard-Vessiot.
\end{ex}

\subsection{Divisors under specialization}
\label{subsec: Divisors under specialization}

To show that the criterion for the logarithmic independence from the previous section is preserved under many specializations, we need to show that principal divisors and residues are preserved under many specializations. %We also show that the $\mathbb{Z}$-modules $Z_1$ and $Z_2$ are preserved under many specializations.

%\subsection{New section with ab-open subsets} \label{subsec: new}

\medskip

Throughout Section \ref{subsec: Divisors under specialization} we make the following assumptions:

\begin{itemize}
\item $k$ is an algebraically closed field of characteristic zero;
\item $\B$ is a finitely generated $k$-algebra that is an integral domain;
\item $\X=\spec(\B)$;
\item $K$ is the algebraic closure of the field of fractions of $\B$;
\item $F/K$ is a function field of one variable, i.e., a finitely generated field extension of transcendence degree one.
\end{itemize}

Let $C$ be a smooth projective model of the function field $F/K$, i.e., $C$ is a smooth projective (irreducible) curve over $K$ with function field $F$. We fix a closed embedding of $C$ into $\mathbb{P}^n_K=\operatorname{Proj}(K[x_0,\ldots,x_n]).$ So $C$ is defined by a homogeneous prime ideal $I$ of $K[x_0,\ldots,x_n]$. Enlarging $\B$ if necessary, we can assume that $I$ is generated by homogeneous polynomials with coefficients in $\B$, and so $\mathcal{I}=I\cap \B[x_0,\ldots,x_n]$ is a homogeneous prime ideal of $\B[x_0,\ldots,x_n]$ such that $\mathcal{I}\otimes_\B K=I$ in $\B[x_0,\ldots,x_n]\otimes_\B K=K[x_0,\ldots,x_n]$.

Set $\mathcal{C}=\operatorname{Proj}(\B[x_0,\ldots,x_n]/\mathcal{I})$, i.e., $\mathcal{C}$ is the closed subscheme of $\mathbb{P}^n_\B$ defined by $\mathcal{I}$. Then $\mathcal{C}$ is an integral scheme of finite type over $k$, projective over $\X$. Since $(\B[x_0,\ldots,x_n]/\mathcal{I})\otimes_\B K=K[x_0,\ldots,x_n]/I$, we have $\mathcal{C}\times_\X\spec(K)=C$. Thus the generic fibre of $\mathcal{C}\to \X$ is smooth, geometrically irreducible and of dimension one. These three properties are generic properties. (For geometric irreducibly see \cite[\href{https://stacks.math.columbia.edu/tag/0559}{Tag 0559}]{stacks-project}, for fibre dimension see \cite[\href{https://stacks.math.columbia.edu/tag/05F7}{Tag 05F7}]{stacks-project} and for smoothness see \cite[Prop. 17.7.11]{Grothendieck:EGAIV4}.) Thus there exists a non-empty open subset $\U$ of $\X$ such that for every $u\in\U$, the fibre $\mathcal{C}_u$ over $u$ is a smooth geometrically irreducible curve (over the residue field at $u$). Hence, replacing $\B$ with a localization of $\B$ if necessary, we may (and henceforth do) assume that $\mathcal{C}_u$ is a smooth geometrically irreducible curve for all $u\in \X$. In line with our notation for specializations, we set
$C^c=\mathcal{C}_c$ for $c\in \X(k)\subseteq \X$. Note that, concretely, $C^c\subseteq \mathbb{P}^n_k$ is the closed subscheme defined by the homogeneous polynomials obtained by applying $c$ to a set of homogeneous generators of $\mathcal{I}$.

Throughout Section \ref{subsec: Divisors under specialization} we assume that $\mathcal{C}$ is as described above. In particular, $\mathcal{C}\subseteq\mathbb{P}_\B^n$ is an integral scheme of finite type over $k$, projective over $\X$ and all fibres $C^c\subseteq\mathbb{P}^n_k$ are smooth, irreducible curves.

In the sequel we will usually identify the places of $F/K$ with $C(K)$ (and similarly for $k(C^c)/k$ and $C^c(k)$). The discrete valuation on $F/K$ (or $k(C^c)/k$) corresponding to a point (respectively place) $P$ is denoted $\nu_P$.

For every $c\in\X(k)$ we have a specialization map
$$\mathcal{C}(\B)\to C^c(k),\ P\mapsto P^c,$$
where $P^c\colon\spec(k)\to\mathcal{C}\times_\X \spec(k)$ is such that the composition of $P^c$ with the projection to $\mathcal{C}$ is the composition of $\spec(k)\xrightarrow{c}\X$ with $P\colon\X\to \mathcal{C}$.

A rational function $h$ on $\mathcal{C}$ yields a rational function $h^\gen$ on $C$ via the projection $C=\mathcal{C}\times_\X\spec(K)\to \mathcal{C}$. Note that $h^\gen$ is well-defined because
for a non-empty open subset $\U$ of $\mathcal{C}$, the inverse image $\U\times_\X\spec(K)$ of $\U$ under the projection $\mathcal{C}\times_\X\spec(K)\to \mathcal{C}$ is nonempty, since the generic point of $\U$ and the point of $\spec(K)$ map to the generic point of $\X$.

Roughly speaking, the following lemma shows that principal divisors are preserved under specialization on a non-empty Zariski open. We think this lemma is well-known to the experts, but we were not able to locate a suitable reference.

\begin{lemma} \label{lemma: principal divisors under specialization}
%	Let $\U$ be a non-empty open subset of $\mathcal{C}$ and $h\in\mathcal{O}_{\mathcal{C}}(\U)$ a regular function on $\U$.
Let $h$ be a non-zero rational function on $\mathcal{C}$ and let $Z_1,\ldots,Z_r$ and $P_1,\ldots,P_s$ be the zeros and poles of $h^\gen$ in $C(K)$. Assume that $Z_1,\ldots,Z_r,P_1,\ldots,P_s\in\mathcal{C}(\B)\subseteq \mathcal{C}(K)=C(K)$. Then there exists a non-empty Zariski open subset $\U$ of $\X(k)$ such that for every $c\in \U$
\begin{itemize}
\item $h$ yields a rational function $h^c$ on $C^c$ via the projection $C^c=\mathcal{C}\times_\X\spec(k)\to \mathcal{C}$;
\item $Z_1^c,\ldots,Z_r^c,P_1^c,\ldots,P_s^c$ are all distinct;
\item $Z_1^c,\ldots,Z_r^c$ is the set of zeros of $h^c$ and $P_1^c,\ldots,P_s^c$ is the set of poles of $h^c$;
\item $\nu_{Z^c_i}(h^c)=\nu_{Z_i}(h^\gen)$ and $\nu_{P^c_i}(h^c)=\nu_{P_i}(h^\gen)$ for all $i$.
\end{itemize}
In particular, if $(h^\gen)=\sum_{i=1}^rd_iZ_i+\sum_{j=1}^se_jP_j$, then $(h^c)=\sum_{i=1}^rd_iZ^c_i+\sum_{j=1}^se_jP^c_j$.
\end{lemma}
\begin{proof}
%	First of all, note that $h^\gen$ is well-defined because for a non-empty open subset $\mathcal{V}$ of $\mathcal{C}$, the inverse image $\mathcal{V}\times_\X\spec(\K)$ of $\mathcal{V}$ under the projection $\mathcal{C}\times_\X\spec(\K)\to \mathcal{C}$ is non-empty since the generic point of $\mathcal{V}$ and the point of $\spec(\K)$ map to the generic point of $\X$.
Assume that $h$ is given by a regular function on an open subset $\VV$ of $\X$. For $h^c$ to be well-defined, we need to know that $\mathcal{V}\times_\X\spec(k)\subseteq \mathcal{C}\times_\X\spec(k)=C^c$ is non-empty.
%This may not be that case  and $c\in \X(k)$ it is possible that $\mathcal{V}\times_\X\spec(k)$ is empty and so $h^c$ would not be well-defined.
Since $\mathcal{V}\to \X$ is a dominant morphism of schemes of finite type over $k$, the image contains a non-empty open subset $\U_1$ by Chevalley's theorem. Then $\mathcal{V}\times_\X\spec(k)$ is non-empty for every $c\in\U_1(k)$ because there is an element of $\mathcal{V}$ mapping to $c\in \X$. This takes care of the first item in the lemma.

For the remaining three items, we choose a linear form $\ell=a_0x_0+\ldots+a_nx_n\in K[x_0,\ldots,x_n]$ such that the hyperplane $H\subseteq\mathbb{P}^n_K$ defined by $\ell=0$ does not contain any of the $Z_i$'s or $P_i$'s. Enlarging $\B$ if necessary, we may assume that $\ell\in \B[x_0,\ldots,x_n]$. In fact, after localizing $\B$ if necessary, we can assume that $(a_0,\ldots,a_n)\in \B^{n+1}$ is a column of an invertible matrix in $\B^{(n+1)\times(n+1)}$. Thus, after a linear change of coordinates on $\mathbb{P}_\B^n$, we can assume that $\ell$ is given by $\ell=x_0$.

Let $\U_0$ be the open subscheme of $\mathbb{P}^n_\B$ where $x_0$ does not vanish. So $\U_0$ can be identified with $\A^n_\B=\spec(\B[x_1,\ldots,x_n])$. Recall (see \cite[Chapter 7, Section d]{Milne:AlgebraicGroupsTheTheoryOfGroupSchemesOfFiniteTypeOverAField} or \cite[Prop.~3.4]{Strickland:FormalSchemesAndFormalGroups}) that a point $P\in\mathbb{P}^n_\B(\B)$, i.e., a morphism $\X\to \mathbb{P}^n_\B$ (over $\B$) can be identified with a submodule $L$ of $\B^{n+1}$ such that $L$ is a direct summand (i.e., there exists a submodule $M$ of $\B^{n+1}$ such that $\B^{n+1}=L\oplus M$) and $L$ is locally free of rank $1$. The point $P$ lies in $\U_0(\B)\subseteq \mathbb{P}^n_\B$ (i.e., $\X\to \mathbb{P}^n_\B$ factors through $\U_0\hookrightarrow \mathbb{P}^n_\B$) if and only if $L$ has a basis vector of the form $(b_0,\ldots,b_n)\in \B^n$ with $b_0=1$. As the $Z_i$'s and $P_i$'s (considered as elements of $\mathbb{P}^n_K(K)$) do not lie in $H(K)$, we see that, after replacing $\B$ with a localization of $\B$, we may assume that all the $Z_i$'s and $P_i$'s (considered as elements of $\mathbb{P}^n_\B(\B)$) lie in $\U_0(\B)$.

Consider the open subscheme $\mathcal{C}_0=\mathcal{C}\cap \U_0$ of $\mathcal{C}$. Then $\mathcal{C}_0$ identifies with a closed subscheme of $\U_0=\A^n_\B$ and the $Z_i$'s and $P_i$'s identify with elements of $\A^n_\B(\B)=\B^n$. On the Zariski open subset of $\X(k)$ where the product of suitable differences of coordinates of the $Z_i$'s and $P_i$'s does not vanish, the elements $Z_1^c,\ldots,Z_r^c,P_1^c,\ldots,P_s^c$ are all distinct.

Let $Z=(z_1,\ldots,z_n)\in \B^n\subseteq K^n$ be one of the $Z_i$'s. Assume that $h^\gen$ has a zero of multiplicity $m\geq 1$ at $Z$, i.e., $m=\nu_Z(h^\gen)$. So $h^\gen$ is contained in the $m$-th power $\m_{C,Z}^m$ of the maximal ideal $\m_{C,Z}$ of the local ring $\mathcal{O}_{C,Z}.$

Let $C_0$ be the open subscheme of $C$ where $x_0$ does not vanish, in other words, $C_0=\mathcal{C}_0\times_\X\spec(K)$. Then $K(C)=K(C_0)$ and $\mathcal{O}_{C,Z}=\mathcal{O}_{C_0,Z}$. As the maximal ideal $\m_{C_0,Z}$ of $\mathcal{O}_{C_0,Z}$ is generated by the images of $x_1-z_1,\ldots,x_n-z_n$, we see that $\m_{C_0,Z}^m$ is generated by the set $M$ consisting of the images of $m$-fold products of elements from $\{x_1-z_1,\ldots,x_n-z_n\}$. So we can write $h^\gen=g_1m_1+\ldots+g_lm_l$ with $g_1,\ldots,g_l\in \mathcal{O}_{C_0,Z}\subseteq K(C_0)$ and $m_1,\ldots,m_l\in M$. Enlarging $\B$ if necessary, we may assume that $g_1,\ldots,g_m$ come from rational functions on $\mathcal{C}$, i.e., $g_i=h_i^\gen$ for some rational function $h_i$ on $\mathcal{C}$ for $i=1,\ldots,m$.

Recall that $k(\B)$ denotes the field of fractions of $\B$. Note that the function field $k(\mathcal{C})$ of $\mathcal{C}$ (considered as a scheme over $k$) agrees with the function field $k(\B)(\mathcal{C}_{k(\B)})$ of $\mathcal{C}_{k(\B)}=\mathcal{C}\times_\X\spec(k(\B))$ (considered as a scheme over $k(\B)$) and the latter is contained in the function field $K(C)$ (considered as a scheme over $K$). In fact, $K(C)=k(\B)(\mathcal{C}_{k(\B)})\otimes_{k(\B)}K$. So the identity $h^\gen=g_1m_1+\ldots+g_lm_l$ that holds in $K(C)$, can be interpreted as an identity
\begin{equation} \label{eq: specialize to get order}
\end{equation} that holds in $k(\mathcal{C})$.

We already observed in the beginning of the proof that a rational function $h$ on $\mathcal{C}$ can be specialized to a rational function $h^c$ on $C^c$ for all $c$ in some non-empty Zariski open subset of $\X(k)$. To specialize (\ref{eq: specialize to get order}), we would like to know that if $h^\gen\in\mathcal{O}_{C_0,Z}$, then $h^c\in\mathcal{O}_{C_0^c,Z^c}$, where $C_0^c$ is the open subscheme of $C^c$ where $x_0$ does not vanish, i.e., $C_0^c=\mathcal{C}_0\times_\X\spec(k)$.

But $h^\gen\in\mathcal{O}_{C_0,Z}$ means that $h$ can locally be described  by a fraction$\frac{a}{b}$ of two polynomials $a,b\in \B[x_1,\ldots,x_n]$ such that $b$ does not vanish at $Z$. Thus, on the Zariski open subset of $\X(k)$, where $b(Z)\in \B$ does not vanish, the rational function $h^c$ is locally described by the fraction $\frac{a^c}{b^c}$ and so $h^c\in\mathcal{O}_{C_0^c,Z^c}$.

Since the maximal ideal $\m_{C_0^c,Z^c}$ of $\mathcal{O}_{C_0^c,Z^c}$ is generated by the images of $x_1-c(z_1),\ldots,x_n-c(z_n)$, the specialization
$h^c=h_1^cm_1^c+\ldots+h^c_lm^c_l$ of (\ref{eq: specialize to get order}) shows that $h^c\in\m_{C_0^c,Z^c}^m$. Therefore $\nu_{Z^c}(h^c)\geq m=\nu_{Z}(h^\gen)$ for all $c$ in a non-empty Zariski open subset of $\X(k)$.

From this inequality for the zeros, we can immediately derive a similar inequality for the poles, because a point is a pole of multiplicity $m$ of a rational function if and only if it is a zero of multiplicity $m$ of the inverse of the rational function. So there exists a non-empty Zariski open subset $\U_2$ of $\X(k)$ such that for all $c\in\U_2$
\begin{itemize}
\item $h^c$ is well-defined;
\item $Z_1^c,\ldots,Z_r^c,P_1^c,\ldots,P_s^c$ are all distinct;
\item  $\nu_{Z_i^c}(h^c)\geq\nu_{Z_i}(h^\gen)$ for $i=1,\ldots,r$; in particular, $Z_1^c,\ldots,Z_r^c$ are zeros of $h^c$;
\item $\nu_{P^c_i}(h^c)\leq\nu_{P_i}(h^\gen)$ for all $i=1,\ldots,s$; in particular, $P_1^c,\ldots,P_s^c$ are poles of $h^c$.
\end{itemize}

Note that the statement of the lemma is trivial in case $h$ is constant (i.e., $h$ lies in $K$) since in that case there are no zeros or poles. We may thus assume that $h$ is not constant. Under this assumption we will now show that
\begin{equation} \label{eq: equality of degrees}
\end{equation}