Bounded slope for each point in compact subset 
Let $f$ be a function on $[a,b]$. Let $K$ be a compact subset of $[a,b]$ on which $f$ is continuous. Suppose there exists $c>0$ such that for each $x\in K$, there exists $h_x>0$ with $$\left|\frac{f(x+h_x)-f(x)}{h_x}\right|<c$$ Prove that there exists a finite subset $\{x_1,\ldots,x_n\}\subset K$ and positive numbers $h_1,\ldots,h_n$ such that
(a) $x_1<x_1+h_1\leq x_2<x_2+h_2\leq x_3<\ldots$
(b) $\left|\dfrac{f(x_i+h_i)-f(x_i)}{h_i}\right|<c$ for $i=1,\ldots,n$
(c) $K\subset\bigcup_{i=1}^n[x_i,x_i+h_i]$

The function $f$ is continuous on the compact set $K$, and so is bounded, and has a maximum and minimum on $K$. I would like to find an open cover for $K$, so that I can use the compactness property. I'm thinking about a set like $\{h\mid h>0$ and $ x+h\in K$ and $\left|\dfrac{f(x+h)-f(x)}{h}\right|<c\}$ for each $x\in K$. But I can't seem to get something to work.
 A: Let $K\subseteq[a,b]$ be compact. Let $f\colon [a,b]\to\mathbb R$ be a function such that $f|_K$ is continuous. Suppose that for some $c>0$, for each $x\in K$ there is $y\in (x,b]$ with $\left|\frac{f(y)-f(x)}{y-x}\right|<c$ (especially, $b\notin K$).
Let $U_{0}=\emptyset$ and recursively, given $n\ge 1$ and an open subset $U_{n-1}$ of $[a,b]$ with $K\setminus U_{n-1}\ne\emptyset$, let $x_{n}=\min(K\setminus U_{n-1})$.
By assumption, the set $S_{n}:=\left\{y\in(x_{n},b]: \left|\frac{f(y)-f(x_{n})}{y-x_{n}}\right|<c\right\}$ is nonempty. Select 
$y_{n}\in S_{n}$ with $y_{n}>\sup S_{n}-\frac1{n}$ and let $U_{n}=[a,y_{n})\supsetneq U_{n-1}$.
If this process stops because $K\subseteq U_{n}$ for some $n$, we are done: We have determined $x_1,\ldots,x_n\in K$ and can let $h_k= y_k-x_k$.
Conditions (a), (b), (c) are readily verified.
Therefore assume that the process never stops. Then the ascending sequence $(x_n)_{n\in\mathbb N}$ has a limit $x_\infty\in K$. Select $y_\infty\in(x_\infty,b]$ with $\left|\frac{f(y_\infty)-f(x_\infty)}{y_\infty-x_\infty}\right|<c$. By continuity of $f|_K$ at $x_\infty$, we have  $\left|\frac{f(y_\infty)-f(x_n)}{y_\infty-x_n}\right|<c$ for almost all $n$, hence $y_\infty\in S_n$ and $y_n>y_\infty-\frac1n$ for almost all $n$. But as also $y_n\le x_{n+1}\le x_\infty$ for all $n$, we arrive at a contradiction as soon as $\frac 1n<y_\infty-x_\infty$.
