<<

Fundamentals of - Propositional -

부산대학교 정보컴퓨터공학과

김종덕 (kimjd at pusan.ac.kr) Problem: How to Reason With a Robot

You might try the ploy successfully used by Mr. Spock on the malevolent android 'Norman' (Star Trek), wherein he posed the following to Norman: "Everything I say is a lie. I'm a liar". Norman self-fried.

Can you prove what Spock said is invalid?

Intelligence Networking & Computing 2 Knights and Knaves

On a fictional island, all inhabitants are either knights, who always tell the , or knaves, who always lie. The puzzles involve a visitor to the island who meets small groups of inhabitants. Usually the aim is for the visitor to deduce the inhabitants' type from their statements, but some puzzles of this type ask for other facts to be deduced. The puzzle may also be to determine a yes/no question which the visitor can ask in order to discover what he needs to know.

Raymond Smullyan (b1919)

Intelligence Networking & Computing 3 Knights and Knaves : Question 1

John and Bill are residents of the island of knights and knaves.

John says: We are both knaves.

Who is who?

Intelligence Networking & Computing 4 Knights and Knaves : Question 2

John: We are the same kind.

Bill: We are of different kinds.

Who is who?

Intelligence Networking & Computing 5 Knights and Knaves : Question 3

Logician: Are you both knights?

John answers either Yes or No, but the Logician does not have enough information to solve the problem.

Logician: Are you both knaves?

John answers either Yes or No, and the Logician can now solve the problem.

Who is who?

Intelligence Networking & Computing 6 Knights and Knaves : Question 4

John and Bill are standing at a fork in the road. You know that one of them is a knight and the other is a knave, but you don't know which. You also know that one road leads to Freedom, and the other leads to Death.

By asking one yes/no question, can you determine the road to Freedom?

Intelligence Networking & Computing 7 6의 약수는 몇 개인가?

24의 약수는 몇 개인가?

210의 약수는 몇 개인가?

44100의 약수는 몇 개인가?

문제의 답? 문제의 풀이 체계?

Intelligence Networking & Computing 8 Knights and Knaves : Question 1

John and Bill are residents of the island of knights and knaves.

John says: We are both knaves. Who is who?

푷: John is a Knight; 푸: Bill is a Knight,

푹: What John says is true; 푹: ¬푷 ∧ ¬푸

. 푷, 푸, 푹 are variables

We know that 푷 ↔ 푹 is true. ; Premise

. 푷 ↔ 푹; if 푷 is true then 푹 is true and if 푷 is then 푹 is false.

푃 푄 푅: ¬푃 ∧ ¬푄 푃 ⟷ 푅 ¬푃 ∧ 푄

T T F F F

T F F F F

F T F T T

F F T F F premise conclusion Intelligence Networking & Computing 9 Knights and Knaves : Question 1

Example : If we know that ¬푃 ∨ (푃 ∧ 푄) is true. ⇔ ¬푃 ∨ 푃 ∧ ¬푃 ∨ 푄 ⇔ 푇 ∧ ¬푃 ∨ 푄 ⇔ ¬푃 ∨ 푄 ⇔ 푃 → 푄

We know that 푃 ↔ ¬푃 ∧ ¬푄 ⇔ 푃 ∧ ¬푃 ∧ ¬푄 ∨ ¬푃 ∧ ¬ ¬푃 ∧ ¬푄

⇔ 퐹 ∨ ¬푃 ∧ 푃 ∨ 푄

⇔ ¬푃 ∧ 푃 ∨ ¬푃 ∧ 푄 ⇔ ¬푃 ∧ 푄

Intelligence Networking & Computing 10 Knights and Knaves : Question 2

John: We are the same kind. Bill: We are of different kinds.

Who is who?

푷: John is a Knight; 푸: Bill is a Knight,

푹: What John says is true; 푷 ↔ 푸

푺: What Bill says is true; 푷 ↔ ¬푸

We know that 푷 ↔ 푹, 푸 ↔ 푺 ; Premises

푃 푄 푅: 푃 ⟷ 푄 푆: 푃 ⟷ ¬푄 푃 ⟷ 푅 푄 ⟷ 푆 ¬푃 ∧ 푄

T T T F T F F

T F F T F F F

F T F T T T T

F F T F F T F

premises conclusion

Intelligence Networking & Computing 11 Knights and Knaves : Question 2

We know that 푃 ⟷ 푃 ⟷ 푄 , 푄 ⟷ 푃 ⟷ ¬푄

We can infer that 푃 ⟷ ¬푄

. ¬ 푃 ⟷ 푄 ⇔ 푃 ⟷ ¬푄 , ¬ 푃 ⟷ ¬푄 ⇔ 푃 ⟷ 푄

. 푃 ⟷ 푃 ⟷ 푄 ⟺ ¬ 푃 ⟷ ¬푄 ⟷ ¬푄

푄 ⟷ (푃 ⟷ ¬푄) ⟷ 푇

Intelligence Networking & Computing 12 Contents

Formal Logic

. Introduction

. Propositional Calculus

Logical Implication

. Definitions

. Rules of

. and Indirect Proof

Predicate Calculus

. Introduction

. Formal Proofs in Predicate Calculus

Intelligence Networking & Computing 13 Formal Logic

 Formal (or Symbolic) Logic (형식논리학: 形式論理學)

Mathematical model of deductive thought(연역적사고: 演繹的思考)

. Modeling: extract important features according to purposes

(Ex) The law of gravity: 풎 ⋅ 풎′ 푭 = 푮 ⋅ 풓ퟐ masses, distance (), color () (Q1) What are the important features of deductive thought?

. (structure), not (meaning or )

(Ex) Borogoves are mimsy whenever it is brillig. It is now brillig and this thing is a borogove. Therefore, this thing is mimsy.

. http://en.wikipedia.org/wiki/Jabberwocky

. http://ko.wikipedia.org/wiki/재버워키 , Lewis Carrol (British, 1832~1898)

Intelligence Networking & Computing 14 (Q2) What does it mean for one sentence to “follow logically” from certain others?

(Q3) If a sentence does follow logically from certain others, what methods of proof might be necessary to establish this fact?

We need a different language since the natural language is ambiguous.

Intelligence Networking & Computing 15 Two models are considered:

(They use different languages with different expressive power.)

Propositional Calculus (명제논리: 命題論理)

. Statement Calculus, Sentential Logic, Propositional Logic

. Can express very simple, crude properties of deduction

First-Order Predicate Calculus (일차 술어논리: 一次 述語論理)

. First-Order Logic, Predicate Logic

. Suited for mathematical deduction

Intelligence Networking & Computing 16 PROPOSITIONAL CALCULUS

17 Propositional Calculus

푃, 푄

Logical Connectives 푃 ∨ 푄, ¬푃, 푃 → 푄

Well Formed Formula ¬푃 ∨ 푄

Equivalent Formula (¬푃 ∨ 푄) ⇔ (푃 → 푄)

Intelligence Networking & Computing 18 Propositional Calculus

Proposition(명제: 命題)

. An assertion (a declarative sentence) that can take a value true or false

(Ex) x + y = 4. This statement is false. ??? I work hard. I am healthy. !!!

Propositional Constants

. stand for a particular proposition (such as 푾 or 푯)

Propositional Variables

. stand for some (such as 푷, 푸, 푹, 푺)

Intelligence Networking & Computing 19 Compound Propositions (합성 명제: 合成 命題)

. More complicated propositions resulting from combining primitive propositions

(Ex) I work hard and I am healthy. If it rains then there is cloud in the sky.

Logical Connectives

Symbol Name Read

¬ not

∧ conjunction and

∨ disjunction or

→ implication (conditional) if … then …

↔ bi-conditional iff ()

Intelligence Networking & Computing 20 The meaning of logical connectives is defined by the .

푷 ¬푷 F T T F

푷 푸 푷 ∧ 푸 푷 ∨ 푸 푷 → 푸 푷 ↔ 푸 F F F F T T F T F T T F T F F T F F T T T T T T

Intelligence Networking & Computing 21 (Example) Jane promises that on December 26 푷 → 푸.

. 푷: I weigh more than 120 pounds.

. 푸: I shall enroll in an exercise .

. 푷 → 푸 : If 푷, then 푸.

Case 푃 푄 푃 → 푄 1 F F T 2 F T T 3 T F F 4 T T T

 (Case 4) Jane enrolls just as she said. So 푷 → 푸 is true.

 (Case 3) Jane breaks her promise. So 푷 → 푸 is false.

 (Case 2) Jane enrolls even though her weight is less than or equal to 120 pounds. However, she does not violate her promise. So 푷 → 푸 is true.

 (Case 1) Jane does not violate her promise, either. So 푷 → 푸 is true.

Intelligence Networking & Computing 22 Other expressions for implication

푷 (antecedent) → 푸 (consequent)

. If 푷 then 푸.

. 푷 only if 푸.

. 푷 is a sufficient condition (충분조건 : 充分條件) for 푸.

. 푸 is a necessary condition (필요조건: 必要條件) for 푷.

converse P  Q Q  P Converse (역: 逆): 푸 → 푷

Inverse (이: 裏): ¬푷 → ¬푸 inverse contrapositive

 (대우: 對偶) ¬푸 → ¬푷 Contrapositive : P  Q Q  P

Intelligence Networking & Computing 23 Translation

 푠 : Phyllis goes out for a walk.

 푡 : The moon is out

 푢 : It is snowing.

 For the above primitive statements 푠, 푡, 푢, translate each of the following into an English sentences.

. 푡 ∧ ¬푢 → 푠

. 푡 → ¬푢 → 푠

. ¬(푠 ↔ (푢 ∨ 푡)

 Get the logical (symbolic) notation for the following sentences.

. Phyllis will go out walking if and only if the moon is out.

. If it is snowing and the moon is not out, then Phyllis will not go out for a walk.

. It is snowing but Phyllis will still go out for a walk.

Intelligence Networking & Computing 24 Definition of Well-Formed Formula

A propositional well-formed formula (wff) is a grammatically correct , which is defined inductively as follows.

1. (Basis clause) A truth (T or F), a propositional , or a propositional constant is a wff.

2. (Inductive clause) If 푨 and 푩 are wffs, then ¬푨 , 푨 ∧ 푩 , 푨 ∨ 푩 , (푨 → 푩), and (푨 ↔ 푩) are wffs.

3. (Extremal clause) Only the strings formed by finite applications of clauses 1 and 2 are wffs.

Intelligence Networking & Computing 25 Precedence

. To remove parentheses, we use the following conventions.

. Hierarchy of evaluation: (highest) ¬,∧,∨, →, ↔ (lowest)

. Operations ∧,∨, → are left associative.

(Ex1) 푭 ∧ ¬푷 ∨ ¬푸 → ¬푸 ⇒ 푭 ∧ ¬푷 ∨ ¬푸 → ¬푸

(Ex2) 푷 → 푸 → 푹 ⇒ 푷 → 푸 → 푹

Intelligence Networking & Computing 26 Meaning of a wff and Truth table.

Meaning (or semantics) of a wff is defined by its truth table.

. 푝 : Combinatorics is a required course for sophomores.

. 푞 : Margaret Mitchell wrote Gone with the Wind.

. 푟 : ퟐ + ퟑ = ퟓ

. Margaret Mitchell wrote Gone with the Wind, and if ퟐ + ퟑ ≠ ퟓ then combinatorics is a required course for sophomores : 풒 ∧ (¬풓 → 풑).

풑 풒 풓 ¬풓 ¬풓 → 풑 풒 ∧ (¬풓 → 풑) T T T F T T T T F T T T T F T F T F T F F T T F F T T F T T F T F T F F F F T F T F F F F T F F

Intelligence Networking & Computing 27  (Ex) 푷 → 푸 ↔ (¬푷 ∨ 푸) ? 푃 푄 푃 → 푄 ¬푃 ∨ 푄 푃 → 푄 ↔ (¬푃 ∨ 푄) F F T T T F T T T T T F F F T T T T T T

Tautology

 Definition : A (항진명제: 恒眞命題) is a wff which takes the value true for every possible truth values assigned to the variables contained in the formula.

. (Note) A tautology is true every time – not a definition!

. If a wff 푷 is a tautology, it is denoted by ⊨ 푷.

 Definition : A (or denial, 모순명제: 矛盾命題) is a wff which takes the value false for every possible truth values assigned to the variables contained in the formula.

 Definition : A contingency (사건명제: 事件命題) is a wff which is neither a tautology nor a contradiction. Intelligence Networking & Computing 28 & EQUIVALENCE RULES

29 Logical Equivalence

Definition Let 푨 and 푩 be two wffs. The formulas 푨 and 푩 are said to be equivalent formulas (denoted by 푨 ⇔ 푩), when 푨 is true (false) iff 푩 is true (false).

. (cf.) Let 푷ퟏ, 푷ퟐ, ⋯ , 푷풏 be the propositional variables contained in 푨 and/or 푩. The formulas 푨 and 푩 are said to be equivalent formulas (designated by 푨 ⇔ 푩) if they have the same value for each of the ퟐ풏 sets of assignment to the propositional variables.

1 푨 and 푩 are equivalent formulas iff 푨 ↔ 푩 is a tautology (denoted by ⊨ 푨 ↔ 푩).

Intelligence Networking & Computing 30 Definition

A formula 푩 is a instance of a formula 푨 if 푩 is obtained from 푨 by substituting formulas for propositional variables in 푨 under the condition that the same formula is substituted for the same variable each time that variable appears in the formula 푨.

(Ex)

. 푨: 푷 → 푸 ∧ 푹 ∨ 푸

. Substitute (푷 → 푸) for 푷 and (푹 ∨ 푺) for 푸

. 푩: 푷 → 푸 → 푹 ∨ 푺 ∧ 푹 ∨ 푹 ∨ 푺

Intelligence Networking & Computing 31 Theorem 2 A substitution instance of a tautology is a tautology.

Theorem 3 A formula 푩 is equivalent to a formula 푨 if 푩 is obtained from 푨 by replacing a subformula 푪 of 푨 with a formula 푫 which is equivalent to 푪.

(Ex) For ⊨ 푷 → 푸 ↔ (¬푷 ∨ 푸), that is, 푷 → 푸 ⇔ ¬푷 ∨ 푸

. 푨: 푷 → 푸 ∧ 푹 ∨ 푸

. 푩: ¬푷 ∨ 푸 ∧ 푹 ∨ 푸 by substituting (푷 → 푸) with ¬푷 ∨ 푸

. Then, 푨 ⇔ 푩

Intelligence Networking & Computing 32 Definition If a formula 푨 contains the connectives ¬,∧, and ∨ only, then the dual of 푨, denoted by 푨풅, is the formula obtained from 푨 by replacing each occurrence of ∧ and ∨ with ∨ and ∧, respectively, and each occurrence of T and F by F and T, respectively.

. Ex) 푨 ∶ ¬푷 ∨ 푸 ∧ 푹 ∨ 푺 ∧ ¬푹 ∧ 푻 ⇒ 푨풅 ∶ ¬푷 ∧ 푸 ∨ 푹 ∧ 푺 ∨ (¬푹 ∨ 푭)

Theorem 4: De Morgan’s Law 풅 If 푨 푷ퟏ, 푷ퟐ, ⋯ , 푷풏 is a formula and 푨 is its dual, then 풅 ¬푨 푷ퟏ, 푷ퟐ, ⋯ , 푷풏 ⇔ 푨 (¬푷ퟏ, ¬푷ퟐ, ⋯ , ¬푷풏)

Theorem 5: Principle of Duality Let 푨 and 푩 be two formulas and 푨풅 and 푩풅 be their respective duals, then 푨 ⇔ 푩 iff 푨풅 ⇔ 푩풅

Intelligence Networking & Computing 33 The Laws of Logic - Equivalence Rules (1) # Rule of Equivalence Name of Rule

퐸1 ¬¬푷 ⇔ 푷 Law of

퐸2 푷 ∧ 푸 ⇔ 푸 ∧ 푷 Commutative Law of ∧

퐸3 푷 ∨ 푸 ⇔ 푸 ∨ 푷 Commutative Law of ∨

퐸4 푷 ∧ 푸 ∧ 푹 ⇔ 푷 ∧ (푸 ∧ 푹) Associative Law

퐸5 푷 ∨ 푸 ∨ 푹 ⇔ 푷 ∨ (푸 ∨ 푹) Associative Law

퐸6 푷 ∧ 푸 ∨ 푹 ⇔ 푷 ∧ 푸 ∨ 푷 ∧ 푹 Distributive Law

퐸7 푷 ∨ 푸 ∧ 푹 ⇔ 푷 ∨ 푸 ∧ 푷 ∨ 푹 Distributive Law

퐸8 ¬ 푷 ∧ 푸 ⇔ ¬푷 ∨ ¬푸 De Morgan’s Law

퐸9 ¬ 푷 ∨ 푸 ⇔ ¬푷 ∧ ¬푸 De Morgan’s Law

퐸10 푷 ∧ 푷 ⇔ 푷 Idempotent Law

퐸11 푷 ∨ 푷 ⇔ 푷 Idempotent Law

퐸12 푹 ∨ 푭ퟎ ⇔ 푹 Identity Law; 푭ퟎ : False

퐸13 푹 ∧ 푻ퟎ ⇔ 푹 Identity Law; 푻ퟎ : True

퐸14 푹 ∨ 푻ퟎ ⇔ 푻ퟎ Domination Law

퐸15 푹 ∧ 푭ퟎ ⇔ 푭ퟎ Domination Law Intelligence Networking & Computing 34 Equivalence Rules (2) # Rule of Equivalence Name of Rule

퐸16 푷 → 푸 ⇔ ¬푷 ∨ 푸

퐸17 ¬ 푷 → 푸 ⇔ 푷 ∧ ¬푸

퐸18 푷 → 푸 ⇔ ¬푸 → ¬푷 Contrapositive Law

퐸19 푷 → 푸 → 푹 ⇔ 푷 ∧ 푸 → 푹

퐸20 ¬ 푷 ↔ 푸 ⇔ 푷 ↔ ¬푸

퐸21 푷 ↔ 푸 ⇔ 푷 → 푸 ∧ (푸 → 푷)

퐸22 푷 ↔ 푸 ⇔ 푷 ∧ Q ∨ (¬푷 ∧ ¬푸)

Intelligence Networking & Computing 35