Title: Uses of Logic: Argumentation and Boolean Algebra
1Uses of Logic Argumentation and Boolean Algebra
- Reading
- Rosen 3.1 - 3.2, 9.1 - 9.2, and 9.4 (Karnaugh
map section only)
2How can we use logic?
- Formal proofs
- We will discuss a few simple kinds of proof
- Every proof has a sound logical basis
- Boolean Algebra
- A more mathematical logic formalization
- Leads to important ideas in digital circuits and
computer hardware
3The Nature of Proof
- We usually want to prove implications (for
example, If n is even, then n2 is also even.)
-- usually truths that depend on other truths - We try to show that knowing the if part is true
leads logically to certain truths that make up
the then part - If each step is logically sound, then you must
accept the end result
4The Direct Proof
- Proving that the statement pq is true by showing
that p logically leads to q - Predicate calculus applies here for true
correctness - Example If n is even, then n2 is even.
- P(n) n is even
- Q(n) n2 is even
- The statement is really "n (P(n) Q(n)) where
the universe of discourse is (nonnegative)
integers
5Direct Proof Example
- Let n be an element in the universe of discourse
- Assume n is even, show its square is even
- n even 2 must be one of its prime factors
- Thus, n n n2 has 22 in its prime
factorization - Since 2 is one of n2s prime factors, n2 is even
- Logically, we show pq by following a chain of
implications (pa, ab, bq, thus pq) - Usually, the sub-implications are small steps
leading toward the big truth
6Indirect Proof
- Since pq is logically equivalent to ØqØp
(contrapositive law!), you can prove the former
by directly proving the latter this is called an
indirect proof - Lets prove the statement we just examined
indirectly -- in other words, show that "n (ØQ(n)
ØP(n))
7Indirect Proof Example
- Let n be an element in the universe of discourse
- Assume n2 is not even
- Then 2 is not a prime factor of n2
- Therefore, 2 cannot appear in the prime
factorization of n (or else it would have in
n2s) - So, n is not even
8Proof by Contradiction
- Show that pq is true by initially assuming that
pÙØq is true - Contradiction arises because Øq logically leads
to Øp since pq is actually true, and thus we get
pÙØp - Thus pÙØq is false, and its negation must be
true, but its negation is exactly equivalent to
the original implication - In general contradiction proof, assume the
negation of what you are trying to prove
9Proof By Contradiction Ex.
- Proof by contradiction is similar to an indirect
proof - Ex. If n is even, n2 is even
- Assume n is even, but n2 is odd
- Since n2 is odd, 2 is not a prime factor of n2,
so 2 is not a prime factor of n either - Thus, n is odd -- contradicts assumption
- NOTE for pq, dont assume ØpÙq and then show Øq
-- this proves nothing!
10Another Contradiction Ex.
- Prove that Ö (2) is not a rational number
- Assume that it is, and so it can be expressed as
a lowest-terms fraction of two integers a/b (a
and b have no common factors) - So 2 a2/b2, and 2b2 a2, so a2 is even
- Since a2 is even, a is even (note that this is
just the contrapositive of what we proved
earlier) - Thus, a 2c where c is some integer, and
therefore 2b2 4c2 2(2c2) - So b is also even, thus a and b are both
divisible by 2, but the fraction was in lowest
terms, so there is a contradiction -- assumption
was false
11Boolean Algebra
- The rules of Boolean algebra provide a bridge
from logic to mathematics - Boolean algebra is an isomorphism of the formal
logic we have developed -- the two are
expressively equivalent - a AND b ab
- a OR b sgn(a b)
- NOT a a
- True 1 False 0
- literal Boolean variable or its complement
- Algebraic order of operations applies
12Some Examples
- Evaluations
- pq 1 for p q 1 0 for p 0, q 1
- p qr 1 for p 1, q r 0
- Propositions to Boolean Algebra
- Ø(p Ù q) becomes pq
- (p Ù q) Ú (Øp Ù r) becomes pq pr
- In particular, the logical equivalences have
algebraic equivalents - e.g. p Ù (q Ú r) Û (p Ù q) Ú (p Ù r) becomes p(q
r) pq pr (look familiar??)
13Sum-Of-Products Expansions
- A minterm of a set of Boolean variables is a
Boolean product where each variable or its
complement must appear exactly once - For x, y, and z, some minterms are xyz, xyz, xyz
- There are at most 2n Boolean functions over n
variables (why?) - Given any Boolean function over n variables, we
can express it as a sum of minterms of the n
variables
14Sum Of Products Example
F xyz xyz G xyz xyz xyz
15Minimizing SP Expansions
- While simple, this technique for generating
expressions for Boolean functions often produces
ones which are very large - A method called the Karnaugh map can help
simplify the expressions - Basic idea is to study variation in minterms that
differ by one variable
16Karnaugh Map Examples
y
y
Put a 1 in the box for any minterm that appears
in the SP expansion. Basic idea is to cover the
largest adjacent blocks you can whose side length
is some power of 2. Blocks can wrap around the
edges. For example, the first K-map
here represents xy xy x(y y) x. The
second K-map, similarly, shows xy xy (x x)y
y.
x
1
1
x
y
y
x
1
x
1
17Examples in 3 Variables
yz
yz
yz
yz
1
x
1
1
xz yz
1
x
yz
yz
yz
yz
1
1
1
x
z xy xy
1
x
1
1
18K-maps and Circuits
- We will see next time that K-maps can help us
make more efficient circuits - K-maps are not suitable for mechanization because
they involve visual inspection of many
possibilities - Quine-McCluskey method used for mechanization --
I do not expect you to know this method - I do not expect you to be able to K-map past
three variables