It is enough to prove the claim for , then apply it on bounded intervals for the local case. Approximate in by a continuous compactly supported function , using approximation in by continuous functions. Every point is a Lebesgue point of by continuity. The bad set for is controlled by the Hardy-Littlewood maximal function of ; the maximal inequality makes its measure arbitrarily small as . Hence the non-Lebesgue points of form a null set.
If is a Lebesgue point of , then for , with the analogous formula for . The absolute value of the right side is bounded by the average of over an interval shrinking to , which tends to . By the Lebesgue differentiation theorem, this holds for almost every .
For each with , choose an interval centered at such that . On any bounded subcollection, the one-dimensional covering lemma selects disjoint intervals whose triples cover the same centers. Therefore Letting and using the measure of an increasing union proves the inequality.
Absolute continuity implies bounded variation, so is differentiable almost everywhere and . Define By differentiation of indefinite integrals, almost everywhere. Thus is absolutely continuous with derivative almost everywhere. Applying the absolute-continuity condition to the open set where changes by more than a fixed amount shows is constant. Since , , giving the displayed integral formula.