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
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
Ex 2.1 • s: Phyllis goes out for a walk • t: The moon is out • u: It is snowing • (tu)s • t(us) • (s(ut))
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 pq
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.
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 (p1p2…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 (p1p2…pn), when all of them are true. • Premises and conclusion
2.2 Logic equivalence: the laws of logic • Ex 2.7, pq is equivalent to pq • Definition 2.2.Two statements are said to be logically equivalent, s1s2, when the statement s1 is true if and only if the statement s2 is true
DeMorgan’s law • (pq) pq; (pq)pq
The distributive law • p(qr) (pq) (pr) • p (qr) (pq) (pr)
Observations • When s1s2, then s1s2 is a tautology; when s1s2; then s1s2 is a tautology • When s1s2 and s2s3, then s1s3
pp (pq)pq (pq)pq pqqp; pqqp p(qr) (pq)r p(qr) (pq) r p(qr) (pq) (pr) p(qr) (pq) (pr) ppp ppp pFp pTp ppT ppF pTT pFF p(pq) p p(pq) p The laws of logic
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 st, then sdtd.
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 pq. 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 PP1.
Ex 2.10 • P: (pq)(pq) is a tautology • P1: ((rs)q)( (rs)q) • P2: ((rs) (tu))( (rs) (tu))
Ex 2.11 • Let P: (pq)r be a compound statement. • Because (pq)pq, if P1: (pq)r, then P1P. • Let P: p(pq) be a compound statement. • Because pp, if P1: p (p q), then P1P.
[(pq)r] [(pq) r] (pq) r (pq) r (pq) (pq) pq pq Ex 2.12, Ex 2.13
Definitions • Implication pq • contrapositive, qp • converse, qp • inverse p q
(pq)(pq) (pq)(pq) (pq)(pq) p(qq) pFp [[(pq)r]q] [(pq)r]q [(pq)r]q (pq)(qr) [(pq)q]r qr Ex 2.16, Ex 2.17
Simplifying the switch network • (pqr)(ptq)(ptr)p[r(tq)]
2.3 Logic implication: rules of inference • (p1p2…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 (p1p2…pn)q is a tautology. • The conclusion is deduced or inferred from the truth of premises.
Ex 2.19 • [(pr)(qp)r]q
Ex 2.20 • [p((pr)s)](rs)
Key concepts • Definition 2.4. If p and q are arbitrary statements such that pq is a tautology, then we say that p is logically implies q and we write pq to denote this situation. • When pq, we refer to pq as a logical implication. • If pq, then pq is a tautology, and we have pq and q p. Conversely, suppose that pq and q p, then we have pq.
The rule of inferences • The rule of Modus Ponens • (method of affirming), the rule of detachment • [p( pq)]q • [(rs)[(rs)(tu)] (tu) • The rule of syllogism • [( pq)( qr)] ( pr)
Ex 2.24 • [ (p) (pq) (qr) ] r
the rule of Modus Tollens • (method of denying), [q( pq)]p • Ex 2.25 • [(pr) (rs) (ts) (tu) (u)] p
Some notes • Some arguments look similar in appearance but are indeed invalid. • [q( pq)]p • [p( pq)]q • the rule of conjunction, [(p)(q)](pq) • the rule of disjunctive syllogism, [( pq)(p)] q
the rule of contradiction • [(p)(F)](p)
The rule of contradiction • When we want to establish the validity of the argument (p1p2…pn)q, we can establish the validity of the logically equivalent argument (p1p2…pnq)F
Ex 2.32 • [(pq)(qr)rp]F
Another inference rule • [( p)(qr)] [( pq) r] • [((p1p2…pn)(qr)) [(p1p2…pnq) 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.
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 xp(x) the variable x is called a bound variable—it is bound by the existential quantifier . Similarly, in the statement xp(x) the variable x is bound by the universal quantifier .
p(x): x0 r(x): x2-3x-4=0 q(x): x2 0 s(x): x2-3>0 x [p(x)r(x)] x [p(x)q(x)] x [q(x)s(x)] x [r(x)s(x)] x [r(x)p(x)] Ex 2.36
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] • mn [41=m2+n2]
Ex 2.39 • For n:=1 to 20 do A[n]:=nn-n • n (A[n]0) • n (A[n+1]=2A[n]) • n [(1n19)(A[n]<A[n+1]) • m n [(mn)(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 pq; contrapositive, x [qp]; converse, x [qp]; 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)]