Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence:...

48
Chapter 2 – Fundamentals of Logic

Transcript of Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence:...

Page 1: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Chapter 2 – Fundamentals of Logic

Page 2: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Outline

• Basic Connectives and Truth Tables

• Logical Equivalence: The Laws of Logic

• Ligical Implication: Rules of Inference

• The Use of Quantifiers

• Quantifiers, Definitions, and the Proofs of Theorems

• Summary

Page 3: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Introduction

• Logic: rules to validate an argument is correct or not correct.

• The logic of mathematics is applied to decide whether one statement follows from, or is a logical consequence of, one or more other statements. 

Page 4: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

2.1 Basic Connectives and Truth Tables

• Terminology:– Assertions 斷言 : in a form of sentences;– Statements 敘述 (or Propositions 命題 ): verb

al or written assertions are declarative sentences that are either true or false – but not both.

Page 5: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example

• Example: we use the lowercase letters of the alphabet (such as p, q, and r) to represent these statements.

• p: Combinatorics is a required course for sophomores 二年級 .

• q: Margaret Mitchell wrote Gone with the Wind.

• r: 2 + 3 = 5.

Page 6: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example:

• we do not regard sentences such as the exclamation 叫喊– “What a beautiful evening!”

• or the command– “Get up and do your exercises.”

as statements.

• The preceding statements represented by p, q, and r are considered to be primitive statements 原始命題 , for there is really no way to break them down into anything simpler.

Page 7: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Introduction

• New statements can be obtained from primitive statements in two ways.– Transform a given statement p into the statement p,

which denotes its negation 否定 and is read “Not p”. 非 p (Negation statements)

– Combine two or more statements into a compound statement, using logical connectives. (Compound statements複合敘述 )

Page 8: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

4 logical connectives:

• Conjunction 連結 且 : The conjunction of the statements p, q is denoted by p q, which is read “p and q”.

• Disjunction 分離 或 : The expression p q denotes the disjunction of the statements p, q and is read “p or q”.

• Implication 蘊含 推得 : we say that “p implies q” (write p → q) is equal to “If p, then q”, – “p is sufficient for q”, – “p is a sufficient condition for q”, 充分條件– “p only if q”, p 唯若 q– “q is necessary for p”, and– “q is a necessary condition for p”. q 為 p 之必要條件– The statement p is called the hypothesis 假設 of the implication;

q is called the conclusion 結論 .

Page 9: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Introduction

• Biconditional: The biconditional of two statements p, q, is denoted by p q

• (read “p if and only if q” or 若且唯若• “p is necessary and sufficient for q”). 充分

必要條件

Page 10: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example:

• p, q, and r are defined as above.• p q : read “Combinatorics is a required course for soph

omores, and Margaret Mitchell wrote Gone with the Wind.”.

• p q : read “Combinatorics is a required course for sophomores, or Margaret Mitchell wrote Gone with the Wind.”.

• p → q : read “If combinatorics is a required course for sophomores, then Margaret Mitchell wrote Gone with the Wind.”.

• p q (or p iff q): Combinatorics is a required course for sophomores, if and only if Margaret Mitchell wrote Gone with the Wind.”.

Page 11: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Introduction

• Inclusive and exclusive or (denoted by and ):

• We use the word “or” in the inclusive sense.

• The exclusive “or” is denoted by “p q”.

• The compound statement “p q” is true if one or the other but not both of the statements p and q is true.

Page 12: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example

• p q – “Combinatorics is a required course for sophomores, or Margaret Mitchell wrote Gone with the Wind, but not both.”.

Page 13: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

True Table

• The judgment of the true or falsity of a (compound or negation) statement is dependent only on the true values of its component statements and can be investigated by truth tables as below for the negation and the different kinds of compound statements:

Page 14: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

True Table

Page 15: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.1: page 49~50

Page 16: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.1: page 49~50.

Page 17: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.3: page 51~52.

• (Especially focus on the decision (or selection) structure in computer programming.)

• Note: In our everyday language, we often find situations where an implication is used when the intention actually calls for a biconditional.

• In scientific writing one must make every effort to be unambiguous – when an implication is given, it ordinarily cannot, and should not, be interpreted as a biconditional.

Page 18: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.4: page 52.

Page 19: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.5: page 52~53.

Page 20: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.6: page 53.

Page 21: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

邏輯推論

Page 22: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Definition 2.1:

• A compound statement is called a tautology if it is true for all truth value assignments for its component statements.

• If a compound statement is false for all such assignments, then it is called a contradiction. (The symbol T0 to denote any tautology and the symbol F0 to denote any contradiction.)

Page 23: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

2.2 Logical Equivalence: The Laws of Logic

• In all areas of mathematics we need to know when the entities we are studying are equal or essentially the same.

• Our study of logic is often referred to as the algebra of propositions (as opposed to the algebra of real numbers).

• In this algebra we shall use the truth tables of the statements (propositions) to develop an idea of when two such entities are essentially the same.

Page 24: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.7:

• Evaluate the equivalence of the compound statements p q and p → q. (Page 56)

Page 25: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

邏輯等價

Page 26: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

邏輯等價

Page 27: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Definition 2.2:

• Two statements s1, s2 are said to be logically equivalent, and we write s1 s2, when the statements s1 is true (respectively, false) if and only if the statement s2 is true (respectively, false).

• (Note that when s1 s2 the statements s1 and s2 provide the same truth tables because s1, s2 have the same truth values for all choices of truth values for their primitive components.)

Page 28: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.8: page 57.

• (Note: the results are known as DeMorgan’s Laws)

Page 29: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.9: page 58. 分配律• (Note: the Distributive Laws of over and

over )

Page 30: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

The Laws of Logic: page 59.

Page 31: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

The Laws of Logic: page 59.

Page 32: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Definition 2.3:

• Let s be a statement. If s contains no logical connectives other than and , then the dual of s, denoted sd, is the statement obtained from s by replacing each occurrence of and by and , respectively, and each occurrence of T0 and F0 by F0 and T0, respectively.

Page 33: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example:

• 1) If p is any primitive statement, then pd is the same as p – that is, the dual of a primitive statement is simply the same primitive statement. And (p)d is the same as p.

• 2) The statements p p and p p are duals of each other whenever p is primitive – and so are the statements p T0 and p F0.

• 3) Given the primitive statements p, q, r and the compound statement s: (p q) (r T0),we find that the dual of s is sd: (p q) (r F0).

Page 34: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

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.

• Note: Alternative way to derive a logical equivalence is to use a tautology of the form “p q”, in addition to using the truth table for proving “p q”.

• For example, page 60 Table 2.11 shows the logical equivalence of “(rs)→q (rs)q”.

• Proving “(rs)→q (rs)q” a tautology can also indicate the logical equivalence of “(rs)→q” and “(rs)q”.

Page 35: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

True Table

Page 36: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

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 a statement such that q p.

• 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 P1 P.

Page 37: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.10: page 61.

Page 38: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.10

Page 39: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.11: page 62.

Page 40: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.13: page 62~63.

Page 41: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.13: page 62~63

Page 42: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.15

Page 43: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.15: (page 63~64.)

• Suppose p, q represent the statements. – p: Today is Thanksgiving. – q: Tomorrow is Friday.

• Then we obtain:– (The implication: p→q) If today is Thanksgiving, then tomorrow

is Friday. (TRUE)– (The contrapositive: q→p) if tomorrow is not Friday, then tod

ay is not Thanksgiving. (Likewise TRUE) – (The converse: q→p) if tomorrow is Friday, then today is Thank

sgiving.– (The inverse: p→q) if today is not Thanksgiving, then today is

not Friday.– Note: (p→q) (q→p), (q→p) (p→q).

Page 44: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.16: page 64. (Logic simplification)

Page 45: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.17: page 65.

Page 46: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.

Example 2.18: page 65~66.

Page 47: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.
Page 48: Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.