Professional Documents
Culture Documents
Lecture 1 - 5
Lecture 1 - 5
By the end of the lecture (i) you should be familiar with the following terms:
• Proposition
• Truth value
• Propositional calculus/propositional logic
• Negation, conjunction, disjunction
• Compound proposition
• Exclusive or, inclusive or
• Implications
• Converse, contrapositive, inverse
(ii) be able to
• Translate English sentences into expressions involving propositional variables and
logical connectives
Text: Discrete Mathematics and its Applications, Kenneth Rosen, Mc Graw Hill,
fifth ed., 2003
Lecture 1
Formal logic
The rules of logic give precise meaning to mathematical statements. The rules are used to
distinguish between valid and invalid mathematical statements.
Logic is the basis of all mathematical reasoning. It has practical application in the design
of computing macnines, artificial intelligence, programming languages and many other
areas in computer science.
Propositions
Let us begin with the building blocks of logic – propositions. A proposition is a statement
that is either true or false, but not both.
The following are NOT propositions since their truth value cannot be established:
r+s=t
x+5=7
Letters are used to denote propositions. (eg. p or q). For example the propositions above
could have been written as
p: 5 + 5 = 10
q: 1 + 6 = 2
r: Owen Arthur is the Prime Minister of Barbados
The truth value of a proposition is true, denoted by T, if it is a true proposition, and false
F, if it is a false proposition.
The area of logic which deals with propositions is called propositional calculus or
propositional logic.
Def: Let p be a proposition. The negation of p, denoted by ~p, is the proposition “it is
not the case that p”
Compound propositions are formed from existing propositions using logical operators
called connectives. Some of these connective are the conjunction (AND denoted ∧),
the disjunction (OR denoted ∨), implication (denoted →),the equivalence ( ↔ ) and
the exclusive-or (denoted ¿).
Def: Let p and q be propositions. The proposition “p and q” denoted by p ∧q, is the
proposition that is true when both p and q are true and is false otherwise. The
proposition p ∧q is called the conjunction of p and q.
Example: Let p be the proposition “Today is Monday” and q the proposition “It is
the first Discrete Math class”.
Find the negation of p, the conjunction of p and q and the disjunction of p and q
as expressed in English?
Def: Let p and q be propositions. The exclusive or of 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.
(ii) be able to
• Translate English sentences into expressions involving propositional variables and
logical connectives
• Show that two propositions are logically equivalent using truth tables or a series
of logically equivalent statements
eg. Let p: I am elected to office and q: I will lower the amenities fees. The implication p
→ q reads: If I am elected to office then I will lower the amenities fees.
The only case when I would have broken my promise is the case when I am elected to
office and did not lower the amenities fees.
If I am not elected to office (~p) you cannot expect me to lower the amenities fees. I
would not have broken my pledge in such a case.
Note that p → q is false only in the case where p is true and q is false.
A truth table displays the relationships between the truth values of propositions.
conjunction
Disjunction
Implication
Equivalence
Negation
Exclusive OR
p q p ∧q p ∨q p →q p↔q 5p P¿q
T T T T T T F F
T F F T F F F T
F T F T T F T T
F F F F T T T F
NB
p ↔ q True when p and q have the same truth values
p¿q True when p or q is true, but not both.
We can form or build new compound propositions using the connectives we have just
seen.
Solution:
Converse: “If there are dark clouds in the sky, then it is raining”
Contrapositive: “If there are no dark clouds in the sky, then it is not raining”
Inverse: If it is not raining then there are no dark clouds in the sky.
Def: Let p and q be propositions. The biconditional p ↔ q is the proposition that is true
when p and q have the same truth values and is false otherwise.
Noting that “only if” is one way an implication can be expressed the sentence can be
expressed as
if you can access the internet from campus then you are a Computer
Science major or you are not a freshman
Propositional Equivalence
Sometime it is necessary, in a mathematical argument to replace one statement with a
statement with the same truth value
Def
A compound proposition that is always true, no matter what the truth values of the
propositions that occur in it, is called a tautology. A compound proposition that is always
false is called a contradiction. Finally, a proposition that is neither a tautology nor a
contradiction is called a contingency.
Example:
p p p ∨p p ∧5p
T F T F
F T T F
Logical Equivalence
Compound propositions that have the same truth values in all possible cases are called
logically equivalent.
Definition
Solution: The solution given using a truth table below. Since the truth values of the
propositions (p ∨ q) and p ∧q are the same in all possible combination of truth
values of p and q, it follows that these propositions are logically equivalent.
p q p∨q (p ∨ q) p q p
∧
q
T T T F F F F
T F T F F T F
F T T F T F F
F F T T T T T
p ∧T ⇔ p
p ∨F ⇔ p Identity laws
p ∨T ⇔ T
p ∧F ⇔ F Domination laws
p ∨p ⇔ p
p ∧p ⇔ p Idempotent laws
p ∨q ⇔ q ∨ p
p ∧q ⇔ q ∧p Commutative laws
1. p ∨ (q ∧r) ⇔ ( p ∨ q) ∧( p ∨r )
Distributive laws
p ∧ (q ∨r) ⇔ ( p ∧q) ∨( p ∧r )
2. ¬ (p ∨q) ⇔ ¬ p ∧¬ q
p ∨¬ p ⇔ T Complement property
p ∧¬ p ⇔ F
(p → q) ⇔ (¬ p ∨q) Implication
(p → q) ⇔ (¬ q → ¬ p) Contraposition
We can use a truth table to show that compound propositions are logically equivalent OR
we can use a series of logical equivalences.
Example: Show that (p ∨ (p ∧q)) and p ∧q are logically equivalent.
Solution
(p ∨ (p ∧q))
⇔ p ∧(p ∧q) Demogans 2nd law
⇔ p ∧[(p) ∨q)] Demorgan’s 1st Law
⇔ p ∧( p ∨q) Double
negation
⇔ (p ∧p) ∨(p ∧q) Distributive laws
⇔ F ∨(p ∧q) since ¬p ∧ p
⇔F
⇔ (p ∧q) ∨F commutative
Law
⇔ (p ∧q)
Identity Laws
“x < 5” has two parts: The variable “x” is the subject of the statement, while “is
less than 5” is the predicate and refers to the property that
the subject of the statement can have.
The statement “x < 5” can be denoted by P(x) where P denotes “is less than 5” and x is
the variable.
P(x) is also said to be the value of the propositional function P at x. Once a value has
been assigned to the variable x, the statement P(x) becomes a proposition and has a truth
value.
The universal quantification of P(x) is the proposition “ P(x) is true for all values of x in
the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x)
Here denotes the universal quantifier
Example 1: Let P(x) be the statement “x * 0 = 0”. What is the truth value of the
quantification x P(x), where the universe of discourse is the set of real
numbers.
Solution: Since P(x) is true for all real numbers x, (any number multiplied by zero is
zero) then x P(x) is true.
Def: The universal quantification of P(x) is the proposition “ P(x) is true for all values of
x in the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x. Here
denotes the universal quantifier
Example 2
What is the truth value of the function x Q(x) where Q(x) is the statement
“x2 < 10” and the universe of discourse consist of (i) positive integers not exceeding 4 (ii)
integers not exceeding 3?
Solution (i) The statement x Q(x) is the same as Q(1) ∧Q(2) ∧Q(3) ∧Q(4) since the
universe consist of the integers 1, 2, 3, 4. Since Q(4) is false, x Q(x) is false.
(ii) false. Why???
Again many mathematical statements assert that there is an element with a certain
property. Such statements are expressed using existential quantification.
Definition
The existential quantification of P(x) is the proposition “ There exist an element in the
universe of discourse such that P(x) is true”. The notation:
x P(x): denotes the existential quantification of P(x)
Here denotes the existential quantifier
Solution: The universe of discourse is {1, 2, 3, 4}, the proposition x P(x) is the
same as P(1) ∨P(2) ∨P(3) ∨P(4).
Since P(4) , which is the statement “42 > 10” is true, it follows that x P(x) is true.
We can now use logical operators and quantifiers to express English sentences.
Example1. Express the statement “Everyone has exactly one best friend” using
quantifiers and logical connectives.
Sol. Let B(x, y) : y is the best friend of x. The statement given may be rephrased as
follows.
For every person x there is another person y, such that y is the best friend
of x and if z is another person other than y, then z is not the best friend of
x.
Hence the require expression is:
x y z[B( x, y) ∧(( z != y) → B(x, z))]
Example 2. Consider the following statements the first three of which are premises and
the fourth a valid conclusion.
All humming birds are richly coloured.
No large bird live on honey.
Birds that do not live on honey are dull coloured.
Humming birds are small.
Assume that the universe of discourse is the set of all birds. Express the statements in the
arguments using quantifiers, P(x), Q(x), R(x), S(x) and logical connectives.
Soln
x (P(x) → S(x))
x (Q(x) ∧R(x))
x (R(x)→ S(x))
x (P(x) →Q(x))
Here small means not big and dull means not brightly coloured.
Example 3: Consider the following statements. The first two are premises while the
third is called the conclusion. The entire set is called an argument.
x (P(x) → Q(x))
x (P(x) ∧R(x))
x (Q(x) ∧R(x))
Note that the second statement cannot be written as x (P(x) → R(x)). The reason is
that P(x) → R(x) is true whenever x is not a lion, so x (P(x) → R(x)) is true as long
as there is at least one creature that is not a lion. NEVER USE THE IMPLICATION “→”
WITH .
Let Q(x, y) denote “x + y = 0”. What is the truth value of the following quantifications,
for x, y real numbers.
(i) xy Q(x, y)
(ii) y x Q(x, y)
(iii) xy Q(x, y)
Solution
(i) xy Q(x, y) : For every real number x there is a real number y such that
Q(x, y) is true. This statement is true since y = -x.
(ii) y x Q(x, y): there is a real number y such that for every real x Q(x, y) is
true. This statement is false since when y is chosen it will only apply to only
one value of x.
(iii) xy Q(x, y) : false , a consequence of (ii) above.
Example: Let Q(x,y) denote “x + y = 0”. What are the truth values of the
quantifications y x Q(x,y) and x y Q(x,y)? The universe of
discourse is the set of real numbers.
Solution:
(i)y x Q(x,y) denotes the proposition “ There is a real number y such that
for every real number x, Q(x,y) is true.”
Since there is no value y such that for every real value of x, x + y = 0 then
y x Q(x,y) is false.
(ii)x y Q(x,y) denotes the proposition “ For every real number x, there is a real
number such that Q(x,y) is true.” This is the case when we let y = -x.
Therefore x y Q(x,y) is true.
Methods of Proofs
How do we know that a mathematical argument is correct? What methods can we use to
ensure that it is correct? Here we introduce the rules of inference for propositional logic.
These rules provide the justification of the steps used to show that a conclusion follows
logically from a set of hypotheses. ( See table below)
Rules of Inference
p
————— p → (p ∨q) Addition
∴ p ∨q
p ∧q
————— (p ∧q) → p Simplification
∴p
p
q ((p) ∧(q)) → (p ∧q) Conjunction
—————
∴ p ∧q
p
p →q [p ∧(p → q)] → q Modus ponens
—————
∴ q
¬q
p →q [¬q ∧(p → q)] → ¬ p Modus tollens
—————
∴ ¬p
p →q
q →r [(p → q) ∧(q → r)] → (p → r) Hypothetical syllogism
—————
∴ p →r
p∨q
¬p [(p ∨q) ∧¬ p)] → q Disjunctive syllogism
—————
∴ q
Addition:
1. p
2. Therefore, p or q.
1. It is raining
2. Therefore, either it is raining or the sun is shining.
Conjunction:
1. p
2. q
3. Therefore, p and q.
1. It is raining in Barbados.
2. It is raining in St. Lucia
3. Therefore, it is raining in both Barbados and St. Lucia
Simplification:
1. p and q.
2. Therefore, p.
Modus Ponens:
1. If p then q.
2. p.
3. Therefore, q.
Modus Tollens:
1. If p then q.
2. Not q. (¬q).
3. Therefore, not p (¬p).
Hypothetical Syllogism:
1. If p then q.
2. If q then r.
3. Therefore, if p then r.
Disjunctive Syllogism:
1. Either p or q.
2. Not p (¬p).
3. Therefore, q.
Example 1: Given the hypotheses r → s and ¬s, show that ¬r is a valid conclusion.
Solution:
1. r →s hypothesis (premise)
2. ¬s → ¬r 1, contrapositive
3. ¬s hypothesis (premise)
4. ¬r 2, 3 modus ponens
Solution:
1. p → (r → s) hypothesis (premise)
2. p hypothesis
3. r →s 1, 2 modus ponens
4. ¬ r → ¬p hypothesis
5. p →r 4, contrapositive
6. p →s 3, 5 hypothetical syllogism
7. s 2, 6 modus ponens
Example 3: Show that the hypotheses “It is not sunny this afternoon and it is
colder than yesterday”, “ We will go swimming only if it is sunny”, “If we
do not go swimming, then we will take a canoe trip”, “If we take a canoe
trip, then we will be home by sunset” lead to the conclusion “We will be
home by sunset”.
1. ¬p ∧ q hypothesis
2. ¬p 1, simplification
3. r →p hypothesis
4. ¬r 2, 3 modus tollens
5. ¬r → s hypothesis
6. s 4, 5 modus ponens
7. s →t hypothesis
8. t 6, 7 modus ponens
∀x P(x)
Universal instantiation
∴ P(c) if c ∈ U
∃ x P(x)
Existential instantiation
∴ P(c) for some element c ∈ U
“x < 5” has two parts: The variable “x” is the subject of the statement, while “is
less than 5” is the predicate and refers to the property that
the subject of the statement can have.
The statement “x < 5” can be denoted by P(x) where P denotes “is less than 5” and x is
the variable.
P(x) is also said to be the value of the propositional function P at x. Once a value has
been assigned to the variable x, the statement P(x) becomes a proposition and has a truth
value.
Definition
The universal quantification of P(x) is the proposition “ P(x) is true for all values of x in
the universe of discourse”. The notation:
x P(x): denotes the universal quantification of P(x)
Here denotes the universal quantifier
Example 1: Let P(x) be the statement “x * 0 = 0”. What is the truth value of the
quantification x P(x), where the universe of discourse is the set of real
numbers.
Solution: Since P(x) is true for all real numbers x, (any number multiplied by zero is
zero) then x P(x) is true.
Definition
The existential quantification of P(x) is the proposition “ There exist an element in the
universe of discourse such that P(x) is true”. The notation:
x P(x): denotes the existential quantification of P(x)
Here denotes the existential quantifier
Example: Let P(x) be the statement “x2 > 10 ”. What is the truth value of
quantification x P(x) where the universe of discourse consists of the
positive integers not exceeding 4?
Solution: The universe of discourse is {1, 2, 3, 4}, the proposition x P(x) is the
same as P(1) ∨P(2) ∨P(3) ∨P(4).
Since P(4) , which is the statement “42 > 10” is true, it follows that x
P(x) is true.
We can now use logical operators and quantifiers to express English sentences.
Example: Consider the following statements. The first two are premises while the
third is called the conclusion. The entire set is called an argument.
x (P(x) → Q(x))
x (P(x) ∧R(x))
x (Q(x) ∧R(x))
Note that the second statement cannot be written as x (P(x) → R(x)). The reason is
that P(x) → R(x) is true whenever x is not a lion, so x (P(x) → R(x)) is true as long
as there is at least one creature that is not a lion. NEVER USE THE IMPLICATION “→”
WITH .
The order in which quantifiers appear makes a difference:
Example: Let Q(x,y) denote “x + y = 0”. What are the truth values of the
quantifications y x Q(x,y) and x y Q(x,y)? The universe of
discourse is the set of real numbers.
Solution: y x Q(x,y) denotes the proposition “ There is a real number y such that
for every real number x, Q(x,y) is true.”
Since there is no value y such that for every real value of x, x + y = 0 then
y x Q(x,y) is false.
Negation
¬ x P(x) ⇔ x ¬ P(x)
¬ x Q(x) ⇔ x ¬ Q(x) Negation