CSE 1400 Applied Discrete Mathematics
Boolean Logic
Department of Computer Sciences
College of Engineering
Florida Tech
Fall 2011
Control Structures
Boolean Logic
1
3
Normal Forms
4
The Conditional Operator
Complex Propositions
Truth Tables
5
6
8
Logical Equivalence
10
Satisfiable and Valid Propositions
Constructing Boolean Functions
Satisfiability
11
12
13
Counting Boolean Expressions
14
Consistency and Completeness of Boolean Algebra
Problems on Boolean Logic
14
15
Abstract
Logic controls the action of a computer.
Control Structures
The Böhm-Jacopini theorem shows that only three fundamental control structures are necessary to implement
any Turing algorithm.
1. Execute instructions sequentially one after another as in figure 1
2. Select one of two instruction to execute according to the value of a
Boolean variable as in figure 2
3. Iterate through a sequence of instructions until a Boolean variable
changes value as in figure 3
cse 1400 applied discrete mathematics
boolean logic 2
Figure 1: Sequential execution of
statements.
Statement
Next Statement
Figure 2: Conditional execution of
statements.
Boolean
Condition
Then
Statement(s)
Else
Statement(s)
Figure 3: Loop (iterative) execution of
statements.
Boolean
Condition
Loop
Statement(s)
cse 1400 applied discrete mathematics
boolean logic 3
Boolean Logic
Boolean logic provides the basis to control the execution
of algorithms. Propositional calculus studies the behavior of formulas constructed using Boolean variables. The domain
of these variables is the set of truth values B = {False, True}. A
Boolean variable is also called a proposition and is often interpreted as the name for a declarative natural language sentence: A
proposition is a sentence that can only be True or False. A formal
syntax describes what propositions are and how they can be manipulated.
Boolean variables are typically named
p, q, r, s, . . ..
Example propositions:
• All humans are mortal. (True)
• Socrates was human. (True)
• Socrates was mortal. (True)
1. False, also called 0, is a proposition.
• George Washington was President of
the United States of America from
1789 to 1797. (True)
2. True, also called 1, is a proposition.
3. Boolean variables over the set of bits are propositions. If p is a
Boolean variable, then p ∈ {0, 1}.
• May 1, 1911 was a Wednesday.
(False)
4. If p and q are propositions, then
• π = 3.14 (False)
• 2 + 3 = 7 (False)
• All relations are functions. (False)
(a) Not p, denoted ¬ p is a proposition
(b) p and q, denoted p ∧ q is a proposition
(c) p or q, denoted p ∨ q is a proposition
p and ¬ p are called literals. One of
them is False, the other is True.
Haskell uses && to express and.
Haskell uses k to express or.
5. Nothing else is a proposition.
To begin we need to define the Boolean operations described
above. The not operator ¬ is defined by truth table 1 and represented by the logic gate in figure 4.
The not Operator
Input
Output
p
¬p
0
1
1
0
p
¬p
Table 1: The truth table for the not
operator.
Figure 4: Logic gate for the not operator.
The and operator ∧ is defined by truth table 2 and represented by
the logic gate in figure 5.
p
q
p∧q
Figure 5: Logic gate for the and operator.
cse 1400 applied discrete mathematics
boolean logic 4
The and Operator
Input
Output
p
q
p∧q
0
0
1
1
0
1
0
1
0
0
0
1
The or Operator
Input
Output
p
q
p∨q
0
0
1
1
0
1
0
1
0
1
1
1
Table 2: The truth table for the and
operator.
Table 3: The truth table for the or
operator.
The or operator ∨ is defined by truth table 3 and represented by
the logic gate in figure 6.
From a mathematical point of view, the meaning of proposition
p is immaterial. Collections of Boolean variables are manipulated
using the above rules, that is all. From a computing point of view,
the meaning of a proposition gives reasons for manipulating it.
Normal Forms
A form is a syntactic structure. A form is normal if every expression
can be transformed into its structure. Two normal forms for Boolean
logic are conjunctive and disjunctive normal forms.
• A literal is a Boolean variable p or its denial ¬ p.
• A clause is a disjunction of literals, for example
p ∨ ¬q ∨ ¬r
is a clause.
• An implicant is a conjunction of literals, for example
p ∧ ¬q ∧ ¬r
is a implicant.
p
q
p∨q
Figure 6: Logic gate for the or operator.
cse 1400 applied discrete mathematics
boolean logic 5
A Boolean expression B is in conjunctive normal form if B is
the conjunction of clauses c k (each c k is the disjunction of literals.)
B=
n^
−1
ck
k =0
For instance,
( p ∨ r ) ∧ (¬ q ∨ r )
is in conjunctive normal form.
A Boolean expression B is in disjunctive normal form if B is
the disjunction of implicants d k (each d k is the conjunction of literals.)
B=
n_
−1
dk
k =0
For instance,
( p ∧ r ) ∨ (¬ q ∧ r )
is in disjunctive normal form.
The Conditional Operator
Conditional statements bridge from True statement to
True statement. In logic, the conditional is written
if p then q
where p and q are Boolean variables. Symbolically, the conditional is
written
p→q
The value of a conditional ‘if p then q’ is defined as follows.
1. When p is True the value of the conditional has the value of q.
2. When p is False the value of the conditional is True.
That is,
if p then q =
q
if p = True
True if p = False
These rules are summarized in the truth table below, which also
shows that the conditional p → q is equivalent to ¬ p ∨ q.
The
value (True or False) of a conditional can be difficult to understand,
especially when the premise is False. To gain some understanding,
consider these statements.
• “John scores above 90 on the final.” Call this p.
The logical conditional is similar to the Haskell conditional
if p then q else true.
cse 1400 applied discrete mathematics
boolean logic 6
Table 4: The conditional operator.
Input
Output
p
q
p→q
¬p ∨ q
0
0
1
1
0
1
0
1
1
1
0
1
1
1
0
1
p
q
p→q
• “John earns an A in the course.” Call this q.
Pretend I make the statement
• “If John scores above 90 on the final, then John earns an A in the
course.” That is p → q.
Ask yourself, when my statement is True and when it is False?
There are four cases. Two cases where p is True:
1. If John scores above 90 on the final and John earns an A in the
course, do you agree my statement p → q is True?
2. If John scores above 90 on the final and John does not earn an A
in the course, do you agree my statement p → q is False?
And two cases where p is False.
2. If John scores 90 or below on the final and John’s grade is B or below, do you agree my statement p → q is not False and therefore
must be True?
3. If John scores 90 or below on the final and John grade is A, do you
agree my statement p → q is not False and therefore must be
True?
Notice the statement p → q tells you nothing about the value of q
when p = False.
The conditional operator is at the heart of establishing a proof.
p → q is called an argument. p is called
the premise. q is called the conclusion.
Complex Propositions
Complex propositions can be made from by combining simple propositions using Boolean not, and and or operations. For values of n = 0, 1, 2, . . ., it is useful to list the expressions
that can be created using n Boolean variables p0 through p n−1 .
n
There are 22 Boolean functions on n
Boolean variables.
cse 1400 applied discrete mathematics
boolean logic 7
1. When n = 0 there are no propositions, but there are two Boolean
functions, the constant True and the constant False.
2. When n = 1 there is one proposition p and four Boolean functions:
True, False, p, and ¬ p.
3. When n = 2 there is 2 propositions p and q, and sixteen Boolean
functions.
Name
Symbol
Name
False
0
∧
¬( → )
p
¬(← )
q
⊕
∨
not or (nor)
equivalence
not q
converse
not p
conditional
not and (nand)
and
not conditional
buffer p
not converse
buffer q
exclusive or
or
Input
0
p∧q
0
0
1
1
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
2
3
4
¬( p → q ) p ¬( q → p ) q
Input
p
q
0
0
1
1
0
1
0
1
¬(∨)
≡
¬q
←
¬p
→
¬(∧)
1
BooleanFunctions
q
Binary
Symbol
True
p
Notice that True can be written as an
expression in p: True = p ∨ ¬ p. Also,
False can be written as an expression in
p: False = p ∧ ¬ p.
See the section on primitive type Bool.
p⊕q
p∨q
0
1
0
1
0
1
1
0
0
1
1
1
5
6
7
I use the binary value in the table as
a check-sum to know that each of the
2
22 = 16 Boolean functions are listed.
Boolean Functions
¬( p ∨ q ) ≡ ¬ q
Binary
q→p
¬p
p→q
¬( p ∧ q )
1
1
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
1
1
0
0
1
1
0
1
1
1
1
0
1
1
1
1
8
9
10
11
12
13
14
15
23
4. When n = 3 there are two-hundred-and-fifty-six, that is 2 =
28 = 256, different Boolean functions can be constructed using 3
Boolean variables p, q, and r.
n
5. In general, 22 different Boolean functions can be defined on a
domain of n Boolean variables p0 , . . . , p n−1 .
Each of the three variables can assume
one of two values giving eight combinations (0, 0, 0) through (1, 1, 1). A
function maps each combination to one
of two values. Therefore there are 28
different functions.
cse 1400 applied discrete mathematics
boolean logic 8
Number of variables
Number of truth assignments
Number of Boolean functions
0
1
2
3
4
n
1
2
4
8
16
2n
2 = 22
1
4 = 22
2
16 = 22
3
256 = 22
4
65536 = 22
n
22
0
The number of Boolean functions grow rapidly as the number of
n
propositional variables increases There are 22 different Boolean
functions in n variables.
Truth Tables
Given a Boolean function in n variables
B ( p 0 , . . . , p n −1 ),
how do you compute its output for given input values for
its variables p0 , . . . , p n−1 ? For small values of n, a truth table is a
reasonable method to express the computation. For instance, pretend
you want to know the input/output behavior of the function
B( p, q ) = ¬( p ∨ q )
Using the basic operations described above you can create a truth
table for B( p, q ). The four combinations of input values are listed in
the two left columns, and the outputs for these inputs are listed in
the ¬ column colored crimson.
Input
Output
p
q
¬
(p ∨ q)
0
0
1
1
0
1
0
1
1
0
0
0
0
1
1
1
When the output column is always True, the Boolean expression is
said to be a tautology. The expression (( p ) ∧ ( p → q )) → q, called
cse 1400 applied discrete mathematics
boolean logic 9
modus ponens, is a basic rule of inference.
Input
Output
p
q
( p ∧ ( p → q ))
→
q
0
0
1
1
0
1
0
1
0
0
1
1
1
1
1
1
0
1
0
1
0
0
0
1
1
1
0
1
This xkcd cartoon used under a Creative Commons license. See http://xkcd.com/license.html
A tautology is a theorem of Boolean logic. There are several useful
Boolean logic tautologies.
Modus Ponens
p ∧ (p → q) → q
Modus Tollens
¬q ∧ (p → q) → ¬p
Reductio ad Absurdum
(¬ p → False) → p
Resolution
( q → q ) ∧ (¬ p → r ) → q ∨ r
Simplification
(p ∧ q) → p
Hypothetical Syllogism
[( p → q ) ∧ ( q → r )] → ( p → r )
The negation of a tautology is called a contradiction. Consider
the expression
(( p ∧ ¬ q ) ∨ (¬ p ∧ r )) ∧ (¬ q ∧ ¬ r )
Apply DeMorgan’s laws and convert
disjunctive forms ¬ a ∨ b to conditional
a → b notation.
cse 1400 applied discrete mathematics
boolean logic 10
which is the negation the resolution rule of inference
( p → q ) ∧ (¬ p → r )) → ( q ∨ r )
Input
p
q
r
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
Output
(( p ∧ ¬ q ) ∨ (¬ p ∧ r )) ∧ (¬ q ∧ ¬ r )
0
0
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
A contingency is a Boolean expression that is sometimes True and
sometimes False.
Logical Equivalence
You can convey the same meaning (or value) in many ways.
Consider the three statements.
Satisfiability (SAT for short) is a
classic hard decision problem: Given a
Boolean expression B( p0 , p1 , . . . , p n−1 )
in n Boolean variables, is there an
assignment of True or False values
to each of the variables that make
B( p0 , p1 , . . . , p n−1 ) True?
1. If it is raining and sunny there will be a rainbow.
2. If there is no rainbow, then it is not raining or not sunny.
3. It is not raining or it is not sunny or there is a rainbow.
Although it may not be obvious at first glance, these three propositions are equivalent. To understand this, let p, q, and r be the
atomic propositions “it is raining”, “it is sunny”, “there is a rainbow” Using these names, and logical operations, the three complex
propositions 1, 2, 3 can be represented symbolically.
1. ( p ∧ q ) → r
2. (¬ r ) → ((¬ p ) ∨ (¬ q ))
3. (¬ p ) ∨ (¬ q ) ∨ r
Using these symbolic representations, a truth table can be constructed. Notice that the output is identical for each combination
Logicians would identify p, q, and
r as temporal propositions. Their
truth is not absolute, but depends on
time. Likewise, their truth depends
on location as well. Spacio-temporal
reasoning is an advanced field with
many applications.
cse 1400 applied discrete mathematics
boolean logic 11
of input signals.
Input
Output
p
q
r
( p ∧ q ) → r (¬ r → (¬ p ) ∨ (¬ q )) (¬ p ) ∨ (¬ q ) ∨ r
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
In the truth table, the output values can reasoned as follows.
1. For statement 1, the output is 1 for p = 0 or q = 0, which fills
in the first 6 rows. The output of seventh row is 0 because the
premise p ∧ q is True and the conclusion r is False. And, the
output in row eight is 1 because the premise is True and the conclusion is True.
2. For statement 2, the output is 1 whenever r = 1, which fills every
other row with 1 starting from the second. The output is also
1 whenever p or q is false. For the seventh row, the output is 0
because the premise ¬ r is True and the conclusion ¬ p ∨ ¬ q is
False.
3. Verify the output for statement 3 for exercise.
Boolean expressions are equivalent when they have identical
input-output behavior. This equivalence partitions Boolean expressions into equivalence classes. Notice this instance of equivalence is a
relation that is reflexive, symmetric, and transitive.
Satisfiable and Valid Propositions
Definition 1 (Truth Assignment). Let B = B ( p0 , p1 , . . . , pn−1 ) be a
Boolean function in the atomic (True or False) variables
p 0 , p 1 , . . . , p n −1 .
An truth assignment T maps values True or False to each of the
variables p0 , p1 , . . . , pn−1 .
Definition 2 (Satisfiable Propositions). A Boolean expression B is
satisfiable if B has a truth assignment that makes B True.
• Reflexive: B( p, q, . . .) ≡ B( p, q, . . .)
for all Boolean expressions
B( p, q, . . .).
• Symmetric: If B( p, q, . . .) ≡
C ( p, q, . . .), then C ( p, q, . . .) ≡
B( p, q, . . .), for all Boolean expressions B( p, q, . . .) and C ( p, q, . . .).
• Transitive: If A( p, q, . . .) ≡
B( p, q, . . .) and B( p, q, . . .) ≡
C ( p, q, . . .), then A( p, q, . . .) ≡
C ( p, q, . . .), for all Boolean expressions A( p, q, . . .), B( p, q, . . .), and
C ( p, q, . . .).
( p0 , p1 , p2 ) = (True, False, True) is a
truth assignment of the variables in the
Boolean function
B = B ( p0 , p1 , p2 )
cse 1400 applied discrete mathematics
boolean logic 12
Definition 3 (Valid Propositions). A Boolean expression B is valid if
B is True for all truth assignments.
Definition 4 (Unsatisfiable Propositions). If B is valid, then ¬ B is unsatisfiable. That is, ¬ B is unsatisfiable if no truth assignment that makes
¬ B True, or equivalently, ¬ B is False for every truth assignment.
Constructing Boolean Functions
How can you build a circuit that has given input-output
behavior? Pretend you needed to construct a Boolean function that
behaves as indicated in the table below.
Input
Output
p
q
r
0
0
1
1
0
1
0
1
1
0
0
1
To build the Boolean function as a disjunction of conjunctions
write a conjunctive clause for each row where the output is True.
The clause is the AND of literals in the row. The variable used
if it is True and the negation of the variable is used otherwise. For
instance in the truth table above there are two rows with output 1.
Using the rule, the first row produces the conjunctive clause (¬ p ∧
¬ q ), and the fourth row produces the conjunctive clause ( p ∧ q ).
Next, form the disjunction (OR) of all the conjunctive clauses.
r ( p, q ) = (¬ p ∧ ¬ q ) ∨ ( p ∧ q )
To build a Boolean function as a conjunction of disjunctions
write a disjunctive clause for each row where the output is False.
The clause is the OR of literals in the row. The variable used if it
is False and the negation of the variable is used otherwise. Using
the truth table above there are two rows with output 0. Using the
rule, the second row produces the disjunctive clause. ( p ∨ ¬ q ), and
the third row produces the disjunctive clause. (¬ p ∧ q ). Form the
AND of all the disjunctive clauses.
r ( p, q ) = ( p ∨ ¬ q ) ∧ (¬ p ∨ q )
A more complex instance is given in the truth table below that
describes a full adder: The Boolean function that adds two bits a
and b and a carry-in bit cin to produce a sum bit s and a carry-out bit
cout
cse 1400 applied discrete mathematics
boolean logic 13
Input
Output
a
b
cin
s
cout
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
1
1
1
The sum bit s can be represented by the expression
s = (¬ a ∧ ¬ b ∧ cin ) ∨ (¬ a ∧ b ∧ ¬ cin ) ∨ ( a ∧ ¬ b ∧ ¬ cin ) ∨ ( a ∧ b ∧ cin )
which can be factored as
a ⊕ b ⊕ cin
where ⊕ is the xoroperation.
The carry-out bit cout can be represented by the expression
cout = (¬ a ∧ b ∧ cin ) ∨ ( a ∧ ¬ b ∧ cin ) ∨ ( a ∧ b ∧ ¬ cin ) ∨ ( a ∧ b ∧ cin )
which can be factored as
( a ∧ b ) ∨ ( cin ∧ ( a ⊕ b ))
Two expressions that compute output s are
(¬ p ∧ ¬ q ∧ ¬ r ) ∨ (¬ p ∧ q ∧ r ) ∨ ( p ∧ ¬ q ∧ ¬ r ) ∨ ( p ∧ q ∧ r )
and
( p ∨ q ∨ ¬ r ) ∧ ( p ∨ ¬ q ∨ ¬ r ) ∧ (¬ p ∨ ¬ q ∨ r ) ∧ (¬ p ∨ ¬ q ∨ ¬ r )
Satisfiability
The satisfiability problem is:
Given a Boolean function, is there some assignment of truth values that
maps to True?
Satisfiability is known to be a hard problem. To find a truth assignment for a Boolean function B( p0 , . . . , p n−1 ) one may have to test all
2n possible truth assignments of the n Boolean variables p0 , . . . , p n−1 .
SAT is how one refers to the satisfiability problem.
cse 1400 applied discrete mathematics
boolean logic 14
Counting Boolean Expressions
Many propositions can be constructed using Boolean operations over a set of propositions. Pretend you are given
a set of n propositions. Think about it. A Boolean expression constructed using the formal syntax rules above is a function from the
domain
B × B × · · · × B = Bn
Call the n propositions p0 , p1 , . . . , p n−1 .
of the propositions
p 0 , p 1 , . . . , p n −1
to the range B = {0, 1}. The cardinality of the domain is 2n since
each proposition p k , k = 0, 1, . . . , n − 1 can be in one of two states:
True or False. The cardinality of the range is 2. To define a function,
each of the 2n input values in the domain is mapped to one, and
only one, of the 2 values in the range. That is, there are 2 choices 2n
n
times or 22 different choices. Each one represents a different Boolean
function.
Consistency and Completeness of Boolean Algebra
Boolean algebra is based on underlying axioms and the theorems
that can be derived from from the axioms using rules of inference.
A direct proof of a proposition q is obtained by applying the rule of
inference
If p is True and p → q is True, then q is True.
Boolean logic is consistent if it is not possible to construct a
Boolean proposition p such that both p and ¬ p are True. Stated differently, Boolean logic is inconsistent if it is possible to construct a
Boolean proposition p such that both p and ¬ p are True.
Boolean logic is complete if it there is a proof of every True
Boolean proposition s. Stated differently, Boolean logic is incomplete if there is a True proposition s that no proof within Boolean
logic.
It turns out that Boolean logic is both consistent and complete. The
next few ideas outline why this is True.
Consider the Boolean expression
s = p → (¬ p → q )
Within the system of Boolean logic
it is possible to prove every True
proposition (complete) and not possible
to prove any False proposition.
cse 1400 applied discrete mathematics
boolean logic 15
Construct a truth table for r and determine that it is a tautology.
Input
Output
p
q
p
→
(¬ p → q )
0
0
1
1
0
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
Tautologies can be used in proof, and it is convenient to name them.
Let’s call s = p → (¬ p → q ) the consistency/complete rule.
Now, let’s pretend that Boolean logic is inconsistent. That is,
let’s pretend there is a Boolean proposition p such that both p and
6= p are theorems. Then, since is
s = p → (¬ p → q )
is a theorem and p is True, it must be that ¬ p → q is True. And,
since ¬ p is True, it must be that q is True. That is,
If Boolean logic is inconsistent, then every proposition q is a theorem.
Stated in the contra-positive, if there is proposition q that is not a
theorem, then Boolean logic is consistent.
To complete the argument, the proposition q = r ∨ s is an instance
of a proposition that is not always True. Therefore, Boolean logic is
consistent.
Problems on Boolean Logic
1. Match the term with its symbol.
(a)
AND
(b)
Equivalent
(c)
Exclusive or
(d)
True
(e)
False
(f)
Implies (if . . . then . . . )
(g)
NOT
(h)
OR
(a) ∧
(b) ⊕
(c) ≡
(d) ¬
(e) 0
(f) ∨
(g) →
(h) 1
(i)
Conditional (if . . . then . . . )
2. Given that p = True, q = False and r = False, compute the value of the following propositions.
cse 1400 applied discrete mathematics
boolean logic 16
(a) ¬ p ∨ r
(e) p ∧ ¬ r
(b) ¬ p → r
(f) ( p ∧ q ) → r
(c) ¬( p ∧ q ) ∨ ¬ r
(g) ¬( p ∨ ¬ q ) ∧ ¬ r
(d) ( p → r ) → q
(h) p → ( r → q )
3. Express the conditional operator
p→q=
1
if p = 0 or (p = 1 and q = 1)
0
if p = 1 and q = 0
using the not ¬ and or ∨ operations.
4. Write the Haskell expression
if p then q else r
as a Boolean expression using variables p, q and r and operators ¬, ∧ and →.
5. When p is False, describe the output values of the conditional from problem 4.
6. When p is True, describe the output values of the conditional from problem 4.
7. Show that the conditional p → q is equivalent to ¬ p ∨ q.
8. Construct truth tables to prove DeMorgan’s laws
(a) ¬( p ∧ q ) ≡ (¬ p ) ∨ (¬ q )
(b) ¬( p ∨ q ) ≡ (¬ p ) ∧ (¬ q )
9. Show how to distribute NOT into a conditional.
¬( p → q ) = (
)
10. Show how to factoring NOT out of a conditional.
¬ p → ¬ q ≡ ¬(
)
11. Construct a truth table to prove a conditional is equivalent to its contra-positive, that is,
p → q ≡ ¬q → ¬p
12. Construct a truth table to prove AND distributes over OR, that is,
p ∧ (r ∨ r) ≡ (p ∧ r) ∨ (p ∧ r)
13. Construct a truth table to prove OR distributes over AND, that is,
p ∨ (r ∧ r) ≡ (p ∨ r) ∧ (p ∨ r)
Construct a truth table for the Boolean expression
(( p → q ) ∧ ( q → r )) ∧ ¬( p → r )
cse 1400 applied discrete mathematics
boolean logic 17
14. Construct a truth table for the Boolean expression
(( p ∧ q ) → r ) ≡ ( p → ( q → r ))
Is the equivalence True or False? Explain your answer.
15. Construct a truth table for the Boolean expressions
( p ← q ) ⊕ (¬ q → p )
16. Identify each statement as a tautology, a contradiction, or a contingency.
(a) A ∩ ∅ = U
(b) A ∩ (B ∪ C) = (A ∪ B) ∪ (A ∩ C)
(c) {(0, 1)} ⊆ {(0, 0), (0, 1), (1, 0), (1, 1)}
(d) (0, 1) ⊆ {(0, 0), (0, 1), (1, 0), (1, 1)}
(e) (0, 1) ∈ {(0, 0), (0, 1), (1, 0), (1, 1)}
(f) ( p → ( q ∧ ¬ q )) → ¬ p
17. Complex computer circuits can be build from three basic gate types, called And, Or, and Not, and
drawn as illustrated below.
p
p∧q
q
And Gate
p
q
p∨q
Or Gate
¬p
p
Not Gate
The inputs p and q are high (1) or low (0) voltages. Fill in the chart below.
p
0
0
q
0
1
0
¬p
p∧q
p∨q
0
1
18. Let Bn be the set of all strings of high or low voltages of length n. For instance there are 4 strings of
length 2.
B2 = {00, 01, 10, 11}
What is the cardinality of Bn ?
19. How many functions can be constructed from Bn to B = {0, 1} using And, Or, and Not operations?
20. How many functions can be constructed from Bn to Bm = {0m , . . . , 1m } using the gate operations And,
Or, and Not?
21. It is estimated that there are 1080 atoms in the universe. Find the number of propositions n such that
there are more Boolean functions in n variables than there are atoms in the universe.
© Copyright 2026 Paperzz