Uploaded by FAKEDUN LIT

Chap1 Propositional logic (HT)

advertisement
DISCRETE MATHEMATICS
&
APPLICATIONS
1
Chapter 1: Propositional Logic
1.1. Propositional Logic
1.2. Propositional Equivalences
1.3. Predicates and Quantifiers
1.4. Nested Quantifiers
1.5. Rules of Inference
2
1.1
Propositional Logic
3
DEFINITION
Definition. A proposition is a declarative sentence that is either true or false.
Examples. (1) If π‘₯ is divisible by 6 then π‘₯ is divisible by 3.
(2) 1 is the smallest prime number.
(3) After rain comes sunshine!
(4) π‘₯ + 2 > 0.
(5) For every π‘₯ ∈ ℝ, if π‘₯ + 3 ≥ π‘Ž and π‘Ž ≤ 1 then π‘₯ ≥ −2.
Convention. If a proposition 𝑝 is true then we say that its truth value is true (denoted by 𝑇).
Otherwise, we will say that the truth value of 𝑝 is false (denoted by 𝐹).
4
COMPOUND PROPOSITIONS
Definition. Let 𝑝 be a proposition.
(1) The negation of 𝑝:
¬π‘ = not 𝑝 = proposition that is true if 𝑝 is false, and is false if 𝑝 is true.
Example.
𝑝 = "She is not only naughty but also obstinate".
¬π‘ = "She is neither naughty nor obstinate".
5
COMPOUND PROPOSITIONS
Let 𝑝 and π‘ž be two propositions.
(2) The conjunction of 𝑝 and π‘ž:
𝑝 ∧ π‘ž = "𝑝 and π‘ž" = proposition that is true when both 𝑝 and π‘ž are true, and is false otherwise.
Example.
Let 𝑝 = "She is very naughty",
π‘ž = "She is not obstinate".
𝑝 ∧ π‘ž = "She is very naughty but not obstinate".
6
COMPOUND PROPOSITIONS (cont.)
Let 𝑝 and π‘ž be two propositions.
(3) The disjunction of 𝑝 and π‘ž:
𝑝 ∨ π‘ž = "𝑝 or π‘ž"= proposition that is false when both 𝑝 and π‘ž are false, and is true otherwise.
Example.
𝑝 = "Students who have missed more than 6 slots can not pass this class".
π‘ž = "Students who have not taken any progress test can not pass this class".
𝑝 ∨ π‘ž = "Students who have not taken any progress or have missed more than 6 slots can not pass this class.
7
COMPOUND PROPOSITIONS (cont.)
Let 𝑝 and π‘ž be two propositions.
(4) The exclusive or of 𝑝 and π‘ž:
𝑝 ⊕ π‘ž = "only 𝑝 or only π‘ž" = proposition that is true when exactly one of 𝑝 and π‘ž is true, and is false
otherwise.
Example.
𝑝 = "You can adopt a cat".
π‘ž = "You can adopt a hamster".
𝑝 ⊕ π‘ž = "You can adopt a cat or a hamster, but not both".
8
COMPOUND PROPOSITIONS (cont.)
Let 𝑝 and π‘ž be two propositions.
(5) Conditional statement:
𝑝 ⟢ π‘ž = "if 𝑝 then π‘ž" = proposition that is false when 𝑝 is true and π‘ž is false, and is true
otherwise.
Example.
𝑝 = "You get a 9 on the final exam".
π‘ž = "You will pass this class".
9
COMPOUND PROPOSITIONS (cont.)
Let 𝑝 and π‘ž be two propositions.
(6) Biconditional statement:
𝑝 ⟷ π‘ž = proposition that is true when 𝑝 and π‘ž have the same truth value, and is false otherwise.
Example.
𝑝 = "He is now at least 18 years old".
π‘ž = "He is allowed to get married this year".
10
SUMMARY
Remark. A bit is a symbol taking two values, 0 and 1. A bit can represent the truth value of a
proposition:
1 = π‘‡π‘Ÿπ‘’π‘’ and 0 = πΉπ‘Žπ‘™π‘ π‘’.
Table. Combined truth table using bit operations.
11
LOGICAL EXPRESSIONS
Example. Translate the following propositions into logical expressions.
(1) When I am over 25, I will marry her.
Put
𝑝 = "I am over 25 years old",
π‘ž = "I marry her".
Then logical expression of (1) is 𝑝 ⟢ π‘ž.
(2) I would marry Daisy or Kate when I am rich and famous.
Put
𝑝 = "I am rich" , π‘ž = "I am famous"
π‘Ÿ = "I marry Daisy" and 𝑠 = "I marry Kate".
Then logical expression of (2) is (𝑝 ∧ π‘ž) ⟢ (π‘Ÿ ⊕ 𝑠).
12
1.2
Propositional Equivalences
13
LOGICAL EQUIVALENCES
Definition. (1) A compound proposition that is always true, no matter what the truth values of
propositions that occur in it, is called a tautology.
(2) A compound proposition that is always false is called a contradiction.
(3) A compound proposition that is neither a tautology nor a contradiction is called a contigency.
Definition. Two compound propositions are said to be (logically) equivalent if (𝑝 ⟷ π‘ž) is a
tautology.
If 𝑝 and π‘ž are equivalent, we will write
𝑝 ≡ π‘ž.
14
SOME BASIC LOGICAL EQUIVALENCES
15
LOGICAL EQUIVALENCES - TRUTH TABLE METHOD
In practice, one can verify logical equivalences using truth tables.
Example. Prove that ¬(𝑝 ⊕ π‘ž) ≡ (¬π‘ ∨ π‘ž) ∧ (𝑝 ∨ ¬π‘ž).
𝑝
π‘ž
0
0
0
1
1
0
1
1
𝑝⊕π‘ž
¬(𝑝 ⊕ π‘ž)
(¬π‘ ∨ π‘ž) ∧ (𝑝 ∨ ¬π‘ž)
16
PRACTICE
Verify the following logical equivalences.
(a) 𝑝 ⟢ π‘ž ≡ ¬π‘ ∨ π‘ž ≡ (¬π‘ž) ⟢ (¬π‘).
(b) 𝑝 ⟷ π‘ž ≡
π‘βŸΆπ‘ž ∧ π‘žβŸΆπ‘ .
(c) ¬(𝑝 ⊕ π‘ž) ≡ (¬π‘ ∨ π‘ž) ∧ (𝑝 ∨ ¬π‘ž).
(d) 𝑝 ⊕ π‘ž ≡ ¬ 𝑝 ⟷ π‘ž .
(e) ¬ 𝑝 ⟢ π‘ž ≡ 𝑝 ∧ ¬π‘ž.
17
1.3
Predicates and Quantifiers
18
PREDICATE
Statements involving variables such as
"π‘₯ > 3", "π‘₯ + 𝑦 ≤ 5", "π‘₯ + 𝑦 = 𝑧"
are not propositions. Such statements are called propositional function.
Example. Consider 𝑃 π‘₯ = "π‘₯ > 3". For specified values of π‘₯, then it becomes a proposition. For
instance, 𝑃 1 = πΉπ‘Žπ‘™π‘ π‘’ and 𝑃 4 = π‘‡π‘Ÿπ‘’π‘’.
Remark. In 𝑃 π‘₯ , the symbol "π‘₯" is called variable and the part " > 3" is called predicate.
19
QUANTIFIERS: ∀, ∃
Let 𝑃(π‘₯) be a propositional function.
∎
Universal quantification:
∀π‘₯𝑃 π‘₯ = "For all values of π‘₯, 𝑃(π‘₯) is true".
∎
Existential quantification:
∃π‘₯𝑃(π‘₯) = "There is at least a value of π‘₯ such that 𝑃(π‘₯) is true".
20
LOGICAL EXPRESSIONS WITH QUANTIFIERS
Example. For each of the following statements, find a logical expression using quantifiers and
propositional functions.
(1)
"Every prime number is not divisible by 2".
Solution. First, introduce a variable π‘₯:
"For every number π‘₯ that is prime, π‘₯ is not divisible by 2".
Next, put 𝑃 π‘₯ = "π‘₯ is not divisible by 2".
With the domain 𝐷 = π‘π‘Ÿπ‘–π‘šπ‘’ π‘›π‘’π‘šπ‘π‘’π‘Ÿπ‘  , we find the logical expression
∀π‘₯𝑃 π‘₯ .
21
"Some student in HT’s class has visited Thach That district".
(2)
Solution. First, introduce a variable π‘₯:
"There is a student π‘₯ in HT’s class with the property that π‘₯ has visited Thach That district".
Next, put 𝑃 π‘₯ = "π‘₯ has visited Thach That district".
With the domain 𝐷 = {students in HT’s class}, we find the logical expression
∃π‘₯𝑃 π‘₯ .
(3)
"Every student of FPT University has visited Thach That and Quoc Oai".
Solution.
22
1.4
Nested Quantifiers
23
NESTED QUANTIFIERS
Exercise. Translate the following statements into English, where the domain of variables is ℝ.
a) ∀π‘₯∃𝑦𝑃 π‘₯, 𝑦 where 𝑃 π‘₯, 𝑦 = "π‘₯ < 𝑦".
b) ∃π‘₯∀𝑦𝑄 π‘₯, 𝑦 where 𝑄 π‘₯, 𝑦 = "π‘₯ + 𝑦 ≥ 𝑦".
c) ∀π‘₯∀𝑦𝑅 π‘₯, 𝑦 where 𝑅 π‘₯, 𝑦 = "[(π‘₯ ≥ 0) ∧ (𝑦 ≥ 0)] ⟢ (π‘₯𝑦 ≥ 0)".
24
LOGICAL EXPRESSIONS WITH NESTED QUANTIFIERS
Examples. For each of the following statements, find a logical expression using quantifiers and
propositional functions.
(1)
"Some student of FPT University gave flowers to all female students".
Solution. First, introduce two variables π‘₯ and 𝑦:
"There is a student π‘₯ of FPT University gave flower to all students 𝑦 that are female".
Next, put 𝑃 π‘₯, 𝑦 = "π‘₯ gave flower to 𝑦" and 𝑄 𝑦 = "𝑦 is female".
With the domain 𝐷 = {students of FPTU}, we find the logical expression
∃π‘₯∀𝑦 𝑄 𝑦 ⟢ 𝑃 π‘₯, 𝑦 .
25
(2)
"If a person is female and is a parent, then this person is someone’s mother".
Solution. First, introduce two variables π‘₯ and 𝑦:
"For every person π‘₯, if π‘₯ is female and π‘₯ is a parent, then there is a person 𝑦 such that π‘₯ is the
mother of 𝑦".
Next, put
𝑃 π‘₯, 𝑦 = "π‘₯ is the mother of 𝑦", 𝑄 π‘₯ = "π‘₯ is female"
and 𝑅 π‘₯ = "π‘₯ is a parent".
With the domain 𝐷 = {all people}, we find the logical expression
∀π‘₯∃𝑦 𝑄 π‘₯ ∧ 𝑅 π‘₯
⟢ 𝑃 π‘₯, 𝑦 .
26
NEGATING NESTED QUANTIFIERS
(1) ¬ ∀π‘₯𝑃 π‘₯
≡ ∃π‘₯¬π‘ƒ(π‘₯).
(2) ¬ ∃π‘₯𝑃 π‘₯
≡ ∀π‘₯¬π‘ƒ(π‘₯).
(3) ¬ ∀π‘₯∀𝑦𝑃 π‘₯, 𝑦
≡ ∃π‘₯∃𝑦¬π‘ƒ(π‘₯, 𝑦).
(4) ¬ ∃π‘₯∀𝑦𝑃 π‘₯, 𝑦
≡ ∀π‘₯∃𝑦¬π‘ƒ(π‘₯, 𝑦).
(5) ¬ ∃π‘₯∃𝑦𝑃 π‘₯, 𝑦
≡ ∀π‘₯∀𝑦¬π‘ƒ(π‘₯, 𝑦).
(6) ¬ ∀π‘₯∃𝑦𝑃 π‘₯, 𝑦
≡ ∃π‘₯∀𝑦¬π‘ƒ(π‘₯, 𝑦).
27
1.5
Rules of Inference
28
AN EXAMPLE
Example. Suppose we have an argument:
"If you have one million dollars, then you can buy a villa".
Put
𝑝 = "You have one million dollars" and π‘ž = "You can buy a villa".
How do we deduce that π‘ž is true provided 𝑝 is true?
Observe that 𝑝 ∧ 𝑝 ⟢ π‘ž
⟢ π‘ž is a tautology.
Now, since both 𝑝 and 𝑝 ⟢ π‘ž are true, it implies that π‘ž must be true also.
∎
In summary, the process of inference can be depicted as
29
DEFINITIONS
Definition. (1) An argument is a sequence of propositions
𝑝1 , 𝑝2 , β‹― , 𝑝𝑛 , π‘ž.
The final proposition π‘ž is called the conclusion, while 𝑝1 , β‹― , 𝑝𝑛 are called premises.
(2) An argument is said to be valid if the truth of all premises implies that the conclusion is true.
(3) The verification of validity must be based on a tautology. Otherwise, arguments are called
fallacies.
30
TABLE: RULES OF INFERENCES
31
Example. Show that the following premises
"If you send me an email, then I will finish writing the program",
"If you do not send me an email, then I will go to sleep early",
"If I go to sleep early, then I will wake up feeling refreshed"
together lead to the conclusion
"If I do not finish writing the program, then I will wake up feeling refreshed".
Solution. Put 𝑝1 = "You send me an email",
𝑝3 = "I will go to sleep early",
𝑝2 = "I will finish writing the program",
𝑝4 = "I will wake up feeling refreshed".
π‘ž = (¬π‘2 ⟢ 𝑝4 ).
32
TABLE: RULES OF INFERENCES FOR QUANTIFIED STATEMENTS
33
EXAMPLE
Example. Show that the following premises
𝑝1 = "Everyone in this class has taken a course in computer science",
𝑝2 = "Jillian is a student in this class"
together lead to the conclusion "Jillian has taken a course in computer science".
Solution. 𝑃 π‘₯ = "π‘₯ has taken a course in computer science".
With domain 𝐷 = students in this class , the logical expression of 𝑝1 is ∀π‘₯𝑃 π‘₯ .
Put 𝑐 = Jillian, we have 𝑐 ∈ 𝐷.
The inference is
34
PRACTICE
35
PRACTICE
36
PRACTICE
37
PRACTICE
38
PRACTICE
39
PRACTICE
40
PRACTICE
41
PRACTICE
42
PRACTICE
43
PRACTICE
44
45
46
47
48
49
50
51
Download