1.2.布尔函数合成
\(1.2.\)Boolean function construction
1.Basic method
Our goal is to create a boolean function that fits in the given truth table. To achieve this, we can do the following steps:
- Select the line that has the bool value
0
and1
separately. - For each line that has the bool value
0
, create a function that is able to get the value. - Combine these functions with
or
, thus get a new function(sayf1
). - Do the same thing for bool value
1
,and get a new functionf2
. - Combine the two function with
and
:f1 and f2
.
Take this truth table as an example:
- For line 1, 3, 5 that equal
1
, we each get:NOT x
,NOT x
,NOT y
. - Thus the new function for
1
isNOT x OR NOT x OR NOT y
.(Actually, it could have multiple forms) - For line 2, 4, 6, 7, 8, we each get:
NOT z
,NOT y
,NOT x
,NOT x
,NOT x
,NOT x
. - Thus the new function for
0
isNOT x OR NOT y OR NOT x OR NOT x OR NOT x OR NOT x OR NOT x OR NOT x
. - Combine the two new functions, we get the final result:
(NOT x OR NOT x OR NOT y) AND (NOT x OR NOT y OR NOT x OR NOT x OR NOT x OR NOT x OR NOT x OR NOT x)
.
Once we get the final result, we can use boolean function calculation to simplify it.
2.Simplify the system
Actually, we don't need OR
to join the process, we can
complete the task only by AND
and NOT
. This is
because the De Morgan's laws allow us to transform an
OR
into AND
clause.
Furthermore, we define NAND
as NOT AND
.
For example, x NAND y
is equal to NOT x AND y
.
We can prove that every boolean function can be represented by only the
NAND
statement.
\(proof:\)Since we are able to
represent all boolean functions by AND
and
NOT
, we only need to represent AND
and
NOT
using NAND
:
NOT x
can be represented byx NAND x
, this is obvious.x AND y
can be represent by(x NAND y)NAND(x NAND y)
. We can rewrite the statement asNOT(NOT x AND y)
, the statement in the parentheses isx NAND y
itself, so it is transform intoNOT x NAND y
. UsingNOT
representation again, and we get the result.