Beruflich Dokumente
Kultur Dokumente
2
Introduction to
Logic
Chapter Outline
The rules of logic are used in many areas, particularly in mathematics. Logical
methods are used to prove theorems or to distinguish between valid and invalid
mathematical arguments. It is also essential in computer science in verifying the
correctness of programs.
A proposition is any declarative sentence that is either true or false, but not both.
Example 1
Which of the following are propositions?
a. Today is Monday.
b. Did you buy the textbook?
c. 13 + 17 = 40
d. Take your medicine.
e. There are nine planets in the universe.
f. 23 – x = 11
Solution
Logical Connectives
2
Lecture Notes in Mathematical Logic
Introduction to Logic
Negation
The negation of a proposition p, denoted by ¬p (read as "not p"), is the statement
"It is not the case that p." The truth value of ¬p is the opposite of the truth value of p.
Example 2
Find the negation of each proposition.
a. Today is Wednesday.
b. There is no pollution in Metro Manila.
Solution
Conjunction
The conjunction of two propositions p and q, denoted by p ∧ q , is the proposition
"p and q". The conjunction p ∧ q is true when both p and q are true and is false
otherwise.
Disjunction
The disjunction of two propositions p and q, denoted by p ∨ q , is the proposition
"p or q". The disjunction p ∨ q is false when both p and q are false and is true otherwise.
Example 3
Let p: Today is Monday.
q: It is raining today.
Write a. p∧q
b. p∨q
c. ¬p ∧ q
d. p ∨ ¬q .
Solution
3
Lecture Notes in Mathematical Logic
Introduction to Logic
Exclusive or
The exclusive or of propositions p and q, denoted by p ⊕ q , is the proposition that
is true when exactly one of p and q is true and is false otherwise.
Conditional
The conditional statement (also called implication) p → q is the proposition "if p
then q". The conditional statement p → q is false when p is true and q is false, and true
otherwise. In the statement p → q , p is called the hypothesis (or antecedent or premise)
and q is called the conclusion (or consequent).
Biconditional
The biconditional statement p ↔ q is the proposition "p if and only if q". The
biconditional statement p ↔ q is true when p and q have the same truth values, and is
false otherwise.
Example 4
Let p: John learns math logic.
q: John will get a good grade.
Write a. p→q
b. q↔ p
c. ¬p → ¬q
d. ¬q ↔ ¬p
Solution
Example 5
Let p: You pass the final examination.
q: You do every exercise in class.
q: You pass this course.
Write these propositions using p, q, and r and logical connectives
a. You pass the final exam and this course.
b. You pass this course but you do not do every exercise in class.
4
Lecture Notes in Mathematical Logic
Introduction to Logic
c. If you either do every exercise in class or pass the final examination you
will pass this course.
d. You will pass this course if and only you both do every exercise in class
and pass the final exam.
e. You wont pass this course if you neither pass the final exam nor do
every exercise in class.
Solution
In general, parentheses, brackets, and braces are used to specify the order in
which logical operators in a compound proposition are to be applied. In cases where
grouping symbols were not used we shall use the following precedence of logical
operators.
Operator Precedence
¬ 1
∧ 2
∨ 3
→ 4
↔ 5
Example 6
Using parenthesis/parentheses and the rules of precedence of
logical operators to establish what is really meant in each expression.
a. ¬p ∧ q
b. p ∧ q ∨ r
c. p ∨ q → r
Solution
5
Lecture Notes in Mathematical Logic
Introduction to Logic
Truth Tables
Truth values of propositions may be summarized in a table. A truth table of a
proposition gives the truth values of the proposition under all possible cases or
assignments.
The following are the truth tables of the compound propositions combined by the
logical operators.
p ¬p
T F
F T
p q p∧q p q p∨ q p q p⊕q
T T T T T T T T F
T F F T F T T F T
F T F F T T F T T
F F F F F F F F F
p q p→q p q p↔q
T T T T T T
T F F T F F
F T T F T F
F F T F F T
Example 7
Construct the truth table for each proposition.
a. p ∧ ¬p b. p ⊕ ¬p
c. ¬p ∧ (q → ¬p ) d. ( p → q ) ↔ (¬q → ¬p )
e. ( p ∨ q ) ∧ ¬r f. ( p ∨ q ) → (r ∧ ¬p )
Solution
6
Lecture Notes in Mathematical Logic
Introduction to Logic
7
Lecture Notes in Mathematical Logic
Introduction to Logic
Example 8
Rewrite each of these statements in the form "if p then q".
a. Classes will be suspended if storm signal is raised to level 3.
b. To get a good grade, it is sufficient to do every exercise in the book.
c. Mark will go swimming unless the water is too cold.
d. You will receive a passing grade only if you comply with all the
requirements.
e. It is necessary to have a password to log on to the server.
Solution
There are three related conditional statements that can be derived from a given
conditional. These are the converse, inverse, and contrapositive.
Example 9
Give the converse, inverse and contrapositive of the statement
If a triangle is right then it has a 90º angle.
Solution
8
Lecture Notes in Mathematical Logic
Introduction to Logic
Example 10
Give the converse, inverse and contrapositive of the statement
You are taking care of you health if you don't smoke.
Solution
Example 11
Construct the truth table for the conditional statement, its
converse, inverse, and contrapositive.
Solution
9
Lecture Notes in Mathematical Logic
Introduction to Logic
Example 12
By constructing truth tables determine whether the given
compound proposition is a tautology, contradiction or contingency.
a. p ∨ ¬( p ∧ q ) b. ( p ∧ q ) ∧ ¬( p ∨ q ) c. p ∨ (q ∧ ¬r )
Solution
10
Lecture Notes in Mathematical Logic
Introduction to Logic
Example 13
Verify the identity
a. ¬( p ↔ q ) ⇔ p ↔ ¬q . b. ( p → q ) ∨ ( p → r ) ≡ p → (q ∨ r ) .
Solution
Example 14
Show that
a. [( p ↔ q ) ∧ q ] ⇒ p . b. [( p → q ) ∧ (q → r )] ⇒ ( p → r ) .
Solution
11
Lecture Notes in Mathematical Logic
Introduction to Logic
RULES OF REPLACEMENT
Equivalence Name
p ∧T ≡ p
Identity Law
p∨F ≡ p
p∨T ≡T
Domination Law
p∧F ≡F
p∨ p≡ p
p∧ p≡ p Idempotent Law
¬ (¬ p ) ≡ p Double Negation
p∨q ≡q∨ p
p∧q≡q∧ p Commutative Laws
( p ∨ q ) ∨ r ≡ p ∨ (q ∨ r )
Associative Laws
( p ∧ q ) ∧ r ≡ p ∧ (q ∧ r )
p ∨ (q ∧ r ) ≡ ( p ∨ q ) ∧ ( p ∨ r )
Distributive Laws
p ∧ (q ∨ r ) ≡ ( p ∧ q ) ∨ ( p ∧ r )
¬( p ∧ q ) ≡ ¬ p ∨ ¬ q
De Morgan's Laws
¬( p ∨ q ) ≡ ¬ p ∧ ¬ q
p ∨ (p ∧ q)≡ p
Absorption Laws
p ∧ (p ∨ q)≡ p
p ∨ ¬p ≡ T
Negation Laws
p ∧ ¬p ≡ F
p → q ≡ ¬q → ¬p Contrapositive
p → q ≡ ¬p ∨ q Material Implication
p ↔ q ≡ ( p → q ) ∧ (q → p ) Material Equivalence
Other logical equivalences may also be established using the rules of replacement.
Consider the next example.
Example 15
The following series of logical equivalences shows that
¬[ p ∨ (¬p ∧ q )] ≡ ¬p ∧ ¬q . Identify the rule of replacement used in
each step.
¬[ p ∨ (¬p ∧ q )] ≡ ¬p ∧ ¬(¬p ∧ q ) ________________
≡ ¬p ∧ [¬(¬p ) ∨ ¬q ] ________________
≡ ¬p ∧ ( p ∨ ¬q ) ________________
≡ (¬p ∧ p ) ∨ (¬p ∧ ¬q ) ________________
≡ F ∨ (¬p ∧ ¬q ) ________________
≡ (¬p ∧ ¬q ) ∨ F ________________
≡ ¬p ∧ ¬q ________________
12
Lecture Notes in Mathematical Logic
Introduction to Logic
Solution
Example 16
Using rules of replacement show that
( p → r ) ∨ (q → r ) ≡ ( p ∧ q ) → r .
Solution
13
Lecture Notes in Mathematical Logic