chapter 1 part 2 - stud
TRANSCRIPT
1
Introduction to Logic
Differentiate and write the Predicates and Quantifiers .
Write Proposition Equivalences; Truth tables; Implication and equivalence; Tautology; Contradiction and Contigency;
Write the Negation Quantifiers Expressions and determine its truth values
2DCS5028
A compound proposition may have many component parts, each of which is itself a proposition, represented by some propositional variable.
The proposition s: p ⋁ (q ⋀ r) involves three propositions, p,q and r.
If a compound statement s contains n proposition variables, there will need to be 2n rows in the truth table for s.
DCS50283
s: p ⋁ (q ⋀ r) 3 variables, therefore need 23 = 8 rows
DCS50284
p q r q r p⋁ (q ⋀ r)T T TT T FT F TT F FF T TF T FF F TF F F
⋀TFFFTFFF
TTTTTFFF
Make a truth table for the proposition (p⋀ q)⋁ (~p)
Answer:
DCS50285
PROPOSITIONAL PROPOSITIONAL EQUIVALENCESEQUIVALENCES
Propositional Equivalence consist of three types;
TautologyContradictionContingency
6DCS5028
A tautology occurs when a compound proposition that is true for all possible values of its proposition variables.
Example:
(p q ) p
7DCS5028
(p q ) p
8
p q p q (p q ) pT T T TT F F TF T F TF F F T
DCS5028
A contradiction occurs when a compound proposition is always false.always false.
Example:
((p q)q)p
9DCS5028
((p q)q)p
10
p q p q (p q)q ((p q)q)pT T F F FT F T F FF T T T FF F F F F
DCS5028
A contingency occurs when a compound proposition is neither a Tautology nor a Contradiction (consists both true and false value for different combination of propositions that involve)
Example
11
(( ) )p q q p DCS5028
(( ) )p q q p
12
p q pq (pq)q ((pq)q)p
T T T T TT F F F TF T T T FF F T F T
DCS5028
State whether the proposition below is tautology, contradiction or contingency.
13
)()( qpqp
DCS5028
)()( qpqp
14
p q
DCS5028
LOGICAL EQUIVALENCELOGICAL EQUIVALENCE Two different compound propositions
are logically equivalent if they have the same truth-values no matter what truth-values their constituent propositions have.
The notation p q denotes that p and q are logically equivalent if p ↔ q is tautology.
15DCS5028
ExampleProve or disprove that and
is a logical equivalence.
It is not a logical equivalence
16
))(( qpq ))(( qpp
DCS5028
The operations for propositions have the following properties.
DCS502817
Commutative Properties1. p ⋁ q ≡ q ⋁ p2. p ⋀ q ≡ q ⋀ pAssociative Properties3. p ( ⋁ q ⋁ r)≡ (p ⋁ q) r⋁4. p ( ⋀ q ⋀ r)≡ (p ⋀ q) r⋀Distributive Properties5. p ( ⋁ q ⋀ r)≡ (p ⋁ q)⋀ (p r)⋁6. p ( ⋀ q ⋁ r)≡ (p ⋀ q) ⋁(p r)⋀
DCS502818
Idempotent Properties7. p ⋁ p ≡ p8. p ⋀ p ≡ p
Properties of Negation9. ~(~p) ≡ p10. ~(p ⋁ q) ≡ (~ p) ⋀ (~q)11. ~(p ⋀ q) ≡ (~ p) ⋁ (~q)
De Morgan’s Laws
The implication operation also has a number of important properties.
DCS502819
Properties for implication operation1. p → q ≡ ( (~ p) ⋁ q )2. p → q ≡ (~ q → ~p )3. (p ↔q) ≡ ((p → q) ⋀ (q →p))4. ~ (p → q) ≡ (p ⋀~q )4. ~ (p ↔q) ≡ ((p ⋀~q ) ⋁ (q ⋀~p))
Exercise:1. Show the following De morgan’s Law
for Logic are logically equivalence.
2. Prove the conditional (or implication) proposition p→ q and its contrapositive are logically equivalence.
DCS5028
20
qp
qpqp )( qpqp )(
PREDICATES AND PREDICATES AND QUANTIFIERSQUANTIFIERS
Predicate and quantifiers are usually used when involved in mathematical equation in computer programs such as “x> 3,” “x=y+3” and “x + y=z”.
This is usually involved one variable (or more variables).
These statements are either true or false as it depends on the values of variables.
21DCS5028
An element of {x | P(x)} is an object t for which the statement P(t) is true.
Such a sentence P(x) is called a predicate.
P(x) is also called a propositional function because each choice of x produces a proposition P(x) that is either true or false.
22DCS5028
Let A = {x | x is an integer less than 8}. P(x) is the sentence “ x is an integer less
than 8” The common property is “is an integer less
than 8” x =1, P(1) is the statement “1 is an integer
less than 8”which is true.
DCS502823
A. Single VariableLet P(m) denote the statement “(m + 80 * m) / m = 81”. What are the truth values of P(8) and P(6)?
Solution: P(8), replace m with 8 in the “(8 + 80 * 8)
/ 8 = 81” statement. FALSE P(6), replace m with 6 in the “(6 + 80 * 6)
/ 6 = 81” statement. TRUE
24DCS5028
B. Multiple VariablesLet Q(x,y) denote the statement “ x = y + 8” What are the truth values of the propositions Q(15,7) and Q(20,8)?
25DCS5028
26DCS5028
C. ‘n’ variablesLet R(x,y,z) denote the statement “(y + 2) - (x * 6) = z” what are the truth values of the propositions R(1,2,3) and R(5,32,4).
27DCS5028
28DCS5028
When all variables assigned with values, the resulting statement becomes a proposition with certain truth-value.
But there is another way to make the statement becomes proposition with certain truth-value, called Quantification.
29DCS5028
There are two types of quantifiers; A. Universal Quantifier B. Existential Quantifier
DCS502830
A logical quantifier(operator containing a variable) of a proposition that asserts that the proposition is true for every element in a domain of discourse or of a type.
The universal quantification of P (x) is the proposition
“P (x) is true for all values of x in the universe of discourse”
31DCS5028
The notation xP(x) denotes the universal quantification of P (x).
-Called universal quantifier
The proposition xP(x) is read as “for all x, P(x)” “for every x, P(x)” “for any x, P(x)”
32DCS5028
Example 1:Let P(x) be the statement “x likes Discrete Structure” where the universe of discourse consists of a set of students. Write x P(x) in words:
Answer:All students like Discrete Structure
DCS502833
Example 2:Let P(x) be the statement “x2+1>x.” What is the truth value of the quantification x P(x), where the universe of discourse consists of all positiveintegers
AnswerSince P(x) is true for all positive integers x, the quantification x P(x) is TRUE.
34DCS5028
A logical quantifier of a proposition that asserts the existence of at least one thing for which the proposition is true
The existential quantification of P (x) is the proposition where there exist an element x in the universe of discourse such that P (x) is true”
35DCS5028
We use the notation xP(x) for the existential qualification of P(x). is called existential quantifier.
The existence quantification xP(x) is read as “There is an x such that P (x)” “There is at least one x such that P (x) “For some x, P(x)”
36DCS5028
Example 1:Let P(y) be the statement “y likes Discrete Structure” where the universe of discourse consists of a set of students. Write y P(y) in words:
AnswerSome students like Discrete Structure
OrNot all Students like Discrete Structure
DCS502837
Example 2:Let P(x) be the statement “x > 5 .” What is the truth value of the quantification x P(x), where the universe of discourse consists of a set of positive integers
AnswerSince P(6) is true, the quantification x P(x) is TRUE.
38DCS5028
39
QuantifiersStatement When True? When False?
x P(x)(Conjunction)
P(x) true for every x(All x must be true)
There is an x for which P(x) is false(At least one x is false)
xP(x)(Disjunction)
There is an x for which P(x) is true(At least one x is true)
P(x) false for every x(All x must be false)
DCS5028
Let P(x) be “x has taken a course in Program Design” and the domain of discourse consist of the students in the class. Write the universal quantifiers and existential quantifiers for the P(x). What is the truth value of the statement for Universal Quantifier and Existential Quantifier in your class?
40DCS5028
x P(x) = All student in the class has taken a course in Program Design, FALSE/ TRUE
xP(x) = Some students in the class has taken a course in Program Design, TRUE
41DCS5028
NEGATION QUANTIFIERS NEGATION QUANTIFIERS EXPRESSIONSEXPRESSIONS Sometimes we need to negate a
quantified expression. Let us look at the effect of negation to the Universal and Existential Quantifiers.
42
Example: “Every student in the class wear black colour T-
Shirt ” This statement is a universal
quantification, named with x P(x), where P(x)- “ x wear black colour T-Shirt ”
Question: What is the negation quantifier
expression?
43
Solution: Negation to the Universal Quantification:
(x P(x)) = x P (x)
“It is not the case that every student in the class wears black colour T-Shirt ” OR “There is a student in the class who is not wearing a black colour T-Shirt ”
44
Example:“At least one student in Discrete Structures
class has taken Mathematical Techniques 1”
This statement is an existential quantification, named with x P (x) where P(x)- “x has taken Mathematical Techniques 1”
Question: What is the negation quantifier expression?
45
Solution: Negation to the Existential Quantification:
( x P(x)) = x P(x)“Every student in Discrete Structures class has not taken Mathematical Techniques 1”
OR“All student in Discrete Structures class has not taken Mathematical Techniques 1”.
46
• The rules for negations for quantifiers are called De Morgan’s Law for Quantifiers.
Negation Equivalent Statement
When is Negation
True?
When False?
¬(x P(x)) x ¬P(x) For every x, P(x) is false.
There is an x for which P(x) is true
¬(x P(x)) x ¬P(x) There is an x for which P(x) is false
P(x) is true for every x
47
COUNTEREXAMPLECOUNTEREXAMPLE To conclude that a statement of the form x
P(x) is false, where P(x) is a propositional function, we need only to find a value of x in the universe of discourse for which P(x) is false.
Such a value of x is called the counterexample to the statement x P(x).
For example, the prime number 2 is a counterexample to the statement "All prime numbers are odd."
48
Let q(x) denotes “x2 ≤ 10”. What are the truth values of the quantifications x q(x) and x q(x), where the domain of discourse consists of 0, 1, 2, 3 and 4?
49
When the domain of discourse is {0, 1, 2, 3, 4}, a counterexample to the statement x (x2 ≤ 10) is 4, since 42 = 16 is not ≤ 10.
Hence the statement x (x2 ≤ 10) is false.
But the statement x q(x), is true.
50
Propositional Equivalence consist of three types; TautologyContradictionContingency
Predicates - involved one variable (or more variables)
Quantifiers (Universal Quantifier , Existential Quantifier)
Negations Quantifiers Expressions
51DCS5028
REVIEW QUESTIONSREVIEW QUESTIONS1. Build a truth table to verify that the
proposition ( p q ) ( p q ) is a contradiction.
2. Show that ( p q ) ( q p ) is logically equivalent to p q
3. Let P(x) denote the statement “x + 1 > 7”. What are the truth values for these propositions? P(1) P(8) P(6)
52
DCS5028
REVIEW QUESTIONSREVIEW QUESTIONS4. Let P(n) be the propositional function “n < 66”. Write
each proposition below in words and tell whether it’s true or false. The domain of discourse is a set of positive integers. n P(n) n P(n)
5. Let P(x) denote the statement “x spends more than 3 hours every weekend in the library”, where the universe of discourse for x consists of all students. Write each propositions below in words: x P(x) x P(x)
53DCS5028
REVIEW QUESTIONSREVIEW QUESTIONS6. Let P(m) denote the statement “m is taking an IT
course”, where the universe of discourse for m is a set of students. Translate each of these statements into logical expression using predicates and quantifiers.
Some students are taking an IT course. All students are taking an IT course.
54DCS5028
REVIEW QUESTIONSREVIEW QUESTIONS7. Let P(x) denote the statement “x spends more
than 3 hours every weekend in the library”, where the universe of discourse for x consists of all students. Write each propositions below in words: ◦ x P(x)◦ x P(x)
8. Let P(m) denote the statement “m is taking an IT course”, where the universe of discourse for m is a set of students. Translate each of these statements into logical expression using predicates and quantifiers.◦ All students are not taking an IT course.◦ There is a student who is not taking an IT course.
55
REVIEW QUESTIONSREVIEW QUESTIONS9. Let P(y) be the propositional function y+1 > y. The domain
of discourse is the set = {y | 0 < y < 5} Write each proposition below in words and tell whether
each proposition below is true or false.
(a) y P(y)(b) y P(y)(c) (yP(y))(d) (y P(y))
56