Notation question: set of times of certain events I have a function of time $t$ described as
$$f(t) = H(g(t) - 1)$$
where $$H(x)=\begin{cases} 0,& x<0\\1,&x\ge0\end{cases}$$ is the Heaviside step function and $g(t)$ is a continuous function.
Now, it want to have set $T$ that contains all the times at which a 0-to-1 or 1-to-0 transition occurs. Can I write that as:
$$T = \left\lbrace t \ \middle|\  \frac{\textrm{d} f(t)}{\textrm{d} t} \neq 0 \right\rbrace$$
or is there a better way?
 A: First off, your step function (as defined) is arguably not a Heaviside step function, depending on what you mean by $g$ being "continuous." That said, it's sensible, regardless.
Secondly, I assume that the order in "0-to-1" and "1-to-0" indicates a left-to-right progression, since we're talking about time. Let me know if that's not correct, or if you aren't sure if that's correct.
Thirdly, I assume that $g:\Bbb R\to\Bbb R,$ where both domain and codomain are considered in the standard topology for the purposes of determining continuity. Let me know if that is not correct, or if you aren't sure if that's correct.
So, under those assumptions, what might $T$ look like? Well, let's suppose that $t_0\in T,$ and proceed by cases.

First, let's suppose that there is a 0-to-1 transition at $t=t_0.$ Obviously, we must have either $f(t_0)=0$ or $f(t_0)=1,$ but which one? Well, if we have $f(t_0)=0,$ then by definition, we must have $g(t_0)-1<0,$ meaning that $g(t_0)<1.$ By continuity, letting $\epsilon=1-g(t_0)>0,$ there is some $\delta>0$ such that whenever $0<|t-t_0|<\delta,$ we have $|g(t)-g(t_0)|<\epsilon.$ In particular, if $t\in(t_0,t_0+\delta),$ then $$g(t)-g(t_0)\le|g(t)-g(t_0)|<\epsilon=1-g(t_0),$$ so we see that $g(t)-g(t_0)<1-g(t_0),$ so $g(t)<1,$ so $g(t)-1<0,$ and so $f(t)=0.$ Put another way, $f$ is identically $0$ on the interval $[t_0,t_0+\delta),$ so it doesn't make sense to talk about a "0-to-1 transition" happening at $t_0.$ Consequently, we must have $f(t_0)=1,$ meaning that $g(t_0)\ge 1.$ However, if we had $g(t_0)>1,$ then by similar arguments to the above, there would be some $\delta>0$ such that $f(t)=1$ for all $t\in(t_0-\delta,t_0],$ so that it makes no sense to talk about the transition happening at $t_0.$ Thus, we must have $g(t_0)=1,$ but if there is some $\delta>0$ for which $g(t)\ge1$ for all $t\in(t_0-\delta,t_0),$ then it still doesn't make sense to talk about the transition happening at $t_0.$ Thus, we have that $g(t_0)=1,$ and for all $\delta>0,$ we have that $$(t_0-\delta,t_0)\cap g^{-1}\bigl[(-\infty,1)\bigr]\neq\emptyset.$$ Here, for any $A\subseteq\Bbb R,$ I mean $$g^{-1}[A]:=\bigl\{t\in\Bbb R\mid g(t)\in A\bigr\}.$$

Now, let's suppose that there is a 1-to-0 transition at $t=t_0.$ As above, if $f(t_0)=0,$ then there is some $\delta>0$ such that whenever $0<|t-t_0|<\delta,$ we have $|g(t)-g(t_0)|<1-g(t_0).$ In particular, if $t\in(t_0-\delta,t_0),$ then we have as above that $g(t)<1,$ so that $f$ is identically zero on $(t_0-\delta,t_0],$ and so we conclude that $f(t_0)=1,$ so $g(t_0)\ge 1.$ In a similar fashion to the work in the previous case, we likewise conclude that $g(t_0)=1,$ and that for all $\delta>0,$ we have $$(t_0,t_0+\delta)\cap g^{-1}\bigl[(-\infty,1)\bigr]\neq\emptyset.$$

Now, the above shows necessary conditions for $t_0$ to be an element of $T.$ I leave it to you to show that the conditions are also sufficient--that is, to show that if $f(t_0)=1$ and for all $\delta>0,$ we have that at least one of $(t_0-\delta,t_0)\cap g^{-1}\bigl[(-\infty,1)\bigr]$ and $(t_0,t_0+\delta)\cap g^{-1}\bigl[(-\infty,1)\bigr]$ is non-empty, then $t_0\in T.$
Once that is shown, you'll have proved that $$T=g^{-1}\bigl[\{1\}\bigr]\cap\Bigl\{t\in\Bbb R\mid\forall \delta>0,(t-\delta,t)\cap g^{-1}\bigl[(-\infty,1)\bigr]\neq\emptyset\text{ or }(t,t+\delta)\cap g^{-1}\bigl[(-\infty,1)\bigr]\neq\emptyset\Bigr\}.$$
Let me know if you have any questions about my answer. Also, let me know if you have any trouble proving the sufficiency, or even if you just want to bounce your proof attempt off of somebody.
A: I think the best way to describe this set for your readers is in words:

Let $T$ be the set of times at which a $0$-to-$1$ or $1$-to-$0$ 
  transition occurs in $f$ - that is, the transition times from sleep to waking
  or vice versa.

Any mathematical notation - even good notation - would have to be decoded to be understaood. 
I assume you don't need any kind of formula in your code.
