It's straight forward to prove by contradiction that for differentiable function if $f(a)=\max(f)$, then $f'(a)=0$.
$\rule{60mm}{2pt}$
Proof: Without loss of generality, assume to the converse that $f'(a)>0$
Now by definition of derivative and limit for all $x$, and for all $\varepsilon$, there exists $b>0$:
$$-\varepsilon<\frac{f(a-x)-f(a)+b}{x}<\varepsilon$$
Since the function is differentiable and $f(a)$ is the maximum, we can select $x$ such that: $$0\geq f(a-x)-f(a)>-b/2$$ and $x>0$.
Then select $\varepsilon=b/2x$. Now:
$$\frac{f(a-x)-f(a)+b}{x}<b/2x$$ $$\frac{f(a-x)-f(a)}{x}<-b/2x$$ $$f(a-x)-f(a)<-b/2$$
A contradiction.
$\rule{60mm}{2pt}$
However, is the result provable by a similar epsilon-delta direct proof? I tried to find a direct proof but could not, I wonder if there is a reason (can it be done?). Would the following work?
Direct proof:
Without loss of generality prove the statement for one sided limit. So by the definition of limit and derivative we must prove, for all $\varepsilon$ exists $\delta$, such that: $$0<x<\delta \rightarrow \left|\frac{f(a-x)-f(a)} x \right|<\varepsilon $$
Now $f(a-x)-f(x)\leq 0$, and we can assume $x>0$:
$$-\varepsilon<\frac{f(a-x)-f(a)}{x}<\varepsilon $$
If $f(a-x)-f(a)=0$ in the immediate neighborhood the case is already proven. As such it can be assumed $f(a-x)-f(x)< 0$. Also, assume $x<1$:
$$-\frac{\varepsilon}{f(a-x)-f(a)}>\frac{1}{x}>\frac{\varepsilon}{f(a-x)-f(a)} $$
$$\frac{f(a-x)-f(a)}{\varepsilon}<x<-\frac{f(a-x)-f(a)}{\varepsilon} $$
So take $0<x<\delta=\min(-\frac{f(a-x)-f(a)}{\varepsilon},1) $
$$\left|\frac{f(a-x)-f(a)} x \right|=-\frac{f(a-x)-f(a)}{x}<\varepsilon$$
I am not sure that this is correct, especially the bolded part seems dodgy. Thoughts?
You need to say that for every value of $\varepsilon>0,$ there exists $\delta>0$ such that if $-\delta<x<\delta$ and $x\ne 0,$ then $$ -\varepsilon<\frac{f(a+x) - f(a)} x -b <\varepsilon. $$ If $b\ne0,$ just pick $\varepsilon= |b|/2.$ That way, everything between $b\pm\varepsilon$ differs from $0.$
POSTSCRIPT:
If $f$ has a local maximum at $a,$ then for $x$ in some open neighborhood of $a,$ we have $f(a+x) \le f(a).$ Therefore $$ \frac{f(x+a) - f(x)} x \begin{cases} >0 & \text{if } x<0, \\ <0 & \text{if } x>0. \end{cases} $$ Therefore \begin{align} & \lim\limits_{x\,\uparrow\,0} \dfrac{f(x+a) - f(x)} x \ge 0 \\[10pt] & \lim\limits_{x\,\downarrow\,0} \dfrac{f(x+a) - f(x)} x \le 0. \end{align}