Mathematics for Computer Science

(avery) #1

3.7. References 63


or equivalently,
H IFF T:
Explain why it is reasonable to translate these two IF-THEN statements in dif-
ferent ways into propositional formulas.


Homework Problems


Problem 3.4.
Describe a simple procedure which, given a positive integer argument,n, produces
a widthnarray of truth-values whose rows would be all the possible truth-value
assignments fornpropositional variables. For example, fornD 2 , the array would
be:


T T
T F
F T
F F
Your description can be in English, or a simple program in some familiar lan-
guage such as Python or Java. If you do write a program, be sure to include some
sample output.


Problems for Section 3.2


Class Problems


Problem 3.5.
Propositional logic comes up in digital circuit design using the convention thatT
corresponds to 1 andFto 0. A simple example is a 2-bithalf-addercircuit. This
circuit has 3 binary inputs,a 1 ;a 0 andb, and 3 binary outputs,c;s 1 ;s 0. The 2-bit
worda 1 a 0 gives the binary representation of an integer,k, between 0 and 3. The
3-bit wordcs 1 s 0 gives the binary representation ofkCb. The third output bit,c,
is called the finalcarry bit.
So ifkandbwere both 1, then the value ofa 1 a 0 would be 01 and the value of
the outputcs 1 s 0 would 010 , namely, the 3-bit binary representation of 1 C 1.
In fact, the final carry bit equals 1 only when all three binary inputs are 1, that is,
whenkD 3 andbD 1. In that case, the value ofcs 1 s 0 is 100 , namely, the binary
representation of 3 C 1.

Free download pdf