44
資資資資資資 資資資資資資 4 4 : : More About Logic More About Logic 陳陳陳陳陳陳陳 陳陳陳陳陳陳陳 (Kuang-Chi Chen) (Kuang-Chi Chen) [email protected] [email protected]

資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) [email protected]

Embed Size (px)

Citation preview

Page 1: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

資訊科學數學資訊科學數學 44::More About LogicMore About Logic

陳光琦助理教授 陳光琦助理教授 (Kuang-Chi Che(Kuang-Chi Chen)n)

[email protected]@mail.tcu.edu.tw

Page 2: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logic - reviewLogic - review

Def. Def. A A propositionproposition ( (pp, , qq, , rr, …) is simply a statem, …) is simply a statement (i.e., a declarative sentence) with a definite ent (i.e., a declarative sentence) with a definite meaning, having a truth value that’s either true meaning, having a truth value that’s either true ((TT) or false () or false (FF) () (nevernever both, neither, or somewh both, neither, or somewhere in between).ere in between).

• The unary The unary negationnegation operator “¬” ( operator “¬” (NOTNOT) transf) transforms a proposition into its logical negation. ¬orms a proposition into its logical negation. ¬pp can be stated as “It’s not the case that can be stated as “It’s not the case that pp” ( ~” ( ~pp 、、~~qq (¬(¬qq)).)).

Page 3: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Basic ConnectivesBasic Connectives& Truth Tables& Truth Tables

Page 4: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logical ConnectivesLogical Connectives

Formal NameFormal Name NicknameNickname SymbolSymbol

Conjunction operatorConjunction operator ANDAND

Disjunction operatorDisjunction operator OROR

Exclusive-OR Exclusive-OR operatoroperator

XORXOR

Implication operatorImplication operator IMPLIESIMPLIES

Biconditional operatorBiconditional operator IFFIFF ↔↔

Page 5: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Meaning of ImplicationMeaning of Implication

• ““pp implies implies qq””

• ““if if pp, then , then qq””

• ““if if pp, , qq””

• ““when when pp, , qq””

• ““whenever whenever pp, , qq””

• ““p p only if only if qq””

• ““p p is sufficient for is sufficient for qq””

• ““q q is implied by is implied by pp””

• ““qq follows from follows from pp””

• ““q q if if pp””

• ““qq when when pp””

• ““qq whenever whenever pp””

• ““qq is necessary for is necessary for pp””

Page 6: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

ImplicationImplication

ImplicationImplication : : pp→→qq ,, p p 蘊含 蘊含 qq 。。

• ““ 若 若 pp 則 則 q q ” ” (( if - thenif - then )。)。• ““p p 對 對 qq 是充分的是充分的”” or or ““p p 是 是 qq 的充分條的充分條

件件””。。• ““q q 對 對 pp 是必要的是必要的”” or or ““q q 是 是 pp 的必要條的必要條

件件”。”。 ??

• ““pp 唯若 唯若 qq ” ” 。。

Page 7: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Converse, Inverse, ContrapositivConverse, Inverse, Contrapositivee

Some terminology, for an implication Some terminology, for an implication p p qq::

• Its Its converseconverse is: is: q q p p . (. ( 逆命題逆命題 ))

• Its Its inverseinverse is: is: ¬¬pp ¬ ¬q q . (. ( 反逆命題反逆命題 ))

• Its Its contrapositivecontrapositive:: ¬¬q q ¬ ¬ pp . ( . ( 變換命題變換命題 ))

• One of these three has the One of these three has the same meaningsame meaning (same (same truth table) as truth table) as pp q q. Can you get it?. Can you get it?

Contrapositive !Contrapositive !

Page 8: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Some Alternative Some Alternative Notations Notations

Page 9: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Bits & Bit OperationsBits & Bit Operations

• A A bitbit is a is a bibinary (base 2) dignary (base 2) digitit: 0 or 1.: 0 or 1.

• Bits may be used to represent truth values.Bits may be used to represent truth values.

• By convention: By convention: 00 represents “false”, represents “false”, 11 represents “true”. represents “true”.

• Boolean algebraBoolean algebra is like ordinary algebra except is like ordinary algebra except that variables stand for bits, + means “or”, and that variables stand for bits, + means “or”, and multiplication means “and”.multiplication means “and”.– More details later.More details later.

Page 10: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Tautology & Tautology & ContradictionContradiction

• A A tautologytautology is a compound proposition that is is a compound proposition that is ttruerue no matter whatno matter what the truth values of its atomi the truth values of its atomic propositions are!c propositions are!

Eg.,Eg., p p p.p.

• A A contradictioncontradiction is a compound proposition that is a compound proposition that is is falsefalse no matter what! no matter what!

Eg.,Eg., p p p.p.

• Other compound propositions are Other compound propositions are contingenciescontingencies..

Page 11: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Tautology & Tautology & ContradictionContradiction

Def.Def. A compound statement is called a A compound statement is called a tautologytautology if it is true for all truth value assignments for its if it is true for all truth value assignments for its component statementcomponent statement. If a compound statement . If a compound statement is is falsefalse for all such assignments, then it is called for all such assignments, then it is called a a contradictioncontradiction..

• Throughout this course we will use Throughout this course we will use TT00 and and FF00 to to

represent any tautology and contradiction, resp.represent any tautology and contradiction, resp.

# We use the ideas of # We use the ideas of tautologytautology and and implicatioimplication to descrin to describe what we mean by be what we mean by a valid argumenta valid argument..

Page 12: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Tautology & Tautology & ContradictionContradiction

• 若複合敘述對其敘述的所有真假值若複合敘述對其敘述的所有真假值均為真均為真,,則被稱為重言則被稱為重言(( tautologytautology ,, TT00 ));若複合;若複合敘述對其敘述的所有真假值敘述對其敘述的所有真假值均為假均為假,則被稱,則被稱為矛盾為矛盾(( contradictioncontradiction ,, FF00 ))。。

# # 在資訊科學,使用 重言 及 蘊含 的概念來描述一個 在資訊科學,使用 重言 及 蘊含 的概念來描述一個 “有效的論證(“有效的論證( valid argumentvalid argument )”)”。。

Page 13: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logical Equivalence:Logical Equivalence:The Laws of LogicThe Laws of Logic

Page 14: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logical EquivalenceLogical Equivalence

• Compound proposition Compound proposition pp is is logically equivalentlogically equivalent toto compound proposition compound proposition qq, written , written pp≡ ≡ qq, , IFFIFF ththe compound proposition e compound proposition ppqq is a is a tautologytautology..

• Compound propositions Compound propositions pp and and q q are are logically eqlogically equivalent to each otheruivalent to each other IFFIFF pp and and q q contain the scontain the same truth valuesame truth values as each other in as each other in allall rows of the rows of their truth tables.ir truth tables.

Page 15: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logically EquivalentLogically Equivalent

Logically Equivalent Logically Equivalent ((⇔, ⇔, ≡≡))

• 邏輯相等、實質相同、邏輯等價邏輯相等、實質相同、邏輯等價

• 兩敘述若邏輯等價 兩敘述若邏輯等價 (logically equivalent)(logically equivalent) ,, ss11⇔⇔ ss22 ,,意謂 “當 敘述 意謂 “當 敘述 ss11 為真時,若且唯若 敘述 為真時,若且唯若 敘述 ss22 為真”,為真”,“當 敘述 “當 敘述 ss11 為假時,若且唯若 敘述 為假時,若且唯若 敘述 ss22 為假”。為假”。

• E.g., (E.g., (pp→→qq) ) ⇔⇔ (~ (~ppⅴⅴqq))

((pp↔↔qq) ) ⇔⇔ ( (pp→→qq) ^ () ^ (qq→→pp))

((pp↔↔qq) ) ⇔⇔ (~ (~ppⅴⅴqq) ^ (~) ^ (~qqⅴⅴpp))

Page 16: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

ExampleExample

E.g., (E.g., (pp→→qq) ) ⇔⇔ (~ (~ppⅴⅴqq))

((pp↔↔qq) ) ⇔⇔ ( (pp→→qq) ^ () ^ (qq→→pp))

((pp↔↔qq) ) ⇔⇔ (~ (~ppⅴⅴqq) ^ (~) ^ (~qqⅴⅴpp))

p q ~p ~pⅴ q p→ q0 0 1 1 10 1 1 1 11 0 0 0 01 1 0 1 1

Page 17: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Equivalence LawEquivalence Law

• These are similar to the These are similar to the arithmetic identitiesarithmetic identities you you may have learned in algebra, but for may have learned in algebra, but for propositional equivalencespropositional equivalences instead. instead.

• They provide a pattern or template that can be They provide a pattern or template that can be used to match all or part of a much more used to match all or part of a much more complicated proposition and to find an complicated proposition and to find an equivalence for it.equivalence for it.

Page 18: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logic Law Logic Law (p.1)(p.1)

Logic Law Name1 ~ ~p ⇔ p 雙否定定律

Double negation

2 ~(pⅴ q) ⇔ ~p ̂~q DeMorgan定律 ~(p q̂) ⇔ ~pⅴ ~q DeMorgan Law

3 (pⅴ q) ⇔ (qⅴ p) 交換律(p q̂) ⇔ (q p̂) Commutative

4 pⅴ (qⅴ r) ⇔ (pⅴ q)ⅴ r 結合律p (̂q r̂) ⇔ (p q̂)̂ r Associative

5 pⅴ (q r̂) ⇔ (pⅴ q)̂ (pⅴ r)分配律p (̂qⅴ r) ⇔ (p q̂)ⅴ (p r̂) Distributive

Page 19: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logic Law Logic Law (p.2)(p.2)

Logic Law Name6 pⅴ p ⇔ p 冪等定律

p p̂ ⇔ p Idempotent

7 pⅴ F0 ⇔ p 恆等定律 p T̂0 ⇔ p Identity

8 pⅴ ~p ⇔ T0 逆定律 p ̂~p ⇔ F0 Inverse

9 pⅴ T0 ⇔ T0 優控定律 p F̂0 ⇔ F0 Domination

10 pⅴ (p q̂) ⇔ p 吸收定律p (̂pⅴ q) ⇔ p Absorption

Page 20: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 1Example 1

• In Pascal program segments shown below, In Pascal program segments shown below, xx, , yy, , zz, and , and ii are integer variables. are integer variables.

Page 21: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 1 Example 1 (cont’d)(cont’d)

Part (a)Part (a) zz : = 4 ; : = 4 ;For For ii : = 1 to 10 do : = 1 to 10 do BeginBegin xx : = : = zz – – ii ; ; yy : = : = zz + 3* + 3*ii ; ; If (( If (( xx > 0 ) and ( > 0 ) and ( yy > 0 )) then > 0 )) then Writeln (‘ The value of the sum Writeln (‘ The value of the sum xx + + yy is ’, is ’, xx + + yy

) ) End;End;

Page 22: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 1 Example 1 (cont’d)(cont’d)

Part (b)Part (b) zz : = 4 ; : = 4 ;For For ii : = 1 to 10 do : = 1 to 10 do BeginBegin xx : = : = zz – – ii ; ; yy : = : = zz + 3* + 3*ii ; ; If If xx > 0 then > 0 then If If yy > 0 then > 0 then Writeln (‘ The value of the sum Writeln (‘ The value of the sum xx + + yy is ’, is ’, xx + + yy ) ) End;End;

Page 23: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 1 Example 1 (cont’d)(cont’d)

• Part (a) use a decision structure comparable to a Part (a) use a decision structure comparable to a statement of the form statement of the form ((pp ^ ^ qq))→→rr..

• In part (b), we have In part (b), we have pp: : xx>0>0, , qq: : yy>0>0, which are st, which are statements when the variables atements when the variables xx, , yy are assigned th are assigned the values 4 – e values 4 – ii (for (for xx) and 4 + 3*) and 4 + 3*ii (for (for yy). ).

• Now, the letter Now, the letter rr denotes the denotes the Writeln Writeln statementstatement, , an “executable statement” that is actually an “executable statement” that is actually notnot a a statement in the usual sense of a declarative senstatement in the usual sense of a declarative sentence, which can be labeled true or false.tence, which can be labeled true or false.

Page 24: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 1 Example 1 (cont’d)(cont’d)

• In part (a), the total number of comparisons, (In part (a), the total number of comparisons, (xx > 0) and (> 0) and (yy > 0), is > 0), is 1010 (for (for xx > 0) + > 0) + 1010 (for (for yy > > 0) = 0) = 2020..

• In part (b), it’s the In part (b), it’s the nested implications nested implications pp →→ ( (qq → → rr)), therefore, (, therefore, (yy > 0) is not executed unless > 0) is not executed unless the comparison (the comparison (xx > 0) is executed and > 0) is executed and evaluated as true. The total number of evaluated as true. The total number of comparisons is comparisons is 1010 (for (for xx > 0) + > 0) + 33 (for (for yy > 0, as > 0, as ii = 1, 2, 3) = = 1, 2, 3) = 1313..

• Hence, program (b) is Hence, program (b) is more efficientmore efficient than (a). than (a).

Page 25: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 2Example 2

Find a simpler way of the compound statement.Find a simpler way of the compound statement.

Hence, we see that (Hence, we see that (ppⅴⅴqq)^ ~(~)^ ~(~pp ^ ^ qq) ) ⇔ ⇔ pp . .

(pⅴ q)̂ ~(~p ̂q) Reasons⇔ (pⅴ q)̂ (~ ~pⅴ ~q) DeMorgan⇔ (pⅴ q)̂ (pⅴ ~q) Double Negation⇔ pⅴ (q ̂ ~q) Distributive⇔ pⅴ F0 Inverse⇔ p Identity

Page 26: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 3Example 3

• A switching network is made up of wires and A switching network is made up of wires and switches connecting two terminals switches connecting two terminals TT11 and and TT22. In . In

such a network, and switch is either such a network, and switch is either open (0)open (0), or , or closed (1)closed (1). .

• We have three networks. Part (a) contains one We have three networks. Part (a) contains one switch, and each of parts (b) and (c) contains switch, and each of parts (b) and (c) contains two (independent) switches.two (independent) switches.

Page 27: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 3 Example 3 (cont’d)(cont’d)

• Part (a): Part (b): Part (c):Part (a): Part (b): Part (c):

―p ―

˙ ――p ――˙ ˙ ― ―˙ ˙ ――p ―q ――˙T 1 T 2 T 1 T 2 T 1 T 2

―q ―

Page 28: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 3 Example 3 (cont’d)(cont’d)

• For part (a), a network with one switch.For part (a), a network with one switch.

• For part (b), current flows from For part (b), current flows from TT11to to TT22 if either if either

of the switches of the switches pp or or qq is closed. We call this a is closed. We call this a pparallelarallel network network and represent it by and represent it by ppⅴⅴqq..

• For part (c), it requires that each of the switches For part (c), it requires that each of the switches pp, , qq be closed in order for current to flow from be closed in order for current to flow from TT11 to to TT22. Here the switches are in . Here the switches are in seriesseries, and this , and this

network is represented by network is represented by pp ^ ^ qq..

Page 29: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 4Example 4

• The switches in a network need The switches in a network need notnot act act independentlyindependently of each other.of each other.

―p ― ―p ― ―p ―

˙ ― ―q ― ― ―t ― ― ― ~t ― ―˙T 1 T 2

―r ― ― ~q ― ―r ―

Page 30: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 4 Example 4 (cont’d)(cont’d)

• The network is represented the corresponding statemeThe network is represented the corresponding statement nt ((ppⅴⅴqqⅴⅴrr)^()^(ppⅴⅴttⅴⅴ~~qq)^()^(ppⅴⅴ~~ttⅴⅴrr)). Using the laws . Using the laws of logic, we can find a simpler statement.of logic, we can find a simpler statement.

―p ― ―p ― ―p ―

˙ ― ―q ― ― ―t ― ― ― ~t ― ―˙T 1 T 2

―r ― ― ~q ― ―r ―

Page 31: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 4 Example 4 (cont’d)(cont’d)

(p ⅴ q ⅴ r )^(p ⅴ t ⅴ ~q )^(p ⅴ ~t ⅴ r ) Reasons⇔ p ⅴ [(q ⅴ r )^(t ⅴ ~q )^(~t ⅴ r )] Distributive

⇔ p ⅴ [(q ⅴ r )^(~t ⅴ r )^(t ⅴ ~q )] Commutative

⇔ p ⅴ [((q ^ ~t )ⅴ r )^(t ⅴ ~q )] Distributive

⇔ p ⅴ [((q ^ ~t )ⅴ r )^ ~(~t ^ ~~q )] DeMorgan

⇔ p ⅴ [((q ^ ~t )ⅴ r )^ ~(~t ^ q )] Double Negation

⇔ p ⅴ [~(~t ^ q ) ^ ((~t ^ q )ⅴ r)] Commutative (twice)

⇔ p ⅴ {[~(~t ^ q ) ^ (~t ^ q )]ⅴ [~(~t ^ q ) ^ r ]} Distributive

⇔ p ⅴ [F 0ⅴ (~(~t ^ q ) ^ r ] Inverse

⇔ p ⅴ [~(~t ^ q ) ^ r ] Identity

⇔ p ⅴ [(t ⅴ ~q ) ^ r ] DeMorgan

Page 32: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example 4 Example 4 (cont’d)(cont’d)

• Hence Hence ((ppⅴⅴqqⅴⅴrr)^()^(ppⅴⅴttⅴⅴ~~qq)^()^(ppⅴⅴ~~ttⅴⅴrr) ) ⇔ ⇔ pp [(ⅴ[(ⅴ ttⅴⅴ~~qq) ^ ) ^ rr]], and the new network shown below, which is , and the new network shown below, which is equivalent to the original one. equivalent to the original one.

• This one has only This one has only four switchesfour switches, five fewer than the o, five fewer than the original one.riginal one.

―――― p ――――

˙ ― ― t ― ―˙T 1 ―r ― ――― T 2

―~q ―

Page 33: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Defining Operators via Defining Operators via EquivalencesEquivalences

Using equivalences, we can define operators in terUsing equivalences, we can define operators in terms of other operators.ms of other operators.

• Exclusive or : Exclusive or : ppqq ≡ ( ≡ (ppqq))((ppqq)) ppqq ≡ ( ≡ (ppqq))((qqpp))

• Implies : Implies : ppq q ≡ ≡ p p qq• Biconditional : Biconditional : ppq q ≡ (≡ (ppqq)) ( (qqpp))

ppq q ≡ ≡ ((ppqq))

Page 34: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Summary of Propositional Summary of Propositional LogicLogic

• Atomic propositions: Atomic propositions: pp, , qq, , rr, … , …

• Boolean operators: Boolean operators:

• Compound propositions: Compound propositions: ss : : ( (pp qq) ) rr

• Equivalences: Equivalences: pp q q ((p p q q))

• Proof of equivalence:Proof of equivalence:– Truth tables.Truth tables.

– Symbolic derivations. Symbolic derivations. pp q q r … r …

Page 35: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logical Implication:Logical Implication:Rules of InferenceRules of Inference

Page 36: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

A Valid ArgumentA Valid Argument

Helping in proving theorems through the texts.Helping in proving theorems through the texts.

• The general form of an argument:The general form of an argument:

e.g., the implication: (e.g., the implication: (pp11 pp22 pp33 … … ppnn) ) → → qq . .

• Here Here nn is a positive integer, the statements is a positive integer, the statements pp11, , pp22, , pp33, …, , …,

ppnn are called the are called the premisespremises of the argument, and the state of the argument, and the state

ment ment qq is is conclusionconclusion for the argument. for the argument.

• The argument is The argument is validvalid if whenever : if whenever :

– Each premise Each premise pp11, , pp22, , pp33, ..., , ..., ppnn is true, is true,

– then the conclusion then the conclusion q q is likewise true.is likewise true.

Page 37: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

A Valid Argument A Valid Argument (cont’d)(cont’d)

# In fact, if any one of # In fact, if any one of pp11, , pp22, , pp33, ..., , ..., ppnn is false, then th is false, then th

e hypothesis e hypothesis pp11 pp22 pp33 … … ppn n is false and the impis false and the imp

lication (lication (pp11 pp22 pp33 … … ppnn) ) → → qq is is

automatically TRUEautomatically TRUE, regardless of the truth va, regardless of the truth value of lue of qq..

• Hence, one way to establish the Hence, one way to establish the validityvalidity of a gi of a given argument is to show that the statements (ven argument is to show that the statements (pp11

pp22 pp33 … … ppnn) ) → → qq is is

a TAUTOLOGYa TAUTOLOGY. (all truths). (all truths)

Page 38: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

ExampleExampleLet Let pp, , qq, , rr be the primitive statements given as be the primitive statements given as

• pp: Roger studies; : Roger studies; qq: Roger plays tennis;: Roger plays tennis; rr: Roger passes discrete mathematics.: Roger passes discrete mathematics.

Now, let Now, let pp11, , pp22, , pp33 denote the premises denote the premises

• pp11: If Roger studies, then he will pass discrete math.: If Roger studies, then he will pass discrete math.

• pp22: If Roger doesn’t play tennis, then he’ll study.: If Roger doesn’t play tennis, then he’ll study.

• pp33: Roger failed discrete math.: Roger failed discrete math.

Q: We want to determine whether the argumentQ: We want to determine whether the argument

((pp11 pp22 pp33) ) → → qq is is validvalid..

Page 39: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example Example (cont’d)(cont’d)

To do so, we rewrite To do so, we rewrite pp11, , pp22, , pp33 as as

• pp11: : pp→→rr ; ;

• pp22: ~: ~qq →→pp ; ;

• pp33: ~: ~rr . .

and examine the truth table for the implicationand examine the truth table for the implication

((pp11 pp22 pp33) ) → → qq

i.e.,i.e., [([(pp→→rr) ) (~(~qq →→pp ) ) ~~rr] ] → → qq . .

Page 40: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Example Example (cont’d)(cont’d)

Since the final column contains Since the final column contains all 1’sall 1’s, the implication is a , the implication is a tautologytautology. Hence . Hence ((pp11 pp22 pp33) ) → → qq is a is a validvalid argument. argument.

p 1 p 2 p 3 (p 1^p 2^p 3) (p 1^p 2^p 3) → qp q r p → r ~q → p ~r0 0 0 1 0 1 0 10 0 1 1 0 0 0 10 1 0 1 1 1 1 10 1 1 1 1 0 0 11 0 0 0 1 1 0 11 0 1 1 1 0 0 11 1 0 0 1 1 0 11 1 1 1 1 0 0 1

Page 41: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logically ImplicationLogically Implication

Def.Def. If If pp, , qq are arbitrary statements such that are arbitrary statements such that pp→→qq is a is a tautologytautology, then we say that , then we say that pp logically impl logically implies ies qq and we write and we write pp⇒⇒qq to denote this situation. to denote this situation.

• When When pp, , qq are any statements and are any statements and pp⇒⇒qq, the imp, the implication lication pp→→qq is a tautology is a tautology, and we refer to , and we refer to p p →→qq as a logical implication as a logical implication..

# We can avoid dealing with the idea of a tautology here # We can avoid dealing with the idea of a tautology here by saying that by saying that pp⇒⇒qq (i.e., (i.e., pp logically implies logically implies qq) if ) if qq is tr is true whenever ue whenever pp is true is true..

Page 42: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logically Implication Logically Implication (cont’d)(cont’d)

Let Let pp, , qq be arbitrary statements. be arbitrary statements.1) If 1) If pp⇔⇔qq, then the statement , then the statement pp↔↔qq is a tautology, is a tautology,

so the statements have the same truth values. Uso the statements have the same truth values. Under the conditions the statements nder the conditions the statements pp→→qq, , qq→→pp a are tautologies, and we have re tautologies, and we have pp⇒⇒qq and and qq⇒⇒pp..

2) Conversely, suppose that 2) Conversely, suppose that pp⇒⇒qq and and qq⇒⇒pp. The l. The logical implication ogical implication pp→→qq tells us that we never htells us that we never have statement ave statement pp with the truth value 1 and with the truth value 1 and qq wit with the truth value 0.h the truth value 0.

But could we have But could we have qq with the truth value 1 and with the truth value 1 and pp with t with the truth value 0 ?he truth value 0 ?

Page 43: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw

Logically Implication Logically Implication (cont’d)(cont’d)

• If this occurred, we could not have the logical iIf this occurred, we could not have the logical implication mplication qq→→pp. Therefore, when . Therefore, when pp⇒⇒qq and and qq⇒⇒pp, the statements , the statements pp, , qq have the same truth values have the same truth values and and pp⇔⇔qq..

• Finally, the notation Finally, the notation pp⇒⇒qq is used to indicate tha is used to indicate that t pp→→qq is is notnot a tautology – so the given implicat a tautology – so the given implication (ion (pp→→qq) is ) is notnot a logical implication. a logical implication.

Page 44: 資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen) chichen6@mail.tcu.edu.tw