how to show that there is no definable function from a linearly order set into a stable set? Let $T$ be a complete theory. Assume that $S$ and $A$ are stably embedded sets in $U$ (the monster model). Assume that $A$ is linearly ordered and $S$ is stable. How do I show that there is no definable function $f: A \rightarrow S$ with infinite image? 
I have tried to assume the existence of such function and contradict the fact that $S$ is stable, but somehow I got stuck on the details. Is it obvious? Would it be possible to show in an explicit way which is the formula that has the order property?
 A: The claim is not true. Maybe the intended statement was that there is no injective definable function from an infinite definably linearly ordered set to a stable set?
Here's a counterexample: 
Let $L$ be the two-sorted language with sorts $A$ and $S$, a binary relation symbol $\leq$ on $A$, and a unary function symbol $f\colon A\to S$. Let $K$ be the class of all finite structures in this language in which $\leq$ is a linear order.  Then $K$ is a Fraïssé class. In the Fraïssé limit $M$, $A$ is a dense linear order without endpoints, $S$ is an infinite set, and $f$ is a surjective function such that for all $s\in S$, the set $f^{-1}(\{s\})$ is dense in the order. In particular, $f$ is a definable function with infinite image.
$A$ is stably embedded, because if $X$ is a definable subset of $A$, defined by $\varphi(x,a,s)$, where $a$ is a tuple of parameters from $A$ and $s$ is a tuple of parameters from $S$, we can pick a tuple $s'$ of preimages of $s$ under $f$, and letting $\psi(x,y,z)$ be $\phi(x,y,f(z))$, $X$ is also defined by $\psi(x,a,s')$, which only uses parameters from $A$. 
By quantifier elimination, to check that $S$ is stably embedded, it suffices to check that every atomic formula with parameters from $M$ and variables of sort $S$ is equivalent to one with parameters from $S$. But since there are no relation symbols on $S$ and no function symbols with domain $S$, any such atomic formula which uses both a variable of sort $S$ and parameters from $A$ is just $x = f(a)$, which is clearly equivalent to a formula with parameters (just $f(a)$) from $S$. 
Finally, $S$ is stable, since its induced structure is that of a pure set. By ultrahomogeneity, for any finite $B\subseteq S$, any injective function $h\colon B\to S$ extends to an automorphism of $M$, so there are no definable relations on $S$ other than those definable using equality. 
