Q:

Embedding of countable linear orders into $\Bbb Q$ as topological spaces

Any set $X$ with a linear order has a uniquely associated order topology generated by the open intervals.  That makes it into a linearly ordered topological space (LOTS).
It is also a standard result that any countable linear order is isomorphic as a linear order to a subset of $\Bbb Q$ (uses the fact that $(\Bbb Q, <)$ is a dense linear order).  See for example here.
Now in general there are many ways a linear order can be embedded into $\Bbb Q$.  For example consider these two subsets:
$$A_1=\{0\}\cup\{1/n:n=1,2,\ldots\}$$
$$A_2=\{-1\}\cup\{1/n:n=1,2,\ldots\}$$
They are isomorphic to each other as linear order, and hence have the same intrinsic LOTS topology.  But as topological subspaces of $\Bbb Q$ they are very different.  The first one is compact, and the second one has the discrete topology, but only the first one has its intrinsic LOTS topology match its topology as a subspace of $\Bbb Q$.  So an embedding that makes the subspace and order topologies match is special in a way.
Here is my question:

Given a countable set $X$ with a linear order, is it possible to embed it into $\Bbb Q$ by a linear order isomorphism so that the order topology on $X$ matches the subspace topology from $\Bbb Q$?

Anything you want to add explaining the relationship between the two topologies would be very interesting.  For example one topology always stronger than the other.  And are there some cases for the linear order $X$ where the two topologies always coincide independently of a linear order embedding?

A:

I believe the answer is yes.
Call a subset $A\subseteq \mathbf Q$ well-embedded if the intrinsic and subspace topologies coincide. The basic idea is that the failure of well-embededness is caused by a set of "holes" between elements of $A$ and monotone sequences convergent to them in $A$, and we can upgrade any subset of $\mathbf Q$ to a well-embedded one by "collapsing" the corresponding holes.
Note that the topologies coincide exactly when every point has the same neighbourhoods in both topologies. It is not hard to see that $A$ is well-embedded exactly when for each $a\in A$, if $a$ is neither minimal nor a successor (in $A$), then for every $q<a$ there is some $a'\in A$ such that $q\leq a'<a$, and if it is neither a predecessor nor maximal, then for every $q>a$, there is some $a'$ with $a<a'\leq q$.
Conversely, $A$ is not well-embedded exactly when there is some half-open interval $(a,q]$ such that $a$ is not a predecessor and not maximal in $A$ and $(a,q]\cap A$ is empty, or some half-open interval $[q,a)$ with the corresponding property. Let us call such an interval a bad interval of $A$. Note that every element of a bad interval is also the (closed) endpoint of a bad interval.
Fix any $A\subseteq\mathbf Q$. Write $L=\mathbf Q\setminus \bigcup_I I$, where $I$ ranges over bad intervals. Note that $A\subseteq L$. I claim that $L$ is dense, and so $L'=\mathbf Q+(\mathbf Q\setminus \bigcup_I I)+\mathbf Q$ is dense without endpoints.
Indeed, suppose towards contradiction that $q_1< q_2\in L$ are such that $(q_1,q_2)\cap L$ is empty. Take some $q\in (q_1,q_2)$. Then $q$ is the closed endpoint of a bad interval $(a,q]$ or $[q,a)$. Suppose the former holds (the other case is analogous). Then we cannot have $a<q_1$ (because then $q_1\in (a,q]$) and we cannot have $a>q_1$ (because then $a\in L$ and $q_1<a<q<q_2$, so $a\in L\cap (q_1,q_2)$), so we have $a=q_1$. Since $(q_1,q_2)\cap A=\emptyset$ and  $a=q_1$ is not a predecessor in $A$, $q_2\notin A$. But then $(q_1,q_2]$ is a bad interval, a contradiction.
Note that $L'\cong \mathbf Q$ (because both are countable dense without endpoints). I claim that $A$ is well-embedded in $L'$. Indeed, if $a\in A$ is neither minimal nor a successor and $q<a$, then there is some $q'\in L$ with $q\leq q'<a$, and since the interval $[q',a)$ (in $\mathbf Q$) is not bad, there is some $a'\in [q',a)$, whence $q\leq a'<a$. The other case to consider is analogous, and this completes the proof.
(In fact, I'm pretty sure that if you work just a little bit harder, you can show that a) $L$ already has no endpoints, and b), for any $A\subseteq \mathbf Q$, there is a weakly monotone, piecewise linear $f\colon \mathbf Q\to \mathbf Q$ which is strictly monotone on $A$ and such that $f[A]$ is well-embedded.)

A:

For $a\in X$, say that $a_+$ is a gap if either $a$ is the greatest element of $X$ or $a$ has a successor in $X$.  Similarly, say that $a_-$ is a gap if either $a$ is the least element of $X$ or $a$ has a predecessor in $X$.  Now let $Y$ be the linear order obtained by adding a copy of $\mathbb{Q}$ inside every such gap of $X$ (i.e., if $a_+$ is a gap, we add a copy of $\mathbb{Q}$ immediately after $a$, and if $a_-$ is a gap, we add a copy of $\mathbb{Q}$ immediately before $a$).
I claim the inclusion $i:X\to Y$ is continuous and thus a topological embedding.  Indeed, suppose $y\in Y$ and let $A=i^{-1}(y,\infty)$; we wish to show that $A$ is open in the order topology of $X$ (the case of $i^{-1}(-\infty,y)$ is similar).  If $y\in X$, $A$ is simply equal to the interval $(y,\infty)$ of $X$.  Otherwise, there is an element $a\in X$ such that $y$ is in the copy of $\mathbb{Q}$ in the gap $a_+$ or $a_-$.  In the $a_+$ case, $A$ is equal to the interval $(a,\infty)$ of $X$.  In the $a_-$ case, then $a$ has a predecessor $b$ (or is the least element in which case we set $b=-\infty$), and so $A$ is equal to the interval $(b,\infty)$ of $X$.
Finally, I claim that $Y\cong\mathbb{Q}$.  Clearly $Y$ is countable, so it suffices to show it is dense and has no endpoints.  For density, let $x<y$ in $Y$.  If $x\not\in X$, then we can find an element between $x$ and $y$ in the copy of $\mathbb{Q}$ that $x$ is in, and similarly if $y\not\in X$.  If $x,y\in X$, then either there is an element between them already in $X$, or $x_+$ and $y_-$ are both gaps, in which case $Y$ has elements added in those gaps.  Similarly, if $x\in Y$ then $x$ is not a greatest or least element: this is trivial if $x\not\in X$ since then $x$ is inside a copy of $\mathbb{Q}$, and if $x\in X$ either there are larger and smaller elements already in $X$ or we added them since $x_+$ or $x_-$ was a gap.

Let me also mention that unless the topology of $X$ is discrete, it always has an order-embedding in $\mathbb{Q}$ which is not continuous.  Indeed, since $X$ is not discrete, there is some $a\in X$ such that either $a_+$ or $a_-$ is not a gap; let us suppose $a_+$ is not a gap.  Now take any order-embedding $f:X\to\mathbb{Q}$, and define $g:X\to\mathbb{Q}$ by $g(x)=f(x)$ if $x\leq a$ and $g(x)=f(x)+1$ if $x>a$.  Then $g$ is still an order-embedding, but it is not continuous from the right at $a$.
In fact, there always exists an order-embedding $X\to\mathbb{Q}$ such that the subspace topology on the image of the embedding is discrete.  You can construct such a map by iterating the process above over every non-gap of $X$, but here is a snappier description of essentially the same idea.  Fix an enumeration $(x_n)$ of $X$ and define $f:X\to\mathbb{R}$ by $$f(x)=\sum_{x_n<x}\frac{1}{2^n}+\sum_{x_n\leq x}\frac{1}{2^n}.$$  Then $f$ is an order-embedding, since increasing $x$ makes each sum have more terms.  However, the image of $f$ is discrete, since if $x=x_n$ then $f(y)\leq f(x)-\frac{1}{2^n}$ for all $y<x$ (from the second sum) and $f(y)\geq f(x)+\frac{1}{2^n}$ for all $y>x$ (from the first sum).  Now let $Y=\mathbb{Q}\cup f(X)$; then $f$ can be restricted to an order-embedding $X\to Y$ whose image is still discrete in the order topology of $Y$ (since $Y$ is dense in $\mathbb{R}$).  But $Y$ is a countable dense linear order without endpoints, so $Y\cong\mathbb{Q}$.

