Principles of Computing – UFCFA3-30-1

Slides:



Advertisements
Similar presentations
1. Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: The Moon is made of green cheese. Trenton.
Advertisements

CS128 – Discrete Mathematics for Computer Science
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
1 Section 1.1 Logic. 2 Proposition Statement that is either true or false –can’t be both –in English, must contain a form of “to be” Examples: –Cate Sheller.
Discrete Mathematics Math 6A Instructor: M. Welling.
CSE115/ENGR160 Discrete Mathematics 01/17/12 Ming-Hsuan Yang UC Merced 1.
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.
Adapted from Discrete Math
Chapter 1, Part I: Propositional Logic With Question/Answer Animations.
The Foundations: Logic and Proofs
Discrete Mathematics Goals of a Discrete Mathematics Learn how to think mathematically 1. Mathematical Reasoning Foundation for discussions of methods.
Propositions and Truth Tables
The Foundations: Logic and Proofs
2009/9 1 Logic and Proofs §1.1 Introduction §1.2 Propositional Equivalences §1.3 Predicates and Quantifiers §1.4 Nested Quantifiers §1.5~7 Methods of Proofs.
Discrete Maths 2. Propositional Logic Objective
Discrete Mathematics and Its Applications
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1: The Foundations: Logic and Proofs
Chapter 1, Part I: Propositional Logic With Question/Answer Animations.
Chapter 2: The Logic of Compound Statements 2.2 Conditional Statements
Lecture 4. CONDITIONAL STATEMENTS: Consider the statement: "If you earn an A in Math, then I'll buy you a computer." This statement is made up of two.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
LOGIC Lesson 2.1. What is an on-the-spot Quiz  This quiz is defined by me.  While I’m having my lectures, you have to be alert.  Because there are.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Chapter 1: The Foundations: Logic and Proofs
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
Logic The Lost Art of Argument. Logic - Review Proposition – A statement that is either true or false (but not both) Conjunction – And Disjunction – Or.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
LECTURE 1. Disrete mathematics and its application by rosen 7 th edition THE FOUNDATIONS: LOGIC AND PROOFS 1.1 PROPOSITIONAL LOGIC.
رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.
Section 1.1. Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: a) The Moon is made of green.
Discrete Mathematics Lecture # 4. Conditional Statements or Implication  If p and q are statement variables, the conditional of q by p is “If p then.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
CS104 The Foundations: Logic and Proof 1. 2 What is Discrete Structure?  Discrete Objects  Separated from each other (Opposite of continuous)  e.g.,
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
CS-7081 Application - 1. CS-7082 Example - 2 CS-7083 Simplifying a Statement – 3.
Logical Operators (Connectives) We will examine the following logical operators: Negation (NOT,  ) Negation (NOT,  ) Conjunction (AND,  ) Conjunction.
Simple Logic.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Chapter 1 Propositional Logic
Discrete Mathematical
2. The Logic of Compound Statements Summary
Discrete Mathematics Lecture 1 Logic of Compound Statements
CSNB 143 Discrete Mathematical Structures
CSE15 Discrete Mathematics 01/30/17
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
Logic.
Ch.1 (Part 1): The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Logic – Bell Ringer.
CS100: Discrete structures
Information Technology Department
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
CS 220: Discrete Structures and their Applications
CHAPTER 1: LOGICS AND PROOF
CS201: Data Structures and Discrete Mathematics I
Discrete Mathematics and Its Applications Kenneth H
MAT 3100 Introduction to Proof
Cs Discrete Mathematics
The Foundations: Logic and Proofs
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
1.3 Propositional Equivalences
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
The Foundations: Logic and Proofs
Presentation transcript:

Principles of Computing – UFCFA3-30-1 Week-6 Logic and Proposition Instructor : Mazhar H Malik Email : mazhar@gcet.edu.om Global College of Engineering and Technology

With Question/Answer Animations

Chapter Summary Propositional Logic Predicate Logic The Language of Propositions Applications Logical Equivalences Predicate Logic

Section 1.1

Section Summary Propositions Connectives Truth Tables Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth Tables

Propositions A proposition is a declarative sentence that is either true or false. Examples of propositions: The Moon is made of green cheese. Trenton is the capital of New Jersey. Toronto is the capital of Canada. d) 1 + 0 = 1 e) 0 + 0 = 2 Examples that are not propositions. Sit down! What time is it? c) x + 1 = 2 d) x + y = z

Propositional Logic Constructing Propositions Propositional Variables: p, q, r, s, … The proposition that is always true is denoted by T and the proposition that is always false is denoted by F. Compound Propositions; constructed from logical connectives and other propositions Negation ¬ Conjunction ∧ Disjunction ∨ Implication → Biconditional ↔

Compound Propositions: Negation The negation of a proposition p is denoted by ¬p and has this truth table: p ¬p T F Example: If p denotes “The earth is round.”, then ¬p denotes “It is not the case that the earth is round,” or more simply “The earth is not round.”

Conjunction The conjunction of propositions p and q is denoted by p ∧ q and has this truth table: p q p ∧ q T F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∧q is raining.” denotes “I am at home and it

Disjunction The disjunction of propositions p and q is denoted by p ∨q and has this truth table: is denoted p q p ∨q T F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p ∨q denotes “I am at home or it is raining.”

The Connective Or in English In English “or” has two distinct meanings. “Inclusive Or” - In the sentence “Students who have taken CS202 or Math120 may take this class,” we assume that students need to have taken one of the prerequisites, but may have taken both. This is the meaning of disjunction. For p ∨q to be true, either one or both of p and q must be true. “Exclusive Or” - When reading the sentence “Soup or salad comes with this entrée,” we do not expect to be able to get both soup and salad. This is the meaning of Exclusive Or (Xor). In p ⊕ q , one of p and q must be true, but not both. The truth table for ⊕ is: p q p ⊕q T F

Implication If p and q are propositions, then p →q is a conditional statement or implication which is read as “if p, then q ” and has this truth table: p q p →q T F Example: If p denotes “I am at home.” and q denotes “It is raining.” then p →q denotes “If I am at home then it is raining.” Example: “If I am elected, then I will lower taxes.” In p →q , p is the hypothesis (antecedent or premise) and q is the conclusion (or consequence).

Different Ways of Expressing p →q if p, then q if p, q q unless ¬p q if p q whenever p q follows from p p implies q p only if q q when p p is sufficient for q q is necessary for p a necessary condition for p is q a sufficient condition for q is p

Definition 1. Negation of p Let p be a proposition. The statement “It is not the case that p” is also a proposition, called the “negation of p” or ¬p (read “not p”) Table 1. The Truth Table for the Negation of a Proposition p ¬p T F F T p = The sky is blue. p = It is not the case that the sky is blue. p = The sky is not blue.

Definition 2. Conjunction of p and q Let p and q be propositions. The proposition “p and q,” denoted by pq is true when both p and q are true and is false otherwise. This is called the conjunction of p and q. Table 2. The Truth Table for the Conjunction of two propositions p q pq T T T T F F F T F F F F

Definition 3. Disjunction of p and q Let p and q be propositions. The proposition “p or q,” denoted by pq, is the proposition that is false when p and q are both false and true otherwise. Table 3. The Truth Table for the Disjunction of two propositions p q pq T T T T F T F T T F F F

Definition 4. Exclusive or of p and q Let p and q be propositions. The exclusive or of p and q, denoted by pq, is the proposition that is true when exactly one of p and q is true and is false otherwise. Table 4. The Truth Table for the Exclusive OR of two propositions p q pq T T F T F T F T T F F F

Definition 5. Implication pq Let p and q be propositions. The implication pq is the proposition that is false when p is true and q is false, and true otherwise. In this implication p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). Table 5. The Truth Table for the Implication of pq. p q pq T T T T F F F T T F F T

Definition 6. Biconditional Let p and q be propositions. The biconditional pq is the proposition that is true when p and q have the same truth values and is false otherwise. “p if and only if q, p is necessary and sufficient for q” Table 6. The Truth Table for the biconditional pq. p q pq T T T T F F F T F F F T

Prove that (pq)  (p  q)

Example: DeMorgans Prove that (pq)  (p  q) T T T F F T F F p q (pq) (pq) p q (p  q) T T T F F T F F T F F F F T F F T F T F T F F F T T T T

Converse, Contrapositive, and Inverse

Converse, Contrapositive, and Inverse From p →q we can form new conditional statements . q →p ¬q → ¬ p ¬ p → ¬ q is the converse of p →q is the contrapositive of p →q is the inverse of p →q Example: Find the converse, inverse, and contrapositive of “It raining is a sufficient condition for my not going to town.” Or If it is raining than I do not go to town. Solution: converse: If I do not go to town, then it is raining. contrapositive: If I go to town, then it is not raining. inverse: If it is not raining, then I will go to town.

Biconditional p p ↔q denotes If p and q are propositions, then we can form the biconditional proposition p ↔q , read as “p if and only if q .” The biconditional ↔q denotes the proposition with this truth table: p p q p ↔q T F If p denotes “It is fish.” and q denotes “It lives in water” p ↔q denotes “It’s fish if and only if it lives in water.” If p denotes “I am at home.” and q denotes “It is raining.” then p ↔q denotes “I am at home if and only if it is raining.”

Expressing the Biconditional Some alternative ways “p if and only if q” is expressed in English: p is necessary and sufficient for q if p then q , and conversely p iff q

Truth Tables For Compound Propositions Construction of a truth table: Rows Need a row for every possible combination of values for the atomic propositions. Columns Need a column for the compound proposition (usually at far right) Need a column for the truth value of each expression that occurs in the compound proposition as it is built up. This includes the atomic propositions

Example Truth Table Construct a truth table for p q r r p  q

Equivalent Propositions Two propositions are equivalent if they always have the same truth value. Example: Show using a truth table that the conditional is equivalent to the contrapositive. Solution: p q ¬ p ¬ q p →q ¬q → ¬ p T F

Using a Truth Table to Show Non- Equivalence Example: Show using truth tables that neither the converse nor inverse of an implication are not equivalent to the implication. Solution: p q ¬ p ¬ q p →q ¬ p →¬ q q → p T F

Precedence of Logical Operators  1   2 3   4 5 p q  r is equivalent to (p q)  r If the intended meaning is p (q  r ) then parentheses must be used.

Excercise Show that ¬(p ∨ q) and ¬p ∧¬q are logically equivalent.

Exercise: Fill up the rest of Table q ¬q p ∨¬q p ∧ q (p ∨¬q) → (p ∧ q) T F

Premises, conclusion and argument An argument in propositional logic is a sequence of propositions. All but the final proposition in the argument are called premises and the final proposition is called the conclusion. Consider these statements. The first two are called premises and the third is called the conclusion. The entire set is called an argument. “All lions are fierce.” “Some lions do not drink coffee.” “Some fierce creatures do not drink coffee

Addition Rule

Simplification Rule

Hypothetical syllogism

Hypothetical Syllogism

P = “You send me an e-mail message,” Show that the premises “If you send me an e-mail message, then I will finish writing the program,” “If you do not send me an e-mail message, then I will go to sleep early,” and “If I go to sleep early, then I will wake up feeling refreshed” lead to the conclusion “If I do not finish writing the program, then I will wake up feeling refreshed.” Let P = “You send me an e-mail message,” q = “I will finish writing the program,” r = “I will go to sleep early,” s = “I will wake up feeling refreshed.” Then the premises are p → q, ¬p → r, r → s. The desired conclusion is ¬q → s. We need to give a valid argument with premises p → q, ¬p → r, and r → s and conclusion ¬q → s. Step Reason p → q 2. ¬q →¬p ¬p → r ¬q → r r → s ¬q → s Premise Contrapositive of (1) Premise Hypothetical syllogism using (2) and (3) Premise Hypothetical syllogism using (4) and (5)