Chapter Logic - Part2 - 241009 - 102525
Chapter Logic - Part2 - 241009 - 102525
DISCRETE MATHEMATICS
First Grade
Prof. Dr : Magdi Zakaria Prof Dr : Samir Elmougy
Dr : Rasha Sakr
Lecture 2
p q p q p q p q (p q)
TT T F F F F
TF F F T T T
FT F T F T T
FF F T T T T
◼ Show that Check out the solution in the textbook!
◼ (p q) p q (De Morgan’s law)
◼ p → q p q
◼ p (q r) (p q) (p r) (distributive law)
Problems with Truth Table
The above example could easily be solved using a
truth table. But this can only be done for a proposition
having a small number of propositional variables.
When the number of variables grows the truth table
method becomes impractical.
For a proposition having 20 variables, 220 rows have to
be evaluated in the truth table. This may be easy to do
with a computer, but even a computer would fail in
computing the truth table of a proposition having
1000 variables.
Equivalence Laws
◼ Atomic propositions: p, q, r, …
◼ Boolean operators: →
◼ Compound propositions: (p q) r
◼ Equivalences: pq (p → q)
◼ Proving equivalences using:
◼ Truth tables
equivalences) p q r
1.3 Predicate Logic
◼ A proposition is the basic building block of logic. It is defined as a
declarative sentence that is either True or False, but not both.
◼ "Every person who is 18 years or older, is eligible to vote.“
◼ The above statement cannot be adequately expressed using only
propositional logic. The problem in trying to do so is that
propositional logic is not expressive enough to deal with
quantified variables. It would have been easier if the statement
were referring to a specific person. But since it is not the case and
the statement applies to all people who are 18 years or older, we
are stuck.
Therefore we need a more powerful type of logic.
Propositional Functions
Propositional Functions
What is a predicate?
Definition :
A statement of the form P(x1, x2, . . . , xn) is the value of the propositional function P. Here,
(x1, x2, . . . , xn) is an n-tuple and P is a predicate.
Example 1: Let P(x) denote the statement “x > 10″. What are the truth
values of P(11) and P(5)?
Solution: P(11) is equivalent to the statement 11 > 10, which is True.
P(5) is equivalent to the statement 5 > 10, which is False.
Example 2: Let R(x,y) denote the statement “x = y + 1“. What is the truth
value of the propositions R(1,3) and R(2,1)?
Solution: R(1,3) is the statement 1 = 3 + 1, which is False.
R(2,1) is the statement 2 = 1 + 1, which is True.
More About Predicates
◼ Convention: Lowercase variables x, y, z...
denote subjects; uppercase variables P, Q,
R… denote propositional functions (or
predicates).
◼ Keep in mind that the result of applying a
predicate P to a value of subject x is the
proposition. But the predicate P, or the
statement P(x) itself (e.g. P = “is sleeping” or
P(x) = “x is sleeping” ) is not a proposition.
◼ e.g. if P(x) = “x is a prime number”,
Q(x,y)
Q(x,3)
Q(1,1)
Q(5,−4)
For those that are, determine their truth values.
Answer
Both (a) and (b) are not propositions, because they contain at least one variable.
Both (c) and (d) are propositions; Q(1,1) is false, and Q(5,−4) is true.
discourse)
◼ false if P(x) is false for at least one x in D
∀x(Q(x) → P(x))
Universal Quantifier Example
1- The statement
“For any real number x , we always have x2≥0 ”
is true. Symbolically, we can write ∀x∈ ℝ(x2 ≥0),or ∀x(x∈ ℝ ⇒ x2 ≥0).
2- The statement
∀x∈ℝ (x>5)
For example:
There is exactly one natural number x such that
x - 2 = 4.
Symbolically, this can be written:
∃!x in N, x - 2 = 4
Example
Exercise : Let P(x) be the predicate x2 − x > 0 with domain the set R.
Write P(2) and P(1/2)
Example
To prove that a statement of the form “ ∃xP(x) ” is true,
it suffices to find an example of x such that P(x) is
true. Using this guideline, can you determine whether
these two propositions
∃x∈ ℝ (x>5)
∃x∈ ℝ ( 𝑥=0)
are true?
Answer
True. For example: x=6 .
True. For example: x=0 .
Example
Let P(x) be the statement x2 ≥ x.
(i) What are truth values of the propositions P(1) , P(-1) , P(0) and P( ½)
ii) What is the truth value of the proposition ∀xP(x), where the domain consists of all
real numbers?
(iii) What is the truth value of the proposition ∀xP(x), where the domain consists of all
integers?
a) P(x):x2 ≥ x.
i) P(1): 1=1 true
P(-1): 1>-1 true
P(0): 0=0 true
P(1/2): 1/4<1/2 false
iii)Answer: true
Example
- if P(x): x2 > x defined on ℤ , what is the truth values for
∃!x P(x) ∃x P(x) ∀x P(x)
∃!x P(x) is “F” ( For example: P(x=-2)and P (x=3) is “T”)
∃x P(x) is “T” ( For example :P(x=-3) is “T”)
∀ x P(x) is “F” ( For example :P(x=0) is “F” and P(x=1) is “F” )
calculus.”
◼ If domain for x consists of the students in this
class, then
◼ it can be translated as x C(x)
or
◼ If domain for x consists of all people
◼ Let S(x) be the predicate: “x is in this class”
◼ Translation: x (S(x) → C(x))
Translating from English
◼ Express the statement “Some students in this
class has visited Mexico” using predicates and
quantifiers.
◼ Let M(x) be the statement: “x has visited
Mexico”
◼ If domain for x consists of the students in this
class, then
◼ it can be translated as x M(x)
or
◼ If domain for x consists of all people
Theorem:
◼ Generalized De Morgan's laws for logic
1. x P(x) x P(x)
2. x P(x) x P(x)
Negations: Examples
◼ What are the negations of the statements
x (x2 x) and x (x2 =2)?
◼ x (x2 x) x (x x) x (x2 x)
2