The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Propositional Logic
Section 1.1
Section Summary
Propositions
Connectives
Negation
Conjunction
Disjunction
Implication; contrapositive, inverse, converse
Biconditional
Truth Tables
Propositions
A proposition is a declarative sentence that is either true
or false.
Examples of propositions:
a) The Moon is made of green cheese.
b) Trenton is the capital of New Jersey.
Propositional Logic
Constructing Propositions
Propositional Variables: p, q, r, s,
The proposition that is always true is denoted by T
and the proposition that is always false is denoted by
F.
Compound Propositions; constructed from logical
connectives and other propositions
Negation
Conjunction
Disjunction
Implication
Biconditional
7
Example: If p
Conjunction
The conjunction of propositions p and q is
pq
Disjunction
The disjunction of propositions p and q
is
p q
F
11
Implication
If p and q are propositions, then p q is a conditional statement or
p q
Understanding
Implication
In p q there does not need to be any connection
of an obligation or contract.
If I am elected, then I will lower taxes.
If you get 100% on the final, then you will get an A.
14
p implies q
p only if q
q when p
p is sufficient for q
q is necessary for p
Biconditional
If p and q are propositions, then we can form the
p q
raining. then
p q denotes I am at home if and
only if it is raining.
17
Expressing the
Biconditional
Some alternative ways p if and only if q is
expressed in English:
p is necessary and sufficient for q
if p then q , and conversely
p if q
18
Columns
Need a column for the compound proposition
pq
pq
r
T
20
Equivalent Propositions
Two propositions are equivalent if they always
p q
q
p
T
21
p q
p
q
qp
22
Problem
How many rows are there in a truth table with
n propositional variables?
Solution: 2n We will see how to do this in
Chapter 6.
Note that this means that with n propositional
Precedence
2
3
4
5
p q r is equivalent to (p q)
r
If the intended meaning is p (q
r )
then parentheses must be used.
24
Applications of
Propositional Logic
Section 1.2
25
26
Translating English
Sentences
Steps to convert an English sentence to a
go shopping.
p: I go to Harrys
q: I go to the country.
r: I will go shopping.
If p or q then not
r.
27
Example
Problem: Translate the following sentence
into propositional logic:
You can access the Internet from campus only
if you are a computer science major or you
are not a freshman.
One Solution: Let a, c, and f represent
respectively You can access the internet from
campus, You are a computer science major,
and You are a freshman.
a (c f )
28
System Specifications
System and Software engineers take
30
Logic Puzzles
Raymond
Smullyan
(Born
An island has two kinds of inhabitants, knights, who1919)
always tell
Logic Puzzles
Team Book Exercise
1.2.34. Five friends have access to a chat room. Is it possible
to determine who is chatting if the following information is
known?
Either Kevin or Heather, or both, are chatting.
Either Randy or Vijay, but not both, are chatting.
If Abby is chatting, so is Randy.
Vijay and Kevin are either both chatting or neither is.
If Heather is chatting, then so are Abby and Kevin.
32
Logic Circuits
(Studied in depth in Chapter 12)
Electronic circuits; each input/output signal can be viewed as a 0 or 1.
0
1
represents False
represents True
Complicated circuits are constructed from three basic circuits called gates.
The inverter (NOT gate)takes an input bit and produces the negation of that bit.
The OR gate takes two input bits and produces the value equivalent to the
basic circuits to produce the desired output given the input signals by
building a circuit for each piece of the output expression and then
combining them. For example:
33
Self Study to
Slides 33-39
Outside
Power
w1
w3
w2
s2
w0
cb1
s3
w4
l1
l2
35
Self Study to
Slides 33-39
live_outside
We have outside power.
light_l1
Both l1 and l2 are lights.
light_l2
live_l1 live_w0
live_w0 live_w1 up_s2 ok_s2
If s2 is ok and s2 is in a
down position and w2
live_w0 live_w2 down_s2 ok_s2
has current, then w0 has
live_w1 live_w3 up_s1 ok_s1
current.
live_w2 live_w3 down_s1 ok_s1
live_l2 live_w4
live_w4 live_w3 up_s3 ok_s3
live_w3 live_outside ok_cb1
lit_l1 light_l1 live_l1 ok_l1
lit_l2 light_l2 live_l2 ok_l2
37
Observations (opt)
Self Study to
Slides 33-39
38
Diagnosis (opt)
Self Study to
Slides 33-39
(by David Poole and Alan Mackworth, 2010) for details on this
problem and how the method of consistency based diagnosis
can determine possible diagnoses for the electrical system.
The approach yields 7 possible faults in the system. At least one
of these must hold:
Circuit Breaker 1 is not ok.
Both Switch 1 and Switch 2 are not ok.
Both Switch 1 and Light 2 are not ok.
Both Switch 2 and Switch 3 are not ok.
Both Switch 2 and Light 2 are not ok.
Both Light 1 and Switch 3 are not ok.
Both Light 1 and Light 2 are not ok.
40
Propositional
Equivalences
Section 1.3
41
Section Summary
Tautologies, Contradictions, and Contingencies.
Logical Equivalence
Important Logical Equivalences
Showing Logical Equivalence
text)
Disjunctive Normal Form
Conjunctive Normal Form
Propositional Satisfiability
Sudoku Example
42
true.
Example: p p
always false.
Example: p p
neither
nor ap contradiction,
P a tautology
p
p
p p such
as p T
F
T
F
F
F
43
Logically Equivalent
p q
p q
p q p q
T
44
De Morgans Laws
Augustus De
Morgan
18061871
This truth table shows that De Morgans Second Law holds.
p
(pq)
(pq)
pq
T
45
Domination Laws:
Idempotent laws:
,
46
Associative Laws:
Distributive Laws:
Absorption Laws:
47
More Logical
Equivalences
48
Equivalence Proofs
Example: Show that
is logically equivalent to
Solution:
50
Equivalence Proofs
Example: Show that
is a tautology.
Solution:
q
51
52
54
Solution:
1.
2.
3.
Propositional Satisfiability
A compound proposition is satisfiable if
57
Questions on
Propositional Satisfiability
Example: Determine the satisfiability of the following
compound propositions:
Solution: Satisfiable. Assign T to p, q, and r.
Notation
59
Sudoku
A Sudoku puzzle is represented by a 99
60
61
number.
62
every number.
(this is tricky - ideas from chapter 4 help)
Assert that no cell contains more than one
number. Take the conjunction over all values
of n, n, i, and j, where each variable ranges
from 1 to 9 and
,
of
63
Solving Satisfiability
Problems
To solve a Sudoku puzzle, we need to find an