Does the definition of compactness require the open cover to consist of subsets?

Sorry if the title is a bit unclear, but I'm stuck on the definition of compactness for metric spaces using open covers. So our professor wrote (word for word) that in a metric space $$(X,d)$$, an open cover is a family $$\{U_i\}_{i\in I}$$ with

$$U_i\subset X$$ open,

$$\bigcup_{i\in I}U_i=X$$

and that $$X$$ is compact if from every open cover $$\{U_i\}_{i\in I}$$ finitely many $$U_{i_1},...,U_{i_r}$$ can be chosen such that $$U_{i_1}\cup U_{i_2} \cup ... \cup U_{i_r}=X$$.

Is this definition correct? Because in one of our exercises, they ask us to find an open cover (that doesn't have a finite subcover) for $$X=[0,1]\cap \Bbb Q$$ with the Euclidian distance, but I can't for the life of me think of any set that is a subset of $$X$$, contains $$0$$ or $$1$$, and on top of that is an open set - those three things seem mutually exclusive to me. Was our prof mistaken in writing that $$U_i$$ is a subset of $$X$$ in the definition for open covers?

Any help would be greatly appreciated!

• Your prof was not mistaken. It might help to recall the definition of the subspace topology
– jgon
Mar 27 '19 at 16:56

Open means relatively open. A subset of $$U$$ of $$X = [0,1] \cap \mathbf Q$$ is open if there is an open set $$O \subset \mathbf R$$ satisfying $$U = O \cap X$$.
A subset $$K$$ of a metric space $$X$$ is compact if and only if for every any collection of open sets $$U_i\subseteq X,i\in I$$ for which $$K\subseteq \bigcup_{i\in I} U_i$$, there is a finite set $$F\subseteq I$$ for which $$K\subseteq \bigcup_{i\in F}U_i$$. Note that $$U_i$$ need only be subsets of $$X$$.
However, $$K$$ being compact as a subset of $$X$$ is equivalent to $$(K,d|_K)$$ being a compact space. Here, $$d|_K$$ is the metric on $$X$$ with its domain restricted to $$K\times K$$. It can be shown that $$V\subseteq K$$ is open in $$(K,d|_K)$$ if and only if $$V=U\cap K$$ for some open $$U\subseteq X$$.
For your problem, for example, letting $$K=[0,1]\cap \mathbb Q$$, then $$(a,b)\cap [0,1]\cap \mathbb Q$$ would be an open set for any $$a,b\in \mathbb R$$. Even though such sets are not open in $$\mathbb R$$, they are open when viewed as subsets of $$K$$ with the metric inherited from $$\mathbb R$$.
e.g. $$[0,\frac12)\cap \mathbb{Q}$$ is an open set of $$X=[0,1]\cap \mathbb{Q}$$ in its subspace topology.