View
224
Download
0
Category
Tags:
Preview:
DESCRIPTION
CSC 201 Unit 1 Logic
Citation preview
4
Propositional Logic
• Propositional logic deals with propositions.• A proposition is a declarative sentence (i. e.
a sentence that declares a fact) that is either true or false but not both.
• A propositional variable is a variable that represents propositions.
• Propositional variables are usually denoted by letters such as p, q, r, s etc.
5
Logical operators stands for “Not”, ˅ stands for “or”, ˄ stands for “and”. These are defined using truth tables as follows:
pT FF T
p q p˅qT T TT F TF T TF F F
p q p˄qT T TT F FF T FF F F
6
More logical operators: Implications
• → stands for “implies” , ↔ stands for “if and only if”
• is also read as “if p then q”
p q p → qT T TT F FF T TF F T
p q p ↔ qT T TT F FF T FF F T
8
Some terminology
• The converse of is • The contrapositive of is • A compound proposition is an expression
formed from propositional variables using logical operators
qp qp )()( pq
pq
10
An example of finding a truth table of a compound proposition
Find the truth table of
Answer:
p qT T TT F FF T TF F F
)()( qpqp
)()( qpqp
11
A logical puzzle
An island has two kinds of inhabitants: “knights” who always tell the truth and “knaves” who always lie. On the island, you encounter two of its inhabitants, A and B. A says “B is a knight” and B says “the two of us are of opposite types”. Determine the identities of A and B if possible.
Answer: A and B are both knaves
13
Tautology and Contradiction
• A tautology is a compound proposition that is always true irrespective of the truth values of the propositional variables that occur in it
• A contradiction is a compound proposition that is always false irrespective of the truth values of the propositional variables that occur in it
• is a tautology and is a contradiction
pp pp
14
Equivalence of compound propositions
Two compound propositions are said to be logically equivalent provided that they have the same truth value in all possible cases. We use the symbol for logical equivalence.
15
Some examples of logical equivalence
• Show that
Solution: Constructing the truth tables, we see that both compound propositions are true when p and q are false and false in all other cases.
qpqp )(
16
eg. Show that p q r A, B
T T T TT T F TT F T TT F F TF T T TF T F FF F T F
F F F F
right. on theshown as same the
are B andA both of les truth tabThe
).()( denote BLet
).( denoteA Let :Solution
)()()(
rpqp
rqp
rpqprqp
18
Some important equivalences
laws veDistributi )()()(
)()()(
laws eAssociativ )()(
)()(
)equivalent are tivecontraposi its andn implicatio(An
laws sMorgan' De )(
)(
rpqprqp
rpqprqp
rqprqp
rqprqp
pqqp
qpqp
qpqp
qpqp
19
Equivalences involving tautolgies and contradictions
Let T stand for a tautology and let F stand for a contradiction. We have the following
T T
T F F F
T
F
p p pp pp
pp pp
20
Proving an equivalence using known equivalences
Prove that using known equivalences
Solution: We have
F
qpqpp ))((
qp
qp
qppp
qpp
qpp
qppqpp
)(
)()(
)(
))((
)())((
21
Some remarks about implications and equivalences
Let P and Q be compound propositions. • To prove that , it is sufficient to prove
that (a) if P is true then Q is true and (b) if Q is true then P is true.
• To prove that is a tautology, it is sufficient to prove that if P is true then Q is true.
QP
QP
22
Proving that an equivalence is a tautology using logical reasoning
Show that is a tautology
Solution: Suppose that is true. Then, p and q are both true. Therefore is true. We have shown that if is true then must be true. Therefore, is a tautology.
qpqp qp
qp qp qp
qpqp
23
Generalized “or” and “and”
• Because of the associative laws, we can talk about and
• The idea can be extended to any number of propositional variables.
• Thus, we can talk about and
rqp .rqp
nppp 21
.21 nppp
true.are ,,,
ofeach ifonly and if trueis Also,
true.is ,,,
of oneleast at ifonly and if trueis that Note
21
21
21
21
n
n
n
n
ppp
ppp
ppp
ppp
24
The Liar Paradox
• The earliest attribution is to Eubulides of Miletus (~ 4th century B.C., contemporary of Aristotle) who said “A man says that he is lying. Is what he says true or false?”.
• Alternate version: “This sentence is false”• In symbols : L is the sentence “L is false”. This
means that L is true if and only if L is false. • In propositional logic, such sentences are not
considered.
26
Predicates
• A predicate or propositional function is a statement about one or more variables (of any kind). If the values of the variables are specified, the statement becomes a proposition.
• For example let
Here, P is a predicate of one variable.• Let
Here Q is predicate of two variables.
".0"statement thebe )( xxP
".10"statement thebe ),( yxyxQ
27
Quantifiers ,
• The universal quantifier stands for “for all”.
• The existential quantifier stands for “there exists”
)"( , allfor " means )( xPxxPx
")(such that an exists there" means )( xPxxPx
28
Domain of discourse
Statements involving quantifiers are understood to be with respect to a certain set called the “universe or domain of discourse” which must be specified in order for the statement to become a proposition.
29
Some important sets of numbers
• The set of all natural numbers is the set
{0, 1, 2, 3, 4, ……}• The set of all integers is the set
• Some authors do not include 0 among the
natural numbers.
},3,3,2,2,1,1,0{
30
Rational numbers
• A rational number is a ratio of two integers. • For example, are rational numbers.• It is clear that every integer is a rational
number but there are rational numbers which are not integers.
2
0,
1
2,
2
5,
5
3
31
Real numbers
• A number which corresponds to a “signed distance” on the number line is called a real number.
• It is clear that every rational number is a real number.
• However, there are real numbers which are not rational. Such numbers are called irrational.
• Examples of irrational numbers are .,,2 e
32
Some examples of statements involving predicates and quantifiers
• The statement > 0) is false if the domain of discourse is the set of all real numbers. However, it is true if the domain of discourse is the set of all positive real numbers.
• The statement is true if the domain of discourse is the set of all integers but it is false if the domain of discourse is the set of all positive integers.
xx (
)0( xx
33
Counterexamples
To show that a statement of the form is false, we need to show that there is a value of x in the domain of discourse for which is false. Such an x is called a counterexample to the statement .
For example, is a counterexample to the statement > when the domain of discourse is the set of all real numbers.
)(xPx
)(xP
)(xPx
0x0) (xx
34
Equivalence of statements involving predicates and quantifiers
• Two statements involving predicates and quantifiers are said to be logically equivalent, provided that they have the same truth value irrespective of which predicates are substituted into these statements and which domain of discourse is used for the variables. We use the same symbol as before.
• For example,
(It is understood that the same domain is used throughout)
))(())(())()(( xQxxPxxQxPx
35
Negation of statements involving predicates and quantifiers
)0(
)0()0(
example,For
)()(
)()(
xx
xxxx
xPxxPx
xPxxPx
36
The politician puzzle
A certain convention numbered 100 politicians. Each politician was either crooked or honest. We are given the following two facts:
• At least one of the politicians was honest.• For every choice of two of the politicians, at least one of the two was crooked.
Can it be determined from these two facts how many of the politicians were honest and how many of them were crooked?
37
Solution to the Politician Puzzle
Let A be an honest politician. Let B be any other politician. Since at least one of A and B is crooked, it follows that B is crooked. This applies to any politician other than A. Therefore, there is one honest politician and the other 99 are crooked.
39
Order of quantifiers
Suppose that the domain of discourse for all variables below is the set of all real numbers.
• The statement is false since there is no real number y such that for every real number x, we have .
• The statement is true since for every real number x, there is a real number y (i. e. ) such that .
)0( yxxy
0 yx
)0( yxyx
xy 0 yx
40
Negation of statements involving nested quantifiers
eg. Find the negation of the statement
Solution: We have
)1( xyyx
)1(
)1(
)1()1(
xyyx
xyyx
xyyxxyyx
41
Translating sentences in english into statements involving quantifiers
Consider the sentence “The sum of two non-negative integers is always non-negative”. This can be translated into a statement involving quantifiers as follows:
• where the domain for both variables is the set of all integers.
• Another possibility is where the domain for both variables is the set of all non-negative integers.
)0()0()0(( yxyxyx
)0( yxyx
Recommended