0% found this document useful (0 votes)
58 views38 pages

Logics (Cont.) : Discrete Structures For Computing On 08 March 2011

The document discusses predicates, quantifiers, and translating statements into logical expressions in predicate logic. It defines predicates, truth values of predicates, universal and existential quantifiers, and provides examples of translating statements about students, friends, and family relationships into logical expressions using quantifiers and predicates.

Uploaded by

Trần Kha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views38 pages

Logics (Cont.) : Discrete Structures For Computing On 08 March 2011

The document discusses predicates, quantifiers, and translating statements into logical expressions in predicate logic. It defines predicates, truth values of predicates, universal and existential quantifiers, and provides examples of translating statements about students, friends, and family relationships into logical expressions using quantifiers and predicates.

Uploaded by

Trần Kha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Logics (cont.

Huynh Tuong Nguyen,


Tran Huong Lan

Chapter 2
Logics (cont.)
Discrete Structures for Computing on 08 March 2011

Huynh Tuong Nguyen, Tran Huong Lan


Faculty of Computer Science and Engineering
University of Technology - VNUHCM
2.1
Logics (cont.)
Contents
Huynh Tuong Nguyen,
Tran Huong Lan

2.2
Logics (cont.)
Limits of Propositional Logic
Huynh Tuong Nguyen,
Tran Huong Lan

x>3
All square numbers are not prime numbers. 100 is a square
number. Therefore 100 is not a prime number.

2.3
Logics (cont.)
Predicates
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
A predicate (v t) is a statement containing one or more
variables. If values are assigned to all the variables in a predicate,
the resulting statement is a proposition (mnh ).

Example:
x > 3 (predicate)
5 > 3 (proposition)
2 > 3 (proposition)

2.4
Logics (cont.)
Predicates
Huynh Tuong Nguyen,
Tran Huong Lan

x > 3 P (x)
5 > 3 P (5)
A predicate with n variables P (x1 , x2 , ..., xn )

2.5
Logics (cont.)
Truth value
Huynh Tuong Nguyen,
Tran Huong Lan

x > 3 is true or false?


5>3
For every number x, x > 3 holds
There is a number x such that x > 3

2.6
Logics (cont.)
Quantifiers
Huynh Tuong Nguyen,
Tran Huong Lan

: Universal Vi mi
xP (x) = P (x) is T for all x
: Existential Tn ti
xP (x) = There exists an element x such that P (x) is T
We need a domain of discourse for variable

2.7
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Example
Let P (x) be the statement x < 2. What is the truth value of the
quantification xP (x), where the domain consists of all real
number?

P (3) = 3 < 2 is false


xP (x) is false

3 is a counterexample (phn v d) of xP (x)

Example
What is the truth value of the quantification xP (x), where the
domain consists of all real number?

2.8
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Example
Express the statement Some student in this class comes from
Central Vietnam.

Solution 1

M (x) = x comes from Central Vietnam


Domain for x is the students in the class
xM (x)

Solution 2

Domain for x is all people


...

2.9
Logics (cont.)
Negation of Quantifiers
Huynh Tuong Nguyen,
Tran Huong Lan

Statement Negation Equivalent form


xP (x) (xP (x)) xP (x)
xP (x) (xP (x)) xP (x)

Example

All CSE students study Discrete Math 1


Let C(x) denote x is a CSE student
Let S(x) denote x studies Discrete Math 1
x : C(x) S(x)
x : (C(x) S(x)) x : C(x) S(x)
There is a CSE student who does not study Discrete Math 1.

2.10
Logics (cont.)
Another Example
Huynh Tuong Nguyen,
Tran Huong Lan

Example
Translate these:
All lions are fierce.
Some lions do not drink coffee.
Some fierce creatures do not drink coffee.

Solution
Let P (x), Q(x) and R(x) be the statements x is a lion, x is
fierce and x drinks coffee, respectively.
x(P (x) Q(x)).
x(P (x) R(x)).
x(Q(x) R(x)).

2.11
Logics (cont.)
The Order of Quantifiers
Huynh Tuong Nguyen,
Tran Huong Lan

The order of quantifiers is important, unless all the quantifiers


are universal quantifiers or all are existential quantifiers
Read from left to right, apply from inner to outer

Example
x y (x + y = y + x)
T for all x, y R

Example
x y (x + y = 0) is T,
while
y x (x + y = 0) is F

2.12
Logics (cont.)
Translating Nested Quantifiers
Huynh Tuong Nguyen,
Tran Huong Lan

Example
x (C(x) y (C(y) F (x, y)) )
Provided that:
C(x): x has a computer,
F (x, y): x and y are friends,
x, y all students in your school.

Answer
For every student x in your school, x has a computer or there is a
student y such that y has a computer and x and y are friends.

2.13
Logics (cont.)
Translating Nested Quantifiers
Huynh Tuong Nguyen,
Tran Huong Lan

Example
xyz (((F (x, y) F (x, z) (y 6= z)) F (y, z)))
Provided that:
F (x, y): x, y are friends
x, y, z all students in your school.

Answer
There is a student x, so that for every student y, every student z
not the same as y, if x and y are friends, and x and z are friends,
then y and z are not friends.

2.14
Logics (cont.)
Translating into Logical Expressions
Huynh Tuong Nguyen,
Tran Huong Lan

Example

1 There is a student in the class has visited Hanoi.


2 Every students in the class have visited Nha Trang or Vung
Tau.

Answer
Assume:
C(x) : x has visited Hanoi
D(x) : x has visited Nha Trang
E(x) : x has visited Vung Tau
We have:
1 xC(x)
2 x(D(x) E(x))

2.15
Logics (cont.)
Translating into Logical Expressions
Huynh Tuong Nguyen,
Tran Huong Lan

Example
Every people has one best friend.

Solution
Assume:
B(x, y) : y is the best friend of x
We have:
xyz(B(x, y) ((y 6= z) B(x, z)))

2.16
Logics (cont.)
Translating into Logical Expressions
Huynh Tuong Nguyen,
Tran Huong Lan

Example
If a person is a woman and a parent, then this person is mother of
some one.

Solution
We define:
C(x) : x is woman
D(x) : x is a parent
E(x, y): x is mother of y
We have:
x((C(x) D(x)) yE(x, y))

2.17
Logics (cont.)
Inference
Huynh Tuong Nguyen,
Tran Huong Lan

Example

If I have a girlfriend, I will take her to go shopping.


Whenever I and my girlfriend go shopping and that day is a
special day, I will surely buy her some expensive gift.
If I buy my girlfriend expensive gifts, I will eat noodles for a
week.
Today is March 8.
March 8 is such a special day.
Therefore, if I have a girlfriend,...
I will eat noodles for a week.

2.18
Logics (cont.)
Propositional Rules of Inferences
Huynh Tuong Nguyen,
Tran Huong Lan

Rule of Inference Name


p
pq
q Modus ponens
q
pq
p Modus tollens
pq
qr
Hypothetical syllogism
pr
(Tam on lun gi nh)
pq
p
Disjunctive syllogism
q
(Tam on lun tuyn)

2.19
Logics (cont.)
Propositional Rules of Inferences
Huynh Tuong Nguyen,
Tran Huong Lan

Rule of Inference Name


p
Addition
pq
(Quy tc cng )
pq
Simplification
p
(Rt gn)
p
q
Conjunction
pq
(Kt hp)
pq
p r
Resolution
qr
(Phn gii)

2.20
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Example
If it rains today, then we will not have a barbecue today. If we do
not have a barbecue today, then we will have a barbecue
tomorrow. Therefore, if it rains today, then we will have a
barbecue tomorrow.

Solution

p: It is raining today
q: We will not have a barbecue today
r: We will have barbecue tomorrow
pq
qr
pr
Hypothetical syllogism

2.21
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Example
1. p q Hypothesis
It is not sunny this afternoon
(p) and it is colder than 2. p Simplification using (1)
yesterday (q)
We will go swimming (r) only if 3. r p Hypothesis
it is sunny
4. r Modus tollens using (2) and (3)
If we do not go swimming, then
we will take a canoe trip (s) 5. r s Hypothesis
If we take a canoe trip, then we
will be home by sunset (t) 6. s Modus ponens using (4) and (5)
We will be home by sunset (t)
7. s t Hypothesis

8. t Modus ponens using (6) and (7)

2.22
Logics (cont.)
Fallacies
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
Fallacies (ngy bin) resemble rules of inference but are based on
contingencies rather than tautologies.

Example
If you do correctly every questions in mid-term exam, you will get
10 grade. You got 10 grade.
Therefore, you did correctly every questions in mid-term exam.
Is [(p q) q] p a tautology?

2.23
Logics (cont.)
Rules of Inference for Quantified Statements
Huynh Tuong Nguyen,
Tran Huong Lan

Rule of Inference Name


xP (x)
Universal instantiation
P (c)
(C th ha ph qut)
P (c)for an arbitrary c
Universal generalization
xP (x)
(Tng qut ha ph qut)
xP (x)
Existential instantiation
P (c)for some element c
(C th ha tn ti)
P (c)for some element c
Existential generalization
xP (x)
(Tng qut ha tn ti)

2.24
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Example

A student in this class has not gone to class


Everyone in this class passed the first exam
Someone who passed the first exam has not gone to class

Hint

C(x): x is in this class


B(x): x has gone to class
P (x): x passed the first exam
Premises???

2.25
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

1. x(C(x) B(x)) Premise


2. C(a) B(a) Existential instantiation from (1)
3. C(a) Simplification from (2)
4. x(C(x) P (x)) Premise
5. C(a) P (a) Universal instantiation from (4)
6. P (a) Modus ponens from (3) and (5)
7. B(a) Simplification from (2)
8. P (a) B(a) Conjunction from (6) and (7)
9. x(P (x) B(x)) Existential generalization from (8)

2.26
Logics (cont.)
Introduction
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
A proof is a sequence of logical deductions from
- axioms, and
- previously proved theorems
that concludes with a new theorem.

2.27
Logics (cont.)
Terminology
Huynh Tuong Nguyen,
Tran Huong Lan

Theorem (nh l ) = a statement that can be shown to be


true
Axiom (tin ) = a statement we assume to be true
Hypothesis (gi thit) = the premises of the theorem

2.28
Logics (cont.)

Huynh Tuong Nguyen,


Tran Huong Lan

Lemma (b ) = less important theorem that is helpful in


the proofs of other results
Corollary (h qu ) = a theorem that can be established
directly from a proved theorem
Conjecture (phng on) = statement being proposed to be
true, when it is proved, it becomes theorem

2.29
Logics (cont.)
Proving a Theorem
Huynh Tuong Nguyen,
Tran Huong Lan

Many theorem has the form xP (x) Q(x)


Goal:
Show that P (c) Q(c) is true with arbitrary c of the domain
Apply universal generalization
How to show that conditional statement p q is true.

2.30
Logics (cont.)
Methods of Proof
Huynh Tuong Nguyen,
Tran Huong Lan

Direct proofs (chng minh trc tip)


Proof by contraposition (chng minh phn o)
Proof by contradiction (chng minh phn chng )
Mathematical induction (quy np ton hc)

2.31
Logics (cont.)
Direct Proofs
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
A direct proof shows that p q is true by showing that if p is
true, then q must also be true.

Example

Ex.: If n is an odd integer, then n2 is odd.


Pr.: Assume that n is odd. By the definition, n = 2k + 1, k Z.
n2 = (2k + 1)2 = 4k 2 + 4k + 1 = 2(2k 2 + 2k) + 1 is an odd
number.

2.32
Logics (cont.)
Proof by Contraposition
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
p q can be proved by showing (directly) that its contrapositive,
q p, is true.

Example

Ex.: If n is an integer and 3n + 2 is odd, then n is odd.


Pr.: Assume that If 3n + 2 is odd, then n is odd is false; or n is
even, so n = 2k, k Z. Substituting
3n + 2 = 3(2k) + 2 = 6k + 2 = 2(3k + 1) is even. Because
the negation of the conclusion of the conditional statement
implies that the hypothesis is false, Q.E.D.

2.33
Logics (cont.)
Proofs by Contradiction
Huynh Tuong Nguyen,
Tran Huong Lan

Definition
p is true if if can show that p (r r) is true for some
proposition r.

Example

Ex.: Prove that 2 is irrational.

Pr.: Let p is the proposition
2 is irrational. Suppose
p is true,
which means 2 is rational. If so, a, b Z, 2 = a/b, a, b
have no common factors. Squared, 2 = a2 /b2 , 2b2 = a2 , so
a2 is even, and a is even, too. Because of that a = 2c, c Z.
Thus, 2b2 = 4c2 , or b2 = 2c2 , which means b2 is even and so
is b. That means 2 divides both a and b, contradict with the
assumption.

2.34
Logics (cont.)
Problem
Huynh Tuong Nguyen,
Tran Huong Lan

Assume that we have an infinite domino string, we want to know


whether every dominoes will fall, if we only know two things:
1 We can push the first domino to fall
2 If a domino falls, the next one will be fall
We can! Mathematical induction.

2.35
Logics (cont.)
Mathematical Induction
Huynh Tuong Nguyen,
Tran Huong Lan

Definition (Induction)
To prove that P (n) is true for all positive integers n, where P (n)
is a propositional function, we complete two steps:
Basis Step: Verify that P (1) is true.
Inductive Step: Show that the conditional statement
P (k) P (k + 1) is true for all positive integers k
Logic form:
[P (1) kP (k) P (k + 1))] nP (n)

What is P (n) in domino string case?

2.36
Logics (cont.)
Example on Induction
Huynh Tuong Nguyen,
Example Tran Huong Lan

Show that if n is a positive integer, then

n(n + 1)
1 + 2 + ... + n = .
2

Solution
Let P (n) be the proposition that sum of first n is n(n + 1)/2
1(1+1)
Basis Step: P (1) is true, because 1 = 2
Inductive Step:
k(k+1)
Assume that 1 + 2 + . . . + k = 2
.
Then:
k(k + 1)
1 + 2 + . . . + k + (k + 1) = + (k + 1)
2
k(k + 1) + 2(k + 1)
=
2
(k + 1)(k + 2)
=
2

shows that P (k + 1) is true under the assumption that P (k) is true.


2.37
Logics (cont.)
Example on Induction
Huynh Tuong Nguyen,
Tran Huong Lan

Example
Prove that n < 2n for all positive integers n.

Solution
Let P (n) be the proposition that n > 2n .
Basis Step: P (1) is true, because 1 > 21 = 2
Inductive Step:
Assume that P (k) is true for the positive k, that is, k < 2k .
Add 1 to both side of k < 2k , note that 1 2k .

k + 1 < 2k + 1 2k + 2k = 2 2k = 2k+1 .

shows that P (k + 1) is true, namely, that k + 1 < 2k+1 ,


based on the assumption that P (k) is true.

2.38

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy