Chapter 2 Fundamentals of Logic

Slides:



Advertisements
Similar presentations
Discrete Mathematics University of Jazeera College of Information Technology & Design Khulood Ghazal Mathematical Reasoning Methods of Proof.
Advertisements

Introduction to Proofs
Chapter 2 Fundamentals of Logic Dept of Information management National Central University Yen-Liang Chen.
CS128 – Discrete Mathematics for Computer Science
2009/91 Methods of Proof (§1.7) Methods of mathematical argument (proof methods) can be formalized in terms of rules of logical inference. Mathematical.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
CSE115/ENGR160 Discrete Mathematics 01/31/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/01/11
So far we have learned about:
Introduction to Logic Logical Form: general rules
TR1413: Discrete Mathematics For Computer Science Lecture 1: Mathematical System.
Fall 2002CMSC Discrete Structures1 Let’s proceed to… Mathematical Reasoning.
Adapted from Discrete Math
Methods of Proof & Proof Strategies
Chapter 2 – Fundamentals of Logic. Outline Basic Connectives and Truth Tables Logical Equivalence: The Laws of Logic Ligical Implication: Rules of Inference.
CSCI 115 Chapter 2 Logic. CSCI 115 §2.1 Propositions and Logical Operations.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Introduction to Proofs
Discrete Mathematics Chapter 1 The Foundations : Logic and Proofs 大葉大學 資訊工程系 黃鈴玲 (Lingling Huang)
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 03: PROOFS Section 1.5 Jarek Rossignac CS1050: Understanding.
Review I Rosen , 3.1 Know your definitions!
Chap. 2 Fundamentals of Logic. Proposition Proposition (or statement): an declarative sentence that is either true or false, but not both. e.g. –Margret.
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
CSci 2011 Discrete Mathematics Lecture 6
10/17/2015 Prepared by Dr.Saad Alabbad1 CS100 : Discrete Structures Proof Techniques(1) Dr.Saad Alabbad Department of Computer Science
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Discrete Structures (DS)
2.3Logical Implication: Rules of Inference From the notion of a valid argument, we begin a formal study of what we shall mean by an argument and when such.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
資訊科學數學 4 : More About Logic 陳光琦助理教授 (Kuang-Chi Chen)
Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems or solving problems, creativity and insight.
Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.
Chapter 3: Introduction to Logic. Logic Main goal: use logic to analyze arguments (claims) to see if they are valid or invalid. This is useful for math.
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 3 The Foundations: Logic and Proof,
2.5 The proofs of theorems 證明方法 p → q 與 p  q 之應用 Definition 2.8 Let n be an integer. We call n even if n is divisible by 2 - that is, if there exists.
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
Chapter 2 Symbolic Logic. Section 2-1 Truth, Equivalence and Implication.
Professor: Munehiro Fukuda
Chapter 2 Fundamentals of Logic 1. What is a valid argument or proof?
CSci 2011 Discrete Mathematics Lecture 4 CSci 2011.
CS104:Discrete Structures Chapter 2: Proof Techniques.
Week 4 - Friday.  What did we talk about last time?  Floor and ceiling  Proof by contradiction.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Discrete Math by R.S. Chang, Dept. CSIE, NDHU1 Fundamentals of Logic 1. What is a valid argument or proof? 2. Study system of logic 3. In proving theorems.
Chapter 1, Part III: Proofs With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without.
Section 1.7. Section Summary Mathematical Proofs Forms of Theorems Direct Proofs Indirect Proofs Proof of the Contrapositive Proof by Contradiction.
Chapter 1 Logic and proofs
2. The Logic of Compound Statements Summary
CSE15 Discrete Mathematics 02/01/17
Advanced Algorithms Analysis and Design
CSNB 143 Discrete Mathematical Structures
Discrete Mathematics Logic.
(CSC 102) Discrete Structures Lecture 2.
Proof Techniques.
Information Technology Department
CS201: Data Structures and Discrete Mathematics I
Mathematical Reasoning
Methods of Proof. Methods of Proof Definitions A theorem is a valid logical assertion which can be proved using Axioms: statements which are given.
이산 수학 Discrete Mathematics
Applied Discrete Mathematics Week 1: Logic
Computer Security: Art and Science, 2nd Edition
Discrete Mathematics Logic.
Foundations of Discrete Mathematics
COMP 1380 Discrete Structures I Thompson Rivers University
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Mathematical Reasoning
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

Chapter 2 Fundamentals of Logic Discrete and Combinatorial Mathematics R. P. Grimaldi, 5th edition, 2004 Chapter 2 Fundamentals of Logic

Logic Logic = the study of correct reasoning Use of logic In mathematics: to prove theorems In computer science: to prove that programs do what they are supposed to do

Propositions (命題) A proposition or statement (陳述) is a declarative sentence that may be assigned a ‘true’ or ‘false’ value, but not both. This value is the truth value of the proposition. Propositions: “1+2=3”, “Peter is a programmer”, “It is snowing”. Not Propositions: “Is 1+2=3?”, “What a beautiful evening!”, “The number x is an integer”. Also Propositions: “There exists no ghost”.

True or False, That’s All The proposition “There exists no ghost” is on equal footing with the “1+2=3” proposition. The only thing that matters is the fact that a proposition is ‘True’ or ‘False’. Because of this, we will often label our propositions simply p,q, etc. Sometimes we use 0 for False and 1 for True. Things become interesting if we combine propositions…

Connectives (連接詞) If p and q are propositions, new compound propositions (複合命題) can be formed by using connectives. Most common connectives: Conjunction AND Symbol ^ (且) Disjunction OR Symbol v (或) Exclusive disjunction OR Symbol v (互斥或) Negation NOT Symbol  (非) Implication Symbol  (則,蘊含) Biconditional Symbol  (若且唯若) The truth values of compound propositions can be described by truth tables (真值表).

Truth table of conjunction p ^ q is true only when both p and q are true. Example: p = "Tigers are animals", q = "Lions are plants" p ^ q = "Tigers are animals and Lions are plants" p q p ^ q 1

Truth table of disjunction The truth table of disjunction: p  q is false only when both p and q are false Example: p = "John is a programmer", q = "Mary is a lawyer" p v q = "John is a programmer or Mary is a lawyer" p q p v q 1

Exclusive disjunction “Either p or q” (but not both), in symbols p  q p  q is true only when p is true and q is false, or p is false and q is true. Example: p = "John is programmer, q = "Mary is a lawyer“ p v q = "Either John is a programmer or Mary is a lawyer but not both." p q p v q 1

Negation Negation of p: in symbols p p is false when p is true,  p is true when p is false. Example: p = "John is a programmer“  p = "It is not true that John is a programmer" p p 1

More compound propositions Let p, q, r be primitive propositions (簡單命題). We can form other compound propositions, such as (pq)^r p(q^r) ( p)( q) (pq)^( r) and many others…

Example: truth table of (pq)^r 1

Implication A conditional proposition (條件命題) is of the form “p implies q”, denoted by p  q, where p is the hypothesis (前提) and q is the conclusion (結論). Also “If p then q”.“p is sufficient for q”, “p is a sufficient condition (充分條件) for q”, “q is necessary for p”, “q is a necessary condition (必要條件) for p”, “p only if q”. Example: p = " John is a programmer " q = " Mary is a lawyer " p  q = “If John is a programmer then Mary is a lawyer"

Truth table of p  q p q p  q 1 p  q is true when both p and q are true or when p is false

Biconditional The biconditional proposition (雙向命題) is of the form “p if and only if q” or “ p iff q ” (若且唯若), denoted by p  q. p  q is true when both p  q and q  p are true. Example: p = " John is a programmer " q = " Mary is a lawyer " p  q = “John is a programmer iff Mary is a lawyer" p q p  q 1

Logical equivalence (邏輯等價) Two propositions are said to be logically equivalent () if their truth tables are identical. Example:  p  q  p  q p q  p  q p  q 1

Biconditional vs. Equivalence Don’t confuse the equivalence  with the biconditional  (only the biconditional has a truth table). For example: p  p is a proposition, a statement within logic, p  p is mathematically correct, … about logic. p  p is a False, p  p is incorrect Hence pp  (pp), and so on.

Converse The converse of p  q is q  p These two propositions are not logically equivalent p q p  q q  p 1

They are logically equivalent. Contrapositive (對換句) The contrapositive of the proposition p  q is  q   p. They are logically equivalent. p q p  q  q   p 1

Tautology (恆真命題) A proposition is a tautology (T0) if its truth table contains only true values for every case. p q p  p v q 1

Contradiction (矛盾命題) A proposition is a contradiction (F0) if its truth table contains only false values for every case. p p ^ ( p) 1

Example Pay attention to the phrase “logically”: “2 = 3–1” is not a tautology, but “2=1 or 21” is; “1+1=3” is not a contradiction, but “1=1 and 11” is. As with equivalence: look at the truth tables.

Proving Things in Logic The standard approach is to use truth tables. If we deal with n simple propositions p1,…,pn, our truth table will have size at least 2n. This becomes a substantial disadvantage if n is big. Sometimes there is a much more efficient way to prove equivalences. First, look at some very simple equivalences…

The Laws of Logic Double negation law: p  p       (雙否定定律) De Morgan’s laws: (pq)  pq, (De Morgan 定律) (pq)  pq Commutative laws: pq  qp and (交換律) pq  qp Associative laws: p(qr)  (pq)r, (結合律) p(qr)  (pq)r Distributive laws: p(qr)  (pq)(pr), (分配律)  p(qr)  (pq)(pr)

The Laws of Logic (Cont.) Idempotent laws: pp  p, (冪等定律) pp  p Identity laws: pFalse  p, (恆等定律) pTrue  p Inverse laws: pp  True, (逆定律) pp  False Domination laws: pTrue  True, (支配律) pFalse  False Absorption laws: p(pq)  p, (吸收律) p(pq)  p

Proving Equivalences Prove (p  q )  (p  q)  p.  (p  q )  (p  q) [DeMorgan’s Law]  (p  q )  (p  q) [Double Negation]  p  (q  q) [Distributive Law]  p  F0 [Inverse Law]  p [Identity Law] #

Simplify Statements Simplify “(p  q  r)  (p  t  q)  (p  t  r)”. (p  q  r)  (p  t  q)  (p  t  r) p  [(q  r)  (t  q)  (t  r)] [Distributive Law] p  [(q  r)  (t  r)  (t  q )] [Commutative Law] p  [((q  t)  r)  (t  q )] [Distributive Law] p  [((q  t)  r)  (t  q )] [Double Negation] p  [((q  t)  r)  (t  q )] [DeMorgan’s Law] p  [(t  q )  ((q  t)  r)] [Commutative Law] p  [((t  q )  (q  t))  ((t  q )  r)] [Distributive Law] p  [F0  ((t  q )  r)] [s  s  F0  s] p  [(t  q )  r] [F0 is the identity for ]

Simplify Statements (Cont.) p  [(t  q )  r] p  [(t  q )  r] [DeMorgan’s Law] p  [(t  q )  r] [Double Negation] p  [r  (t  q )] [Commutative Law] Hence (p  q  r)  (p  t  q)  (p  t  r)  p  [r  (t  q )]. #

Valid arguments (有效論證) Deductive reasoning(演繹推導): the process of reaching a conclusion q from a sequence of propositions p1, p2, …, pn. The propositions p1, p2, …, pn are called premises or hypothesis. The proposition q that is logically obtained through the process is called the conclusion.

Rules of inference 1. Modus ponens (肯定前件式) p  q p Therefore, q Example: Insects have six legs. Beetles are insects. Therefore beetles have six legs.

Rules of inference (Cont.) 2. Modus tollens (否定後件式) p  q ~q Therefore, ~p Example: Insects have six legs. Spiders have eight legs. Therefore spiders are not insects.

Rules of inference (Cont.) 3. Rule of disjunctive amplification p Therefore, p  q 4. Rule of conjunctive simplification p ^ q Therefore, p 5. Rule of conjunction p q Therefore, p ^ q

Rules of inference (Cont.) 6. Law of the syllogism (三段論法) p  q q  r Therefore, p  r Example: 72 is divisible by 6. 6 is divisible by 3. Therefore 72 is divisible by 3.

Rules of inference (Cont.) 7. Rule of disjunctive syllogism (析取三段論法) p  q p Therefore, q Example: John is studying or sleeping. John is not studying. Therefore John is sleeping.

Rules of inference (Cont.) 8. Rule of contradiction (矛盾證法) p  F0 Therefore, p If 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 )  F0.

Example Demonstrate the validity of the argument ((p  r)  (p  q)  (q  s))  (r  s) (1) p  r (2) r  p (3) p  q (4) r  q (Law of the Syllogism) (5) q  s (6) Therefore r  s (Law of the Syllogism)

Example Demonstrate the validity of the argument (((p  q)  (r  s))  (r  t)  (t))  p (1) r  t (2) t (3) r (Rule of disjunctive syllogism) (4) r  s (Rule of disjunctive amplification) (5) (r  s) (De Morgan’s law) (6) (p  q)  (r  s) (7)  (p  q) (Rule of disjunctive syllogism) (8) p  q (De Morgan’s law) (9) Therefore p (Rule of conjunctive simplification)

Quantifiers (量詞) A propositional function (命題函數) or open statement P(x) is a statement involving a variable x. For example: P(x): 2x is an even integer, where x is an element of a set D.

Domain of a Propositional Function In the propositional function P(x): “2x is an even integer”, the domain or universe D of P(x) must be defined, for instance D = {integers}.D is the set where the x's come from.

For every and for some Most statements in mathematics and computer science use terms such as for every and for some. For example: For every triangle T, the sum of the angles of T is 180 degrees. For every integer n, n is less than p, for some prime number p.

Universal quantifier One can write P(x) for every x in a domain D In symbols: x P(x) “” is called the universal quantifier (通用量詞). The statement x P(x) is True if P(x) is true for every x  D False if P(x) is not true for some x  D Example: Let P(n) be the propositional function n2 + 2n is an odd integer n  D = {all integers} P(n) is True only when n is an odd integer, False if n is an even integer.

Existential quantifier For some x  D, P(x) is true if there exists an element x in the domain D for which P(x) is true. In symbols: x, P(x) “” is called the existential quantifier (存在量詞).

Counterexample The universal statement x P(x) is false if x  D such that P(x) is false. The value x that makes P(x) false is called a counterexample to the statement x P(x). Example: P(x) = "every x is a prime number", for every integer x. But if x = 4 (an integer) this x is not a primer number. Then 4 is a counterexample to P(x) being true.

Generalized De Morgan’s Laws If P(x) is a propositional function, then each pair of propositions in a) and b) below have the same truth values: a) ~(x P(x)) and x: ~P(x) "It is not true that for every x, P(x) holds" is equivalent to "There exists an x for which P(x) is not true“ b) ~(x P(x)) and x: ~P(x) "It is not true that there exists an x for which P(x) is true" is equivalent to "For all x, P(x) is not true"

Rules of inference for quantified statements 1. Universal instantiation  xD, P(x) d  D Therefore P(d) 2. Universal generalization P(d) for any d  D Therefore xD, P(x) 3. Existential instantiation  x  D, P(x) Therefore P(d) for some d D 4. Existential generalization P(d) for some d D Therefore  xD, P(x)

Equivalences and Implications for quantified statements For a prescribed universe and any open statements P(x) and q(x) in the variable x: x [p(x)  q(x)]  [x p(x)  x q(x)] x [p(x)  q(x)]  [x p(x)  x q(x)] x [p(x)  q(x)]  [x p(x)  x q(x)] [x p(x)  x q(x)]  x [p(x)  q(x)]

Demonstrate Universally Quantified Statement In order to prove the universally quantified statement x P(x) is true It is not enough to show P(x) true for some x  D You must show P(x) is true for every x  D In order to prove the universally quantified statement x P(x) is false It is enough to exhibit some x  D for which P(x) is false This x is called the counterexample to the statement x P(x) is true

Axioms (公設) An axiom is a proposition accepted as true without proof within the mathematical system. There are many examples of axioms in mathematics: Example: In Euclidean geometry the following are axioms Given two distinct points, there is exactly one line that contains them. Given a line and a point not on the line, there is exactly one line through the point which is parallel to the line.

Theorems (定理) A theorem is a proposition of the form p  q which must be shown to be true by a sequence of logical steps that assume that p is true, and use definitions, axioms and previously proven theorems.

Lemmas and corollaries A lemma (輔助定理) is a small theorem which is used to prove a bigger theorem. A corollary (引理) is a theorem that can be proven to be a logical consequence of another theorem. Example from Euclidean geometry: "If the three sides of a triangle have equal length, then its angles also have equal measure."

Types of proof A proof is a logical argument that consists of a series of steps using propositions in such a way that the truth of the theorem is established. Direct proof Indirect proof

Direct proof Direct proof: p  q A direct method of attack that assumes the truth of proposition p, axioms and proven theorems so that the truth of proposition q is obtained. Example: For all real numbers d, d1, d2, and x, if d=min{d1,d2} and xd, then xd1 and xd2. Proof. From the definition of min, it follows that dd1 and dd2. From xd and dd1, we may derive xd1 by the transitive property of . From xd and dd2, we may derive xd2 by the same property. Therefore, xd1 and xd2. #

Indirect proof The method of proof by contradiction of a theorem p  q consists of the following steps: 1. Assume p is true and q is false 2. Show that ~p is also true. 3. Then we have that p ^ (~p) is true. 4. But this is impossible, since the statement p ^ (~p) is always false. There is a contradiction! 5. So, q cannot be false and therefore it is true. Or show that the contrapositive (~q)(~p) is true. Since (~q)  (~p) is logically equivalent to p  q, then the theorem is proved.

Example of Indirect proof For all real numbers x and y, if x+y2, then either x1 or y1. Proof. Assume that x + y  2, x < 1 and y < 1. Then it follows that x + y < 1 + 1 = 2. It contradicts to the assumption x + y  2. Thus, we conclude that x1 or y1. #

Brainstorm 騎士在旅途中遇見四個人,來自兩個不同家族F1 和 F2。在這四人的談話中,如果是關於與自己同家族所說的話,則是真話;否則是謊話。四人A,B,C,D的對話如下: A: B屬於F1家族。 B: C屬於F1家族。 C: D屬於F2家族。 D: A屬於F2家族。 問題: 誰屬於F1家族?誰屬於F2家族?