Is the proposition "$A$ is separable and $B \subset A$ then $B$ is separable" in metric spaces true for A, B arbitrary sets?

In the book Linear functional analysis by Rynne and Youngson, Second edition:

THEOREM 1.43.

Suppose that $$(M, d)$$ is a metric space and $$A \subset M$$.

(a) If $$A$$ is compact then it is separable.

(b) If $$A$$ is separable and $$B \subset A$$ then $$B$$ is separable

Is there something wrong in (b) of this theorem? From the statement A and B are just sets, not necessarily metric spaces but, if so, (b) would be wrong. So to proof that B is separable I have to find a countable set that is dense in A. If the proposition is true for $$M=A=\mathbb{R}$$ and B any subset of A, for instance a singleton $$\{x\}$$, which is clearly not dense in $$\mathbb{R}$$, it would read that the singleton set B is separable , but I don't think so, because for that, $$B=\{x\}$$ should be dense in $$A=\mathbb{R}$$ So should I assume A and B are metric spaces instead of just sets?

• No, a singleton is not dense in $\Bbb R$ So what? The theorem isn't saying anything about dense sets, it's talking about separable sets, and a singleton is obviously separable Commented Jan 12, 2022 at 11:02
• @David C. Ullrich Is a singleton B separable because it is dense in itself?. I thought the density was supposed to be with respect to A, since we are talking about subsets of A Commented Jan 12, 2022 at 11:07
• $\{x\}$ is countable, and $\{x\}$ is a dense subset of $\{x\}$. When we say "$B$ is separable", we mean $B$ has a countable subset that is dense in $B$. Commented Jan 12, 2022 at 12:26
• Correct. So proving $B$ is separable is more difficult when $B$ is uncountable. Commented Jan 12, 2022 at 12:28
• One thing to keep in mind: in many mathematical categories, topological spaces and metric spaces included, a "sub-object" is assumed to inherit structure from the parent object, even if this is rarely mentioned explicitly. Thus, in any topological space $X$, a subset $A \subset X$ is assumed to inherit the subspace topology from $X$. Also, in any metric space $M$, a subset $A \subset M$ is assumed to inherit the restricted metric from $X$. Commented Jan 13, 2022 at 14:57

$$A \subseteq M$$ so $$A$$ is automatically treated as a metric space (and hence topological space too). To $$B \subseteq A$$ this also applies. We also consider $$B$$ as a metric space.
That the total space $$M$$ is metric is important because if it were only a topological space and $$A,B$$ would get the standard subspace topologies, the result would not necessarily hold anymore. But for metric spaces being separable is the same as having a countable base and that property is hereditary, whereas in general separability need not be.
An example where it doesn't hold for a non-metrizable space would be $$(X,T_p)$$, where $$\; T_p=\{A\subseteq X : p\in A\}\cup\{\emptyset\}$$ given a $$p\in X$$, and $$X$$ an uncountable set. $$(X,T_p)$$ is separable because $$cl(\{p\})=X$$, but considering $$X-\{p\}\subseteq X$$, $$(X-\{p\},T_p|)=(X-\{p\},T_D)$$ is not separable becuase if $$D\subseteq X-\{p\}$$ such that $$cl(D)=X-\{p\}$$, then $$D=X-\{p\}$$ which isn't countable.