open pdf file

Logic
Chapter 7
Logic is not only the foundation of mathematics, but also is
important
i
t t in
i numerous fields
fi ld including
i l di law,
l
medicine,
di i andd
science. Although the study of logic originated in antiquity, it
was rebuilt and formalized in the 19th and early 20th century.
George Boole (Boolean algebra) introduced mathematical
methods to logic in 1847, while Georg Cantor did theoretical
work on sets and discovered that there are many different sizes
off infinite
i fi it sets.
t
Logic Sets,
Logic,
Sets and Counting
Section 1
Logic
g
2
Statements or Propositions
Negation
A proposition or statement is a declaration which is
either true or false.
false
Some examples:
ƒ “2 + 2 = 5” is a statement because it is a false
declaration.
ƒ “Orange juice contains vitamin C” is a statement that
is true.
ƒ “Open
Open the door.
door ” This is not considered a statement
since we cannot assign a true or false value to this
sentence. It is a command, but not a statement or
proposition.
ƒ Thee negation
egat o oof a state
statement
e t p iss “not
ot pp”,, de
denoted
oted by ¬ p
ƒ Truth table:
p
T
¬p
F
F
T
ƒ If p is true, then its negation is false. If p is false, then its
negation is true.
3
4
Disjunction
Conjunction
A disjunction
j
is of the form p ∨ q and is read “p
p or q
q.”
Truth table for disjunction:
A conjunction
j
is of the form p ∧ q and is read “p
p and qq.”
Truth table for conjunction:
p
q
T
p∨q
T
T
T
p∧q
T
T
F
T
T
F
F
F
T
T
F
T
F
F
F
F
F
F
F
p
q
T
A disjunction is true in all cases except when both p and q are
false.
A conjunction is only true when both p and q are true.
5
6
Conditional
(continued)
Conditional
To understand the logic behind the truth table for the conditional
statement,
statement consider the following statement.
statement
“If you get an A in the class, I will give you five bucks.”
Let p be the statement “You get an A in the class”
Let q be the statement “I will give you five bucks.”
Think of the statement as a contract. The statement is T if the
contract is satisfied, and F if the contract is broken.
(you ggot an A)) and q is true ((I give
g you
y the five
Now,, if p is true (y
bucks), the truth value of p → q is T. The contract was satisfied
and both parties fulfilled the agreement.
A conditional is of the form p → q and is read “if p then q
q.”
Truth table for conditional:
p
q
T
T
p→q
T
T
F
F
F
T
T
F
F
T
A conditional is only false if p is true and q is false, otherwise it
is true.
7
8
Conditional
(continued)
Tautologies, Contradictions
and Contingencies
The disjunction, conjunction and conditional statements
introduced on previous slides are examples of contingencies
because their truth values depend on the truth of its
components. Some of the entries in the last column of the
truth tables are true, and some are false.
Now,, suppose
pp
p is true (y
(you ggot the A)) and q is false (y
(you did not
get the five bucks). You fulfilled your part of the bargain, but
weren’t rewarded with the five bucks. p → q is false since the
contract was broken by the other party.
Suppose p is false and q is true (you did not get an A, but received
five bucks anyway.) No contract was broken. There was no
obligation to receive five bucks, but is was not forbidden, either.
The truth value of p → q is T.
Finally, if both p and q are false, the contract was not broken. You
did not receive the A and you did not receive the five bucks. The
statement is again T.
A proposition is a tautology if each entry in its column of the
y is F.
truth table is T,, and a contradiction if each entry
9
Tautologies and Contradictions
(continued)
p
¬p
p∨¬p
p∧¬p
T
F
T
F
F
T
T
F
10
Variations of the Conditional
ƒ The converse of p → q is q → p.
ƒ The contrapositive of p → q is ¬ q → ¬ p.
For example,
example p ∨ ¬ p is a tautology because it is always
true, and p ∧ ¬ p is a contradiction because it is always
false.
11
12
Example
(continued)
Example
Let p = “your score is 90%”
Let
L t q = “your
“
letter
l tt grade
d is
i A”
Conditional:
p → q means
“If your score is 90%, then your letter grade will be an A.”
Let’s assume this is true.
Converse:
q → p means
“If your letter grade is A, then your score is 90%.”
Is the statement true? No. A student with a score of 95% also
gets an A.
Contrapositive:
¬ q → ¬ p means
“If your letter grade is not an A, then your score was not 90%.”
Is this true? Yes.
If the original statement is true, the contrapositive will also be true
because a statement and its contrapositive are logically
equivalent.
We will explain what that means on the next slide.
13
Logically Equivalent Statements
14
Logically Equivalent Statements
Two statements are logically equivalent if they have the
same truth tables. is
Example:
Show that p → q is logically equivalent to ¬ p ∨ q.
Two statements are logically equivalent if they have the
same truth tables. is
Example:
Show that p → q is logically equivalent to ¬ p ∨ q.
We will construct the truth tables for both sides and
determine that the truth values for each statement are
identical.
15
16
Logically Equivalent Statements
(continued)
p
T
T
F
F
q
T
F
T
F
p→q
T
F
T
T
Logical Implications
¬p∨q
T
F
T
T
Consider the compound propositions P and Q. If whenever P is
true, Q is also true, we say that P logically implies Q, or that
P ⇒ Q is a logical implication, and write
P⇒Q
We can determine if a logical implication exists by examining a
truth table.
These two columns represent logically equivalent statements,
statements
so we can say that
p → q ≡ ¬ p ∨ q.
17
Logical Equivalences
Example
To verify
¬P∧Q⇒P∨Q
construct the following truth table:
P
Q
¬P∧Q
P∨Q
T
T
F
T
T
F
F
T
F
T
T
T
F
F
F
F
Note that whenever
¬ P ∧ Q is true
(which is only in the
thi d row),
third
) P ∨ Q is
i
also true.
19
18