Interchange $\inf$ and $\lim$? Let $U \subseteq \mathbb{R}^n$ be an open set and $K \subseteq \mathbb{R}^n$ be a compact set. Suppose we have a continuous function $c : U \times K \rightarrow (0, \infty)$. Now define
$$\rho(x) = \inf_{k \in K} c(x, k)$$
Is $\rho$ continuous?
I've tried considering inverse images of intervals $(a, b)$ and prove that they are open using that $c$ is continuous, but the problem is that $\rho^{-1}(a, b)$ involves taking arbitrary intersections of the open sets you get by taking preimages under $x \mapsto c(x, k)$, so I don't know what to do.
Thanks!
 A: Here is a proof using sequences:
This proof relies on a technical lemma: The sequence $\theta_n$ converges to $\hat{\theta}$ iff $\theta_n$, $\hat{\theta}$ are such that for any subsequence $\theta_{n_i}$, there exists a 'sub'-subsequence $\theta_{n_{i_k}}$ such that $\theta_{n_{i_k}} \to \hat{\theta}$.
Suppose $x_n \to \hat{x}$. Let $k_n$ be an element such that $\rho(x_n) = c(x_n,k_n)$. Note that, by construction, $c(x_n,k_n) \le c(x_n,k)$ for all $k \in K$.
Since $K$ is compact, we have $k_{n_i} \to \hat{k}$ (that is, some subsequence converges to some element $\hat{k}\in K$).
By continuity, we have $c(\hat{x},\hat{k}) \le c(\hat{x},k)$ for all $k \in K$, and so $  c(\hat{x},\hat{k}) = \rho(\hat{x})$.
We need to show that $\rho(x_n) \to \rho(\hat{x})$. Suppose $\rho(x_{n_i})$ is a subsequence. Since $x_{n_i} \to \hat{x}$, the above argument shows that for some further subsequence we have $k_{n_{i_j}} \to k' \in K$ and $\rho(x_{n_{i_j}}) = c(x_{n_{i_j}}, k_{n_{i_j}}) \to c(\hat{x}, k') = \rho(\hat{x})$. The above lemma allows us to conclude that $\rho(x_n) \to \rho(\hat{x})$.
Alternatively: Here is a proof using uniform continuity:
Choose $\hat{x} \in U$. Let $C \subset U$ be a compact set containing $\hat{x}$ in its interior. Then $C \times K$ is compact, and hence $c: C \times K \to \mathbb{R}$ is uniformly compact. For convenience use the metric $\|(x,k)\| = \max(\|x\|,\|k\|)$. We will show upper and lower semi-continuity separately, which shows that $\rho$ is continuous.
Let $\epsilon>0$. Then there exists $\delta>0$ such that if $\max(\|x_1-x_2\|,\|k_1-k_2\|) < \delta$, then $|c(x_1,k_1)-c(x_2,k_2)| < \epsilon$.
Suppose $\rho(\hat{x}) = c(\hat{x},\hat{k})$ and $\|\hat{x}-x\| < \delta$. Then $\rho(x) \le c(x,\hat{k}) < c(\hat{x},\hat{k}) + \epsilon = \rho(\hat{x})+\epsilon$ and so $\rho$ is upper semi-continuous (this just required continuity in $x$ at $(\hat{x},\hat{k})$).
We also have $\rho(\hat{x}) \le c(\hat{x},k)$ for all $k$. Again, suppose $\|\hat{x}-x\| < \delta$. Then $\rho(\hat{x})-\epsilon < c(x,k)$ for all $k$, and so $\rho(\hat{x})-\epsilon \le \rho(x)$, and so $\rho$ is lower semi-continuous (this required continuity in $x$ at $(\hat{x},k)$, uniformly in $k$).
