I am trying to represent the return cases of this psuedo code function as an expression. Specifically to illustrate which return case executes when (A==X)&&(B==Y)
Enum is defined as {X, Y, Z}
Enum function(Enum A,Enum B)
if ((A==X)||(B==X))
return X
else if ((A==Y)||(B==Y))
return Y
else
return Z
Does anyone know how to do this properly. I was trying to use a 6 variable Kmap but my answer did not seem to be correct. The closest I have gotten is the following:
R1 is the return case X
R2 is the return case Y
R3 is the return case Z
R1: ((A==X)||(B==X))
R2: ((!R1)&&((A==Y)||(B==Y)))
(((!((A==X)||(B==X)))&&((A==Y)||(B==Y)))
R3: (!R2)
(!(((!((A==X)||(B==X)))&&((A==Y)||(B==Y))))
But when I go to apply the ! cases to manipulate the representation I get lost. Would it follow something similar to Boolean Logic where ORs become ANDs and == would become != ?