4. 1.1 Propositional Logic
• Logic: to give precise meaning to mathematical statements
• Proposition: a declarative sentence that is either true or false, but
not both
• 1+1=2
• Toronto is the capital of Canada
• Propositional variables: p, q, r, s
• Truth value: true (T) or false (F)
4
5.
6.
7.
8. • Compound propositions: news propositions formed from existing
propositions using logical operators
• Definition 1: Let p be a proposition. The negation of p, denoted by p
(orp), is the statement “It is not the case that p.”
• “not p”
8
9.
10.
11. Cont.
• Definition 2: Let p and q be propositions. The
conjunction of p and q, denoted by p q, is the
proposition “p and q.”
• Definition 3: Let p and q be propositions. The
disjunction of p and q, denoted by p q, is the
proposition “p or q.”
11
12.
13.
14.
15.
16.
17.
18.
19.
20. Cont.
•Definition 4: 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.
20
21.
22.
23.
24.
25.
26.
27.
28.
29.
30. Converse, Contrapositive, and Inverse
• p q
• Converse: q p
• Contrapositive: q p
• Inverse: p q
• Two compound propositions are equivalent if they always have the
same truth value
• The contrapositive is equivalent to the original statement
• The converse is equivalent to the inverse
30
31. • p is "I am in the University“, q is "It is Tuesday"
Example
31
p → q
"I am in Univ" → "It is
Tuesday"
If I am in Univ then it is
Tuesday
q → p
"It is Tuesday" → "I am in
Univ"
If it is Tuesday then I am in
Univ
¬q → ¬p
"It is NOT Tuesday" → "I
am NOT in Univ"
If it is NOT Tuesday then I
am NOT in Univ
¬p → ¬q
"I am NOT in Univ" → "It
is NOT Tuesday"
If I am NOT in Univ then it
is NOT Tuesday
32. Biconditionals
• Definition 6: Let p and q be propositions. The biconditional statement
p q is the proposition “p if and only if q.”
• “bi-implications”
• “p is necessary and sufficient for q”
• “p iff q”
32
34. Implicit Use of Biconditionals
• Biconditionals are not always explicit in natural
language
• Imprecision in natural language
• “If you finish your meal, then you can have dessert.”
• “You can have dessert if and only if you finish your meal.”
34
39. Precedence of Logical Operators
• Negation operator is applied before all other logical operators
• Conjunction operator takes precedence over disjunction operator
• Conditional and biconditional operators have lower precedence
• Parentheses are used whenever necessary
39
40.
41. P. 11
41
Examples
1. ¬p → q ↔ p ^ q r =
[((¬p) → q) ↔ ((p ^ q) r)]
2. p ^ ¬q v p ↔ q → r ^ p =
....
42.
43.
44.
45. Examples
45
p q p q p → q (p → q) (p q)
F F F T F
F T T T T
T F T F F
T T T T T
p q ¬p p → q (p → q) ^ ¬p
F F T T T
F T T T T
T F F F F
T T F T F
46. Translating English Sentences
• Example: “You can access the Internet from campus only if you are a
computer science major or you are not a freshman.”
• let a = "You can access the Internet from campus" c="You are a computer
science major" f="You are a freshman“. The sentence can be represented as: a
(c f).
46
47. Exercise
• Ex.13: “You cannot ride the roller coaster if you are
under 4 feet tall unless you are older than 16 years old.”
• ….
47
48. • Translate the following English sentences
1. "The diagnostic message is stored in the buffer or it is
transmitted"
2. "The diagnostic message is not stored in the buffer"
3. "If the diagnostic message is stored in the buffer, then it is
transmitted"
Exercise
48
49. • p is "The diagnostic message is stored in the buffer"
• q is "The diagnostic message is transmitted"
• p q is "The diagnostic message is stored in the buffer
or it is transmitted"
• ¬p is "The diagnostic message is not stored in the
buffer"
• ……… is "If the diagnostic message is stored in the
buffer, then it is transmitted"
Solution
49
53. Logical Equivalence
• Logical Equivalence are Compound propositions that
have the same truth values in all possible cases
• Definition 2: Compound propositions p and q are
logically equivalent if p q is a tautology (denoted
by p q or p q )
• De Morgan’s Law
• (p q) p q
• (p q) p q
53
58. • p is "Ahmad has a cell phone" ,
• q is "Ahmad has a laptop computer."
• p q is "Ahmad has a cell phone." and " Ahmad has a laptop
computer."
• ¬(p q) is "Ahmad does not have a cell phone and a laptop
computer."
• ¬p ¬q is "Ahmad does not have a cell phone or Ahmad does
not have a laptop computer."
• ¬(p q) ≡ ¬p ¬q
Example
58
89. Quantifiers
• Quantification
• Universal quantification: a predicate is true for every
element
• Existential quantification: there is one or more element for
which a predicate is true
89
90.
91.
92.
93.
94.
95.
96.
97.
98. The Universal and Existential Quantifier
• Domain: domain of discourse (universe of discourse عام )خطاب
• Definition 1: The universal quantification of P(x) is the statement “P(x)
for all values of x in the domain”, denoted by x P(x)
• “for all x P(x)” or “for every x P(x)”
• Counterexample: an element for which P(x) is false
• When all elements in the domain can be listed, P(x1) P(x2) … P(xn)
98
• Definition 2: The existential quantification of P(x) is the proposition
“There exists an element x in the domain such that P(x)”, denoted by
x P(x)
• “there is an x such that P(x)” or “for some x P(x)”
• When all elements in the domain can be listed, P(x1) P(x2) … P(xn)
128. Logical Equivalence involving Quantifiers
• Definition 3: two statements S and T involving predicates and
quantifiers are logically equivalent, denoted by S T, if and only if
they have the same truth value no matter which predicates are
substituted and which domain is used
• E.g. x (P(x) Q(x)) x P(x) x Q(x)
128
129. Negating Quantified Expressions
• x P(x) x P(x)
• Negation of the statement “Every student in your class has taken a course in
Preparatory Math 2”
• “There is a student in your class who has not taken a course in Preparatory
Math 2”
• x P(x) x P(x)
129
130. • What are the negations of the following expressions: ∃x
(x=2), ∀x (x2>x), ∃x (x2 =2)
• ¬∃x ( x = 2) ∀x ¬(x=2) ∀x (x ≠ 2 )
• ¬∀x (x2 > x) ∃x ¬(x2> x ) ∃x (x2 ≤ x )
• ¬∃x (x2 = 2) ∀x ¬(x2 = 2 ) ∀x (x2 ≠ 2)
• ¬∀x (x = x2) …
• ¬∃x (x2 < 0) …
• ∃x ¬(x2 > 0) …
Example
130
131.
132.
133.
134. Other Quantifiers
• Uniqueness quantifier: !x P(x) or 1x P(x)
• There exists a unique x such that P(x) is true
• Quantifiers with restricted domains
• x<0 (x2>0)
• Conditional: x(x<0 x2>0)
• z>0 (z2=2)
• Conjunction: z(z>0 z2=2)
134
151. Translating mathematical statements into statements involving
nested quantifiers
• “The sum of two positive integers is always positive”
• ∀x∀y((x > 0) ∧ (y > 0) → (x +y > 0)), domain(x)=domain(y)=ℤ
• ∀x∀y(x +y > 0), domain(x)=domain(y)= ℕ
• “Every real number except zero has a multiplicative
inverse”
(a multiplicative inverse of a real number x is a real
number y such that xy=1)
• ∀x((x ≠ 0) → ∃y(xy = 1)), domain(x)= ℝ
151
152.
153.
154. Translating from nested quantifiers into English
• x (C(x) y (C(y) F(x, y))
• C(x): “x has a computer”, F(x,y): “x and y are friends”
• Domain of x, y: “all students in your school”
• every student in your school has a computer or has a friend who
has a computer
• xyz (F(x, y) F(x, z) (yz) F(y, z))
• F(a, b): “a and b are friends”
• Domain of x, y, z: “all students in your school”
• there is a student none of whose friends are also friends with
each other
154