# Is it legal to define a piecewise define a function like this?

I'm trying to piecewise define a function $h$ using two other functions $f$ and $g$. I want to use $h$ to draw conclusions on a certain set $T$ that's a union of two other sets $A$ & $B$.

$h(n_z) = \begin{cases} f(n_z), & \mbox{if } f(n_z) \in A \wedge f(n_z) \notin B \wedge g(n_z) \notin A \\ g(n_z), & \mbox{if } g(n_z) \in B \wedge g(n_z) \notin A \wedge f(n_z) \notin B \\ f(n_z), & \mbox{if } f(n_z) \in A \wedge \exists n_y \in \mathbb N, g(n_y) \in B \end{cases}$

My question is, is it legal to do such a definition? Keep in mind that I've already defined $f$ & $g$ in the proof I'm doing and I'm not simply pulling them out of thin air.

-
Police will be banging on the door in 3, 2, 1... Seriously, sure it's legal, but what if $f(n_z) \notin A \land g(n_z) \notin B$? –  Daniel Fischer Aug 12 '13 at 14:17
Based on my definition, of f & g I don't think that such an occurence is possible. $\exists f : \mathbb N \rightarrow X, \forall a \in A, \exists n_a \in \mathbb N, f(n_a) = a$. $\exists g : \mathbb N \rightarrow B, \forall b \in B, \exists n_b \in \mathbb N, g(n_b) = b$. –  tuba09 Aug 12 '13 at 14:21
Doesn't make sense to me without context, but that's not necessary. The point is, you have to cover all possibilities, and if you do, you're fine. –  Daniel Fischer Aug 12 '13 at 14:24
Alright then. Thank you kind sir! –  tuba09 Aug 12 '13 at 14:27

Such an definition is legal, or - how it's usually called - well-defined, if

• the cases do not overlap
• each possible condition is regarded by one of the cases

In other words, for each possible state, exactly one of the conditions must be fulfilled.

It is difficult to evalute this in this case, as we don't know the context. It seems, that the case $f(n_z)\notin A, g(n_z)\notin B$ is not considered, but maybe this case does not occur?

-
Thanks for the reply Tomas. Like I ventured to explain to Daniel Fischer, based on how I defined $f$ and $g$ such a set of circumstances would never occur. $f(n_z)$ and $g(n_z)$ either have to be in $A$, $B$ or both. Them not being in either is out of the question. –  tuba09 Aug 12 '13 at 14:32
Sorry, I read your discussion only after answering. Anyway, one other critical point would be $f(n_z)\in A\cap B$ and $\forall n\in\mathbb N: g(n)\notin B$. Can this happen? –  Tomas Aug 12 '13 at 14:36
Hmm ... I don't think I had taken that into consideration. I think I'm going to have to add more cases. –  tuba09 Aug 12 '13 at 14:48