Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 64

Chapter 2 Fundamentals

of Logic
Dept of Information management
National Central University
Yen-Liang Chen
2.1 Basic connectives and truth table
• Assertions, called statements or propositions, are
declarative sentences that are either true or false
• New statements can be obtained from existing
ones in two ways.
– Transform a given statement p into the statement p
– Combine two or more statements into a compound
statement
Forming a compound statement
Ex 2.1
• s: Phyllis goes out for a walk
• t: The moon is out
• u: It is snowing
• (tu)s
• t(us)
• (s(ut))
Ex 2.2
• “If I weigh more than 120 pounds, then I shall
enroll in an exercise class”
• p: I weigh more than 120 pounds
• q: I shall enroll in an exercise class
• the four cases of pq
A word of caution
• In our everyday language, we often find
situations where an implications is used when
the intention actually calls for a biconditional.
• If you do your homework, then you will get to
watch the baseball game.
p(qr)(pq)r
p(pq), p(pq)
Key ideas
• A compound statement is a tautology if it is true for all
truth value assignments and a contradiction if it is false
for all truth value assignments
• To show (p1p2…pn)q a valid argument, we need
to show this statement is a tautology. If any pi is not
true, then no matter what q is the statement is true.
Thus, we only need to show that q follows from
(p1p2…pn), when all of them are true.
• Premises and conclusion
2.2 Logic equivalence: the laws of
logic
• Ex 2.7, pq is equivalent to pq
• Definition 2.2. Two statements are said to be
logically equivalent, s1s2, when the statement
s1 is true if and only if the statement s2 is true
(pq)(pq)(qp)
(pq)(pq) (pq)
DeMorgan’s law
•  (pq) pq; (pq)pq
The distributive law
• p(qr) (pq)  (pr)
• p (qr) (pq)  (pr)
Observations
• When s1s2, then s1s2 is a tautology; when
s1s2; then s1s2 is a tautology
• When s1s2 and s2s3, then s1s3
The laws of logic
• pp • ppp
• (pq)pq • ppp
• (pq)pq • pFp
• pqqp; • pTp
• pqqp • ppT
• p(qr)  (pq)r • ppF
• p(qr)  (pq) r • pTT
• p(qr)  (pq) (pr) • pFF
• p(qr)  (pq)  (pr) • p(pq)  p
• p(pq)  p
Observation
• Definition 2.3, sd, the dual of s, is obtained by
replacing  with ,  with , T with F and F
with T.
• Theorem 2.1. The principle of duality. Let s and
t be statements that contain no logical
connectives other than  and . If st, then
sdtd.
Two substitution rules
• Suppose that the compound statement P is a tautology.
If p is a primitive statement that appears in P and we
replace each occurrence of p by the same statement q,
then the resulting compound statement P1 is also a
tautology.
• Let P be a compound statement where p is an arbitrary
statement that appears in P, and let q be such a
statement such that pq. Suppose that in P we replace
one or more occurrences of p by q. Then this
replacement yields the compound statement P1. Under
these circumstances P P1.
Ex 2.10
• P: (pq)(pq) is a tautology
• P1: ((rs)q)( (rs)q)
• P2: ((rs) (tu))( (rs) (tu))
Ex 2.11
• Let P: (pq)r be a compound statement.
– Because (pq)pq, if P1: (pq)r, then
P1P.
• Let P: p(pq) be a compound statement.
– Because pp, if P1: p (p q), then
P1P.
Ex 2.12, Ex 2.13
• [(pq)r] • (pq)
• [(pq) r] • (pq)
• (pq) r • pq
• (pq) r • pq
Definitions
• Implication pq
• contrapositive, q p
• converse, q p
• inverse  p  q
Ex 2.16, Ex 2.17
• (pq)(pq) • [[(pq)r]q] 
• (pq)(pq) • [(pq)r]q 
• (pq)(pq) • [(pq)r]q 
• p(qq) • (pq)(qr) 
• pFp • [(pq)q]r 
• qr
Simplifying the switch network
• (pqr)(ptq)(ptr)p[r(tq)]
2.3 Logic implication: rules of
inference
• (p1p2…pn)q is a valid argument, if the premises
are true, then the conclusion is also true.
• If any one of p1, p2,…, pn is false, the implication is
automatically true.
• To establish the validity of a given argument is to show
that the statement (p1p2…pn)q is a tautology.
• The conclusion is deduced or inferred from the truth
of premises.
Ex 2.19
• [(pr)(qp)r]q
Ex 2.20
• [p((pr)s)](rs)
Key concepts
• Definition 2.4. If p and q are arbitrary
statements such that pq is a tautology, then we
say that p is logically implies q and we write pq
to denote this situation.
• When pq, we refer to pq as a logical
implication.
• If pq, then pq is a tautology, and we have
pq and q p. Conversely, suppose that pq
and q p, then we have pq.
The rule of inferences
• The rule of Modus Ponens
– (method of affirming), the rule of detachment
– [p( pq)]q
– [(rs)[(rs)(tu)] (tu)
• The rule of syllogism
– [( pq)( qr)] ( pr)
Ex 2.24
• [ (p) (pq)  (qr) ]  r
the rule of Modus Tollens
• (method of denying),
[q( pq)] p
• Ex 2.25
• [(pr) (rs) (ts)
(tu) (u)]  p
Some notes
• Some arguments look similar in appearance but
are indeed invalid.
– [q( pq)]p
– [p( pq)]q
• the rule of conjunction, [(p)(q)](pq)
• the rule of disjunctive syllogism,
[( pq)(p)] q
the rule of contradiction
• [(p)(F)](p)
The rule of contradiction
• When we want to establish the validity of the argument
(p1p2…pn)q, we can establish the validity of the
logically equivalent argument (p1p2…pnq)F
Ex 2.30
Ex 2.31
Ex 2.32
• [(pq)(qr)rp]F
Another inference rule
• [( p)(qr)] [( pq) r]
• [((p1p2…pn)(qr)) [(p1p2…pnq)
r]
• This result tells us that if we want to establish
the validity of the first argument, we may be
able to do so by establishing the validity of the
corresponding argument.
Ex 2.33
2.4 The use of Quantifiers
• Definition 2.5. A declarative sentence is an open
statement if
– (1) it contains one or more variables, and
– (2) it is not a statement, but
– (3) it becomes a statement when the variables in it are
replaced by certain allowable choices.
• These allowable choices constitute what is called the
universe or universe of discourse. The universe
comprises the choices we wish to consider or allow for
the variables in the open statement.
definitions
• Existential quantifier () and universal quantifier
() are used to quantify the open statements.
• In an open statement p(x) the variable x is called
a free variable. In the statement x p(x) the
variable x is called a bound variable—it is bound
by the existential quantifier . Similarly, in the
statement x p(x) the variable x is bound by the
universal quantifier .
Ex 2.36
• p(x): x0 • x [p(x)r(x)]
• r(x): x2-3x-4=0 • x [p(x)q(x)]
• q(x): x2 0 • x [q(x)s(x)]
• s(x): x2-3>0 • x [r(x)s(x)]
• x [r(x)p(x)]
Ex 2.37
• p(x): x is a rational number, q(x): x is a real
number
– x [p(x)q(x)]
• e(t): triangle t is equilateral, a(t): triangle t has
three angles of 60
– t [e(t)a(t)]
• x [sin2x+cos2x=1]
• mn [41=m2+n2]
Ex 2.39
• For n:=1 to 20 do A[n]:=nn-n
• n (A[n]0)
• n (A[n+1]=2A[n])
• n [(1n19)(A[n]<A[n+1])
• m n [(mn)(A[m]A[n])]
Definitions
• p(x) and q(x) are called logically equivalent, written as
x [p(x)q(x)], when p(a)  q(a) is true for each
replacement a from the universe. We say that p(x)
logically implies q(x), written as x [p(x)q(x)], when
p(a)q(a) is true for each replacement a from the
universe.
• x [p(x)q(x)] if and only if x [p(x)q(x)] and x
[q(x)p(x)]
• x pq; contrapositive, x [q p]; converse, x
[q p]; inverse x [ p  q];
Examples
• Ex 2.40.
– s(x): x is a square; e(x): x is a equilateral;
– x [s(x)e(x)]; contrapositive, converse, inverse
• Ex 2.41.
– p(x): x>3; q(x) x>3;
– x [p(x)q(x)]; contrapositive, converse, inverse
• Ex 2.42. r(x): 2x+1=5; s(x): x2=9
– x [r(x)s(x)] 
 x [r(x)]  x [s(x)];
– but we have x [r(x)s(x)]  x [r(x)]  x [s(x)]
Table 2.22
• x [r(x)s(x)]  x [r(x)]  x [s(x)]
• x [r(x) s(x)]  x [r(x)] x [s(x)]
• x [r(x)s(x)]  x [r(x)]  x [s(x)]
• x [r(x)s(x)] x [r(x)]  x [s(x)]
Ex 2.43
• x [p(x)(q(x)r(x))]  x [(p(x)q(x))r(x)]
• x [p(x)q(x)]x(p(x)q(x))
• x p(x)x p(x)
• x [p(x)q(x)]x [p(x)q(x)]
• x [p(x)q(x)]x [p(x)q(x)]
Rules for negation
• [x p(x)]  x  p(x)
• [x p(x)]  x  p(x)
• [x  p(x)]  x p(x)  x p(x)
• [x  p(x)]  x p(x)  x p(x)
Ex 2.44
• p(x): x is odd, q(x): x2-1 is even
• x (p(x)q(x)). If x is odd, x2-1 is even.
•  [x (p(x)q(x))]
• x (p(x)q(x))
• x (p(x)q(x))
• x p(x)q(x))
• x [p(x)q(x)]
• There exists an integer x such that x is odd and x2-1 is
odd.
examples
• Ex 2.45
– x y [p(x, y)]  y x [p(x, y)]
• Ex 2.46
– x y z [p(x, y, z)] can be written as x, y, z [p(x, y,
z)]
• Ex 2.47
– x y [p(x, y)]  y x [p(x, y)]
Ex 2.48
• when a statement involves both existential and
universal quantifiers, we must be careful about
the order in which the quantifiers are written.
• p(x, y): x+y=17
• x y p(x, y) is different from y x p(x, y)
Ex 2.49
• What is the negation of xy[(p(x,y)q(x,y)) r(x,y)]
Ex 2.50
2.5 Quantifiers, definitions and the
proofs of theorems
• Ex 2.52.
– For all n in 2, 4, 6,…, 26, we can write n as the sum
of at most three perfect squares.
– Table 2.4 shows this by the method of exhaustion.
– The method is reasonable when we dealing with a
fairly small universe.
– When the universe is very large, it is impossible to
use the method of exhaustion.
The rule of universal
specification.
• If p(x) is an open statement for a given universe,
and if x p(x) is true, then p(a) is true for each a
in the universe.
• Note that this a is a specific but arbitrarily
chosen member from the prescribed universe.
Ex 2.53 (b)(c)
The rule of universal generalization.
• If an open statement p(x) is proved to be true
when x is replaced by a specific but arbitrarily
chosen element c from our universe, then the
universally quantified statement x p(x) is true.
• Furthermore, the rule extends beyond a single
variable. That is, the same holds for x y [p(x,
y)], x y z [p(x, y, z)] or more variables.
Ex 2.54
Ex 2.56
Theorems Proving
• The rule of universal specification and the rule
of universal generalization can be applied to
prove theorems.
• Theorem 2.2. If k and l are both odd, then k+l
is even.
• Theorem 2.3. If k and l are both odd, then kl is
also odd.
Theorem 2.4
• If m is an even integer, the m+7 is odd.
• Theorem 2.4 uses three different ways to prove
the theorem.
• (1) pq, if m is even then m+7 is even
• (2) qp, if m+7 is even then m is odd
• (3)pqF, if m and m+7 are both even, then
it is a contradiction.

You might also like