Consider the following boolean expression with a nested ternary expression:
$$(\text{if $a < 0$ then $-a$ else $a$}) < 3$$
I can "see" that it can be reduced to:
$$a > -3 \land a < 3$$
However, I can't figure out the algebraic rules I need to apply in order to arrive at the reduced expression.
I got as far as:
$$(\text{if $a < 0$ then $-a$ else $a$}) < 3$$ $$\text{if $a < 0$ then $-a < 3$ else $a < 3$}$$ $$\text{if $a < 0$ then $a > -3$ else $a < 3$}$$ $$(a < 0 \land a > -3) \lor (\lnot(a < 0) \land a < 3)$$ $$(a < 0 \land a > -3) \lor (a \ge 0 \land a < 3)$$
But that's where I'm stuck. I think somewhere in between I should arrive at:
$$(a < 0 \lor a \ge 0) \lor (a > -3 \land a < 3)$$
Or maybe:
$$(a < 0 \lor a \ge 0) \land (a > -3 \land a < 3)$$
Because then the term $(a < 0 \lor a \ge 0)$ would cancel out. So I tried my way backwards from there, but I still no luck.
I feel like I'm missing something quite simple.