I came up with a Boolean function and would like to know if there is a simpler form or if mine is right.
The function is:
Icameupwiththefollowinganswer:
I'm in doubt if this is the simplest solution I could get ...
Let's set up the truth table of f
:
w x y z f
0 0 0 0 1
0 0 0 1 0
0 0 1 0 1
0 0 1 1 1
0 1 0 0 1
0 1 0 1 0
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 0
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0
Let's reorder the table by putting the x
in the first column (and reorder the rows so that the xwyz
set is sorted from 0000 to 1111):
x w y z f
0 0 0 0 1
0 0 0 1 0
0 0 1 0 1
0 0 1 1 1
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
1 0 0 1 0
1 0 1 0 1
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0
The first half of the table equals the second. That is, x
is irrelevant. Here's how the remaining table is:
w y z f
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
There are several possible expressions that express this truth table, and all of them necessarily depend on w
, y
and z
(there is no longer any irrelevant variable).
Other possible truth table sorts are these:
y w z f
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
z w y f
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 0
Among the possible ways to express the contents of these tables, we have:
(NOT w AND NOT z) OR (y AND NOT w) OR (y AND z)
- your solution. (NOT w AND NOT z) OR (y AND (NOT z OR NOT w))
- Lucas Percisi solution. (NOT w AND NOT y AND NOT z) OR (NOT w AND y AND NOT z) OR (NOT w AND y AND z) OR (w AND y AND NOT z)
- listing the lines with 1 in the truth tables. (NOT w AND NOT y AND NOT z) OR (NOT w AND y) OR (w AND y AND NOT z)
-
simplification of the 3. (NOT z AND (w <-> y)) OR (NOT w AND y)
- simplification of 4. IF w THEN (y AND NOT z) ELSE (y OR NOT z)
- using w
as test in IF
. IF y THEN (w NAND z) ELSE (w NOR z)
- using y
as test in IF
. IF z THEN (NOT w AND y) ELSE (NOT w OR y)
- using z
as test in IF
. (y AND NOT z) OR (w AND (y <-> z))
- separating cases where y
and z
are different from those in which they are equal. (NOT w AND y) OR (NOT z AND (w <-> y))
- separating cases where w
and y
are different from those in which they are equal. (NOT w AND NOT z) OR (y AND (w XOR z))
- separating cases where w
and z
are different from those in which they are equal. In my personal opinion, solution 7 is the simplest, but you may disagree. There is no way to simplify much more than the alternatives that are there.
I came up with another answer:
(x, y, w, z) = (! w *! z) + (y * (! z +! w));