The continuity of injectivity radius Let $M$ be a Riemannian manifold. $r:M\to [0,+\infty]$ denotes the function assigns to $p\in M$ the injectivity radius $r_p$ of the exponential map $\exp_p$. 

Is this function $r$ is continuous or even smooth? If not, what additional conditions could guarantee the continuity of $r$?

 A: [Edit: Asaf Shachar has pointed out a mistake in the last paragraph of the proof below. I'm no longer sure whether the stated claim is even true.]
If $M$ is complete, then $r$ is continuous. (I'm not sure of an example where $M$ is not complete and $r$ is not continuous, so it may also be that $r$ is continuous in this case as well.)
I'll give a proof. I use the phrase "$\gamma$ is a geodesic segment at $p$" to indicate that $\gamma$ is a unit speed geodesic map $\gamma: [0,L] \to M$, where $\gamma(0) = p$. Call $\gamma(L)$ is the endpoint of $\gamma$. $\gamma$ is minimizing if $d(\gamma(a), \gamma(b)) = |a-b|$ for all $a,b \in [0,L]$.
It's easy to see that the limit of a sequence of minimizing geodesic segments is a minimizing geodesic segment.
From this it follows easily that $r$ is upper semicontinuous, that is, that
$$
   \limsup_{p_n \to p} r(p_n) \leq r(p).  
$$
To see this, suppose otherwise; then there's some infinite sequence $p_n \to p$ with $r(p_n) > r(p) + \epsilon$. Fix a non-minimizing geodesic segment $\gamma$ at $p$ of length $r(p) + \epsilon$; we can write $\gamma$ as the limit of a sequence of geodesic segments $\gamma_n$ at $p_n$, all of length $r(p) + \epsilon$, and hence all minimizing; this leads to a contradiction.
Likewise, $r$ is lower semicontinuous. We wish to show
$$
  \liminf_{p_n \to p} r(p_n) \geq r(p).
$$
Again suppose otherwise. Then there's an infinite sequence $p_n \to p$ with $r(p_n) < r(p) - \epsilon$. For each $n$ we can choose a non-minimizing geodesic segment $\gamma_n$ of length $r(p)$ at $p_n$. Let $\sigma_n$ be a minimizing geodesic segment from $p_n$ to $\gamma_n(r(p))$; by hypothesis, the length of $\sigma_n$ is no greater than $r(p) - \epsilon$. Passing to some subsequence of the $p_n$'s, we can assume that the $\gamma_n$ converge to some geodesic segment $\gamma$ at $p$ of length $r(p)$, and that the $\sigma_n$ converge to some geodesic segment $\sigma$ at $p$ of length $L \leq r(p) - \epsilon$. But $\sigma$ and $\gamma$ have the same endpoint, so $\gamma$ cannot be minimizing, a contradiction.
A: Here is a proof of lower semi-continuity, for which the proof of mollyerin had a gap.
We first invoke the following result: For every point $p$ of a complete Riemannian manifold $M$ and $r>0$, the exponential map $\exp_p$ is a diffeomorphism from $B_r(0) \subset T_p M$ onto its image if and only if it is injective on $B_r(0)$. This is discussed for example in this stackexchange post.
Now, suppose that $\mathrm{injrad}$ is not lower semi-continuous. Then there exists a sequence of points $p_k$ converging to $p$ such that $\liminf_{k \to \infty} \mathrm{injrad}(p_k) \leq \mathrm{injrad}(p) - \varepsilon$, for some $\varepsilon >0$.
Denote $r_k = \mathrm{injrad}(p_k)$ and $r = \mathrm{injrad}(p)$.
After passing to a subsequence, we may assume that $r_k \leq r-\varepsilon$ for every $k$. By the claim above, $\exp_{p_k}$ is not injective on $B_{r-\varepsilon/2}(0) \subset T_{p_k}M$, so there exist two distinct vectors $X_k$, $Y_k$ of length less than $r-\varepsilon/2$ with $\exp_{p_k}(X_k) = \exp_{p_k}(Y_k)$.
After passing to a subsequence, $X_k$ and $Y_k$ converge to vectors $X, Y \in T_p M$ with $\|X\|, \|Y\| \leq r-\varepsilon/2$ and $\exp_p(X) = \exp_p(Y)$. This is a contradiction to the fact that $\exp_p$ is injective on $B_r(0)$, provided we can show that $X\neq Y$.
To this end, consider the map $F: \pi \times \exp: TM \to M \times M$.
Choose a complement $H \subset T_X TM$ of the vertical tangent space $T_X T_p M \subset T_X TM$, which then has the property $d\pi|_X$ is an isomorphism to $T_p M$ when restricted to $H$.
Since $d\pi|_X$ vanishes on $T_X T_p M$, the differential of $F$ at $X$ is
$$ dF|_X = \begin{pmatrix} d\pi|_X & 0 \\ * & d\exp_p|_X \end{pmatrix}. $$
Since $X$ is contained in a ball of radius less than the injectivity radius $r$ at $p$, $d\exp_p|_X$ is non-singular.
Consequently, $dF|_X$ is non-singular as well.
By the inverse function theorem, there exists an open neighborhood $U \subset TM$ of $X$ such that $F|_U$ is a diffeomorphism onto its image, in particular injective.
But if we had $X = Y$, then we would have two sequences $X_k$, $Y_k$ with $F(X_k) = F(Y_k)$ that converge to the same point $X$, hence eventually must be contained in $U$.
This would be a contradiction to the injectivity of $F|_U$.
