Uniform continuity of continuous functions on compact sets Assume that $f: \mathbb R \rightarrow \mathbb R$ is continuous function on the compact set $A$. 
Does for any $\varepsilon >0$ exist a $\delta >0$, such that 
$$
\lvert\, f(x)-f(y)\rvert<\varepsilon \,\,\,\,\,\,\textrm{for every}\,\,\,\, x,y\in A,\,\,
\text{with}\,\,\, 
\lvert x-y\rvert<\delta?
$$
 A: 
Assume that $f: \mathbb R \rightarrow \mathbb R$ is continuous on a compact $A$. Then for every $\varepsilon >0$, there exists a $\delta >0$, such that
  $$
\lvert\,f(x+t)-f(x)\rvert<\varepsilon, 
$$
  whenever $x\in A$, $\lvert t\rvert<\delta$ and $x+t\in A$.

If $x+t$ is not required to belong to $A$, then the value $f(x+t)$ does not affect the continuity of $f$, when restricted on $A$. For example (as in D. Fisher's example above), let
$$
f(x)=\left\{ 
\begin{array}{lll}
1 & \text{if} & x\in A,\\
0 & \text{if} & x\not\in A.
\end{array}
\right.
$$
Then $f$ restricted on $A$ is continuous, while at $x=1$, and $t=1/n$, we have 
$$
f(1+1/n)-f(1)=-1,
$$ 
for all $n\in\mathbb N$. 
On the other hand, the reformulated claim is just the fact that continuity on a compact metric space implies uniform continuity.
A: First notice that we can assume that $f$ is identically zero on $A$ by subtracting off a continuous function $g$ extending the restriction of $f$ to $A$. Such a $g$ can be constructed using the distance function $d$ from $x\in\mathbb{R}$ to $A\subset \mathbb{R}$.
The question becomes to show that for every $\epsilon>0$ there exists a $\delta>0$ such that if $d(t,A)<\delta$ then $|f(t)|<\epsilon$. Suppose there were no such $\delta$.  Then one can construct a sequence $(t_n)$ with $d(t_n,A)\to 0$ as $n\to\infty$ while $|f(t_n)|\geq\epsilon$. The sequence is obviously bounded and therefore has a convergent subsequence $t_{n_k}\to x_0$.  Then $x_0\in A$ by compactness. It follows that $f$ is not continuous at $x_0$, contradiction.
A: I think this is called Heine's theorem, here goes my attempt:
First note that your condition is equivalent to: $$\exists\delta>0 : \forall\varepsilon>0, x,y\in A  \Rightarrow|f(x)-f(y)|<\varepsilon, \text{if } |x-y|<\delta$$
Which also means $$\forall\varepsilon>0, (x_n),(y_n)\subset A, \ \lim(x_n-y_n)=0 \Rightarrow |f(x_n)-f(y_n)|<\varepsilon$$
Also I'll use the definition of compact by sub-successions, which is that: $$\forall (x_n)\subset A, (x_n) \text{ succession, then there exists a convergent sub-succession} (x_{n_k})\subset A, \text{and} \\ \lim x_{n_k}\in A$$
So, first suppose that $f$ is not uniformly continuos, so we negate the previous statement:
$$
\exists\varepsilon>0, (x_n),(y_n)\subset A : \ \lim(x_n-y_n)=0 \Rightarrow |f(x_n)-f(y_n)|\ge\varepsilon \tag{#}
$$
So, let $(x_{n_k}), (y_{n_k})$ be convergent sub-successions, with $(x_{n_k})\to x_0$. Since $\lim(x_n-y_n)=0 \Rightarrow (y_{n_k})\to x_0$. Now use the fact that $f$ is continuos$^*$, in which case $$(f(x_{n_k}))\to f(x_0), f(y_{n_k})\to f(x_0). \text{Therefore, }\lim(f(x_{n_k})-f(y_{n_k}))=0.$$
Using the definition of limit this contradicts condition $\text{(#)}$, therefore $f$ is uniformly continuos. Note that by replacing "$|$" with "$||$" we obtain the generalization for metric spaces! (because the succession characterizations also hold).
$*\text{using $f$ continuous} \Leftrightarrow \forall (x_n)\mid\lim(x_n)=p, \ \lim f(x_n)=f(p). $
