Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

The Foundations: Logic and Proofs
1 Introduction to Abstract Mathematics Valid AND Invalid Arguments 2.3 Instructor: Hayk Melikya
L41 Lecture 2: Predicates and Quantifiers.. L42 Agenda Predicates and Quantifiers –Existential Quantifier  –Universal Quantifier 
CS128 – Discrete Mathematics for Computer Science
Logic 3 Tautological Implications and Tautological Equivalences
From Chapter 4 Formal Specification using Z David Lightfoot
Discrete Mathematics Math 6A Instructor: M. Welling.
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
First Order Logic. Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Fall 2002CMSC Discrete Structures1 Let’s proceed to… Mathematical Reasoning.
Adapted from Discrete Math
Methods of Proof & Proof Strategies
Chapter 1: The Foundations: Logic and Proofs
CSci 2011 Discrete Mathematics Lecture 3 CSci 2011.
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.
MATH 224 – Discrete Mathematics
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
Mathematical Structures for Computer Science Chapter 1.2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
Section 1.5. Section Summary Nested Quantifiers Order of Quantifiers Translating from Nested Quantifiers into English Translating Mathematical Statements.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Copyright © Cengage Learning. All rights reserved. CHAPTER 3 THE LOGIC OF QUANTIFIED STATEMENTS THE LOGIC OF QUANTIFIED STATEMENTS.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
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.
Lecture 4: Predicates and Quantifiers; Sets.
CompSci 102 Discrete Math for Computer Science January 24, 2012 Prof. Rodger Slides modified from Rosen.
Formal Logic Mathematical Structures for Computer Science Chapter 1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFormal Logic.
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.
Fall 2008/2009 I. Arwa Linjawi & I. Asma’a Ashenkity 1 The Foundations: Logic and Proofs Predicates and Quantifiers.
CS 285- Discrete Mathematics Lecture 4. Section 1.3 Predicate logic Predicate logic is an extension of propositional logic that permits concisely reasoning.
Rules of Inference Section 1.6. Arguments in Propositional Logic A argument in propositional logic is a sequence of propositions. All but the final proposition.
What is Reasoning  Logical reasoning is the process of drawing conclusions from premises using rules of inference.  These inference rules are results.
Predicate Logic One step stronger than propositional logic Copyright © Curt Hill.
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.
PREDICATES AND QUANTIFIERS COSC-1321 Discrete Structures 1.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Section 1.4. Propositional Functions Propositional functions become propositions (and have truth values) when their variables are each replaced by a value.
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.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
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 Logic and proofs
رياضيات متقطعة لعلوم الحاسب MATH 226. Chapter 1 Predicates and Quantifiers 1.4.
Advanced Algorithms Analysis and Design
CSE15 Discrete Mathematics 01/23/17
Lecture 1 – Formal Logic.
CSE15 Discrete Mathematics 01/30/17
Knowledge Representation and Reasoning
Discrete Mathematics Logic.
Applied Discrete Mathematics Week 5: Mathematical Reasoning
CS201: Data Structures and Discrete Mathematics I
CS201: Data Structures and Discrete Mathematics I
First Order Logic Rosen Lecture 3: Sept 11, 12.
Back to “Serious” Topics…
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Computer Security: Art and Science, 2nd Edition
Discrete Mathematics Logic.
Discrete Mathematics Lecture 3: Predicate and Quantifier
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Chapter 7. Propositional and Predicate Logic
Discrete Mathematics Lecture 4 & 5: Predicate and Quantifier
Predicates and Quantifiers
Foundations of Discrete Mathematics
CS201: Data Structures and Discrete Mathematics I
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

Hazırlayan DISCRETE COMPUTATIONAL STRUCTURES Propositional Logic PROF. DR. YUSUF OYSAL

Logical Inference Why do we study propositional logic? – We want to use them to solve problems. – To solve a problem using the propositional logic, we often need to start from some “premises,” and obtain a certain “conclusion” using inferences. Example: Computer scientists often need to verify the correctness of a program. – One possible approach is to prove the program is correct. – So one can start from the program and the semantics of the used programming language (i.e., the premise), and use inference to obtain a conclusion that the program does the right job. DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Logical Inference Deriving a logical conclusion by combining many propositions and using formal logic: hence, determining the truth of arguments. An argument is a sequence of statements in which the conjunction of the initial statements (called the premises/hypotheses) is said to imply the final statement (called the conclusion). An argument can be presented symbolically as (P 1 Λ P 2 Λ... Λ P n )  Q where P 1, P 2,..., P n represent the hypotheses and Q represents the conclusion. DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Valid Argument What is a valid argument?  When does Q logically follow from P 1, P 2,..., P n. Informal answer: Whenever the truth of hypotheses leads to the conclusion Note: We need to focus on the relationship of the conclusion to the hypotheses and not just any knowledge we might have about the conclusion Q. Example: – P 1 : Neil Armstrong was the first human to step on the moon. – P 2 : Mars is a red planet And the conclusion – Q: No human has ever been to Mars. – P 1 Λ P 2  Q is not a tautology DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Valid Argument An argument is valid if whenever the hypotheses are all true, the conclusion must also be true. A valid argument is intrinsically true, i.e. (P 1 Λ P 2 Λ... Λ P n )  Q is a tautology. How to arrive at a valid argument? – Using a proof sequence It is a sequence of propositional formulas in which each formula is either a hypothesis or the result of applying one of the formal system’s derivation rules to earlier formulas in the sequence. Generally speaking, in inference, we can always replace a logic formula with another one that is logically equivalent, just as we have seen for the implication rule. DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Rules for Propositional Logic DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Derivation rules for propositional logic Equivalence RulesInference Rules Allows individual formulas to be rewritten Allows new formulas to be derived Truth preserving rulesWork only in one direction

Implication Rule DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic The first, and simplest, rule is: P P → Q Q This rule is called Modus ponens. Intuitively, if we have the condition of an implication, then we can obtain its consequence. Example If you study the BİM122 material, then you will pass You study the BİM122 material ______________  You will pass

Another Implication Rule DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Recall that P → Q   P  Q   Q →  P. The implication rule just studied tells us that  Q  Q →  P  P If we replace  Q →  P in the above with P → Q, then we get another implication rule (Modus tonens):  Q P → Q  P

Yet Another Implication Rule DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic We have: P → Q Q → R  P → R Intuitively, if P implies Q and Q implies R, then we can get that P implies R. This rule is called Hypothetical syllogism. Example: P → Q means “if there is a storm, then the office is closed.” Q → R means “if the office is closed, then I don’t go to work.” P → R means “if there is a storm, then I don’t go to work.”

Conjunction and Simplification Rules DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Rules are not restricted to implications. For example, we have a conjunction rule: P Q ----  P  Q Intuitively, this means when you have P and Q both being true, then P  Q is also true. A closely related rule (simplification): P  Q  P Intuitively, this means when you have P  Q being true, clearly P is also true.

Disjunction Rules DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic One is (Disjunctive syllogism): P  Q  P  Q Another is (Addition rule): P  P  Q

Resolution Rule DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Third disjunction rule (Resolution rule): P  Q  P  R  Q  R It plays an important role in AI systems. Intuitively, it means: if P implies R and  P implies Q (why? Where do we get these implications?), then we must have either Q or R. Clearly, this is true since one of P and  P must be true.

Other Rules DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic We can have more rules like: P  Q P → R Q → S  R  S Intuitively it means we can do inference in each of two cases (P or Q) independently.

Rules of Inference or Method of Proof DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Rule of InferenceTautology (Deduction Theorem)Name P  P  Q P  (P  Q) Addition P  Q  P (P  Q)  P Simplification P Q  P  Q [(P)  (Q)]  (P  Q) Conjunction P P  Q  Q [(P)  (P  Q)]  P Modus Ponens  Q P  Q   P [(  Q)  (P  Q)]   P Modus Tollens P  Q Q  R  P  R [(P  Q)  (Q  R)]  (P  R) Hypothetical Syllogism (“chaining”) P  Q  P  Q [(P  Q)  (  P)]  Q Disjunctive syllogism P  Q  P  R  Q  R [(P  Q)  (  P  R)]  (Q  R) Resolution

Inference Example Prove P Λ  P  Q (called Inconsistency) 1. P premise 1 2.  P premise 2 3. P V Q1, addition 4. Q V P3, commutativity 5.  (  Q) V P4, double negation 6.  Q  P5, implication 7.  (  Q)2, 6, Modus Tollens 8. Q7, double negation DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Inference Example Suppose: (1) If it is Saturday today, then we play football or basketball. (2) If the football field is occupied, we don’t play football. (3) It is Saturday today, and the football field is occupied. Prove that we play basketball or volleyball. First we formalize the problem : P: It is Saturday today. Q: We play football. R: We play basketball. S: The football field is occupied. T: We play volleyball. Our premise : P  (Q  R), S  Q, P, S Need to prove : R  T DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic (1) P  (Q  R) Premise 1 (2) P Premise 2 (3) Q  R 1, 2, Implication (4) S   Q Premise 3 (5) S Premise 4 (6)  Q 3, 4, Implication (7) R 3, 6, Disjunction (8) R  T 7, Addition

Predicates DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Propositional logic cannot adequately express the meaning of all statements in mathematics and in natural language. For example, suppose that we know that “Every computer connected to the university network is functioning properly.” No rules of propositional logic allow us to conclude the truth of the statement “Computer3 is functioning properly,” where Computer3 is one of the computers connected to the university network. Likewise, we cannot use the rules of propositional logic to conclude from the statement “CS2 is under attack by an intruder,” where CS2 is a computer on the university network, to conclude the truth of “There is a computer on the university network that is under attack by an intruder.”

Predicates 18 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Statements involving variables, such as “x > 3,” “x = y + 3,” “x + y = z,” “computer x is under attack by an intruder,” “computer x is functioning properly,” are often found in mathematical assertions, in computer programs, and in system specifications. These statements are neither true nor false when the values of the variables are not specified. The statement “x is greater than 3” has two parts. The first part, the variable x, is the subject of the statement. The second part—the predicate, “is greater than 3”—refers to a property that the subject of the statement can have: P(x): “x is greater than 3” where P denotes the predicate “is greater than 3” and x is the variable. Once a value has been assigned to the variable x, the statement P(x) becomes a proposition and has a truth value.

Predicates 19 Example: Let P(x) denote the statement “x > 3.” What are the truth values of P(4) and P(2)? Solution: We obtain the statement P(4) by setting x = 4 in the statement “x > 3.” Hence, P(4), which is the statement “4 > 3,” is true. However, P(2), which is the statement “2 > 3,” is false. Example: Let A(x) denote the statement “Computer x is under attack by an intruder.” Suppose that of the computers on campus, only CS2 and MATH1 are currently under attack by intruders. What are truth values of A(CS1), A(CS2), and A(MATH1)? Solution: We obtain the statement A(CS1) by setting x = CS1 in the statement “Computer x is under attack by an intruder.” Because CS1 is not on the list of computers currently under attack, we conclude that A(CS1) is false. Similarly, because CS2 and MATH1 are on the list of computers under attack, we know that A(CS2) and A(MATH1) are true. DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Predicates 20 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic A predicate is a property or description of subjects in the universe of discourse. The following predicates are all italicized : Ahmet is tall. The bridge is structurally sound. 17 is a prime number. By taking a variable subject denoted by symbols such as x, y, z, and applying a predicate one obtains a propositional function (or formula). When an object from the universe is plugged in for x, y, etc. a truth value results: x is tall. …e.g. plug in x = Ahmet y is structurally sound. …e.g. plug in y = FSM n is a prime number. …e.g. plug in n = 111

Multivariable Predicates 21 Multivariable predicates generalize predicates to allow descriptions of relationships between subjects. These subjects may or may not even be in the same universe of discourse. For example: – Ahmet is taller than Burak. – 17 is greater than one of 12, 45. – Ahmet is at least 5 centimeters taller than Burak. Q: What universes of discourse are involved? The multivariable predicates, together with their variables create multivariable propositional functions. In the above examples, we have the following generalizations: – x is taller than y – a is greater than one of b, c – x is at least n inches taller than y DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Quantifiers 22 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Existential Quantifier “  ” reads “there exists” Universal Quantifier “  ” reads “for all” “  x P (x)” is true when an instance can be found which when plugged in for x makes P (x) true Like disjunctioning over entire universe  x P (x )  P (x 1 )  P (x 2 )  P (x 3 )  … “  x P (x)” true when every instance of x makes P (x) true when plugged in Like conjunctioning over entire universe  x P (x )  P (x 1 )  P (x 2 )  P (x 3 )  …

Predicates and Quantifiers 23 Example: Let P(x) be the statement “x + 1 > x.” What is the truth value of the quantification ∀ xP(x), where the domain consists of all real numbers? Solution: Because P(x) is true for all real numbers x, the quantification ∀ xP(x) is true. Example: Let Q(x) be the statement “x < 2.” What is the truth value of the quantification ∀ xQ(x), where the domain consists of all real numbers? Solution: Q(x) is not true for every real number x, because, for instance, Q(3) is false. That is, x = 3 is a counterexample for the statement ∀ xQ(x). Thus ∀ xQ(x) is false. DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Predicates and Quantifiers 24 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic Example: Let P(x) denote the statement “x > 3.” What is the truth value of the quantification ∃ xP(x), where the domain consists of all real numbers? Solution: Because “x > 3” is sometimes true, for instance, when x = 4, the existential quantification of P(x), which is ∃ xP(x), is true. Example: Let Q(x) denote the statement “x = x + 1.”What is the truth value of the quantification ∃ xQ(x), where the domain consists of all real numbers? Solution: Because Q(x) is false for every real number x, the existential quantification of Q(x), which is ∃ xQ(x), is false.

Multivariate Quantification 25 Quantification involving only one variable is fairly straightforward. Just a bunch of OR’s or a bunch of AND’s. When two or more variables are involved each of which is bound by a quantifier, the order of the binding is important and the meaning often requires some thought. When evaluating an expression such as  x  y  z P (x,y,z ) translate the proposition in the same order to English: There is an x such that for all y there is a z such that P (x,y,z) holds: P (x,y,z ) = “y - x ≥ z ” 1. There is an x such that for all y there is a z such that y - x ≥ z. 2. There is some number x which when subtracted from any number y results in a number bigger than some number z. Q: If the universe of discourse for x, y, and z is the natural numbers {0,1,2,3,4,5,6,7,…} what’s the truth value of  x  y  z P (x,y,z )? DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Multivariate Quantification 26 Set the universe of discourse to be all natural numbers {0, 1, 2, 3, … }. Let R (x,y ) = “x < y”. Q1: What does  x  y R (x,y ) mean? Q2: What does  y  x R (x,y ) mean? A1:  x  y R (x,y ): “All numbers x admit a bigger number y ” A2:  y  x R (x,y ): “Some number y is bigger than all x” Q: What’s the true value of each expression? A: 1 is true and 2 is false.  x  y R (x,y ): “All numbers x admit a bigger number y ” just set y = x + 1  y  x R (x,y ): “Some number y is bigger than all numbers x” y is never bigger than itself, so setting x = y is a counterexample So the order is important! DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Logical Equivalence with Formulas Two logical expressions possibly involving propositional formulas and quantifiers are said to be logically equivalent if no matter what universe and what particular propositional formulas are plugged in, the expressions always have the same truth value. –  x  y Q (x,y ) and  y  x Q (y,x ) are equivalent: names of variables don’t matter. –  x  y Q (x,y ) and  y  x Q (x,y ) are not! Recall DeMorgan’s identities: Conjunctional negation:  (p 1  p 2  …  p n )  (  p 1  p 2  …  p n ) Disjunctional negation:  (p 1  p 2  …  p n )  (  p 1  p 2  …  p n ) 27 L2 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic

Logical Equivalence with Formulas Since the quantifiers are the same as taking a bunch of AND’s (  ) or OR’s (  ) we have: Universal negation:   x P(x )   x  P(x ) Existential negation:   x P(x )   x  P(x ) Compute:   x  y x 2  y In English, we are trying to find the opposite of “every x admits a y greater or equal to x’s square”. The opposite is that “some x does not admit a y greater or equal to x’s square” Algebraically, one just flips all quantifiers from  to  and vice versa, and negates the interior propositional function. In our case we get:  x  y  ( x 2  y )   x  y x 2 > y 28 L2 DISCRETE COMPUTATIONAL STRUCTURES – Propositional Logic