A result of Cantorian pathologies

We are asked to find a function on [0,1] such that f(0) = f(1) = 1 that has positive derivative almost everywhere on that domain. It occurred to me to use the Cantor set, which is obtained by partitioning remaining intervals into thirds and removing the interior of the second one. So first (1/3, 2/3) then (1/3^2, 2/3^2) and (7/3^2, 8/3^2), and so on. Each time we remove two-thirds of the remaining and summing the geometric series yields a measure of 1 for all that is removed. Another Cantorian construct arrived at from the Cantor set is the Cantor function, or Cantor staircase, called such as it resembles a staircase. That is, it turns out exactly what we need. It is a function with derivative zero almost everywhere, with non zero derivative points as jump points at the Cantor set. It is that discontinuity that facilitates the going from 0 to 1 along an interval with zero derivative almost everywhere. A transformation of that with a function with positive derivative is a step to deliver us what we want. That would be x minus the Cantor function. This has derivative 1 almost everywhere. However, we need to keep its range inside [0,1], which its outputs at [0,1/2] seems to not satisfy entirely. We are done though if we prove the other half to be non-negative, because then we can stretch the other half horizontally by a factor of two. It is needless to say that between 1/2 and 2/3 such is the case. Past 2/3, we have a downshift of 2 in base three to a 1 in base two at the first place, meaning a decrease of at least 1/6 when summing the net change at all digits which decrease in value. Digits increase in value on a change from 2 to 1 in every place past the first, or on a 1 digit in the original in its change to base two, which can occur only once, with all the following of that changed to zero, an increase of 1/2^n - 1/3^n, where n is the index of the place. In the former case, the largest possible increase is 1/2^2 + 1/2^3 + \cdots = 1/2 minus 2/3^2 + 2/3^3 + \cdots = 1/3, which is 1/6. In the latter case, 1/2^n - 1/3^n is exceeded by 1/2^{n-1} - 1/(2 \cdot 3^{n-1}), the total decrease from digit 2 to digit 1 from the nth place on. Thus, the minimum total increase from the increases exceeds the maximum total decrease from the decreases, which completes our proof of non-negativity for x \geq 1/2.