CSS342: Propositions1 Professor: Munehiro Fukuda.

Slides:



Advertisements
Similar presentations
Logic Day Two.
Advertisements

TRUTH TABLES Section 1.3.
TRUTH TABLES The general truth tables for each of the connectives tell you the value of any possible statement for each of the connectives. Negation.
Truth Tables Presented by: Tutorial Services The Math Center.
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.
Types of Conditionals Geometry. The converse of a conditional statement is formed by switching the hypothesis and conclusion. p: x is prime. q: x is odd.
John Rosson Thursday February 15, 2007 Survey of Mathematical Ideas Math 100 Chapter 3, Logic.
Logic Chapter 2. Proposition "Proposition" can be defined as a declarative statement having a specific truth-value, true or false. Examples: 2 is a odd.
2/17/2008Sultan Almuhammadi1 ICS Logic & Sets (An Overview) Week 1.
Logic: Connectives AND OR NOT P Q (P ^ Q) T F P Q (P v Q) T F P ~P T F
1 Section 1.2 Propositional Equivalences. 2 Equivalent Propositions Have the same truth table Can be used interchangeably For example, exclusive or and.
1 Math 306 Foundations of Mathematics I Math 306 Foundations of Mathematics I Goals of this class Introduction to important mathematical concepts Development.
Conditional Statements
Discussion #10 1/16 Discussion #10 Logical Equivalences.
Propositional Logic 7/16/ Propositional Logic A proposition is a statement that is either true or false. We give propositions names such as p, q,
Logic Truth Tables, Propositions, Implications. Statements Logic is the tool for reasoning about the truth or falsity of statements. –Propositional logic.
Truth Tables for Negation, Conjunction, and Disjunction.
Chapter 1, Part I: Propositional Logic With Question/Answer Animations.
The Foundations: Logic and Proofs
1.1 Sets and Logic Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside.
Chapter 1 Section 1.4 More on Conditionals. There are three statements that are related to a conditional statement. They are called the converse, inverse.
Conditional Statements M Deductive Reasoning Proceeds from a hypothesis to a conclusion. If p then q. p  q hypothesis  conclusion.
The Foundations: Logic and Proofs
Section 1-4 Logic Katelyn Donovan MAT 202 Dr. Marinas January 19, 2006.
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
Discrete Maths 2. Propositional Logic Objective
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
(CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic.
Math 240: Transition to Advanced Math Deductive reasoning: logic is used to draw conclusions based on statements accepted as true. Thus conclusions are.
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
Discrete Mathematics Lecture1 Miss.Amal Alshardy.
The Foundations Logic and Proofs by raedRASHEED 2014.
CSNB143 – Discrete Structure LOGIC. Learning Outcomes Student should be able to know what is it means by statement. Students should be able to identify.
CSS 342 Data Structures, Algorithms, and Discrete Mathematics I
3.3: Truth Tables. Types of Statements Negation: ~p Conjunction: p ˄ q (p and q) Disjunction: p V q (p or q, or both) Conditional: p → q (if p, then q)
Chapter 2: The Logic of Compound Statements 2.2 Conditional Statements
CSS 342 DATA STRUCTURES, ALGORITHMS, AND DISCRETE MATHEMATICS I LECTURE CUSACK CHAPT 4.
Chapter 3: Semantics PHIL 121: Methods of Reasoning March 13, 2013 Instructor:Karin Howe Binghamton University.
Conditional Statements
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.
MAIN TOPIC : Statement, Open Sentences, and Truth Values Negation Compound Statement Equivalency, Tautology, Contradiction, and Contingency Converse, Inverse,
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
Lecture 9 Conditional Statements CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Logical Form and Logical Equivalence M Logical Form Example 1 If the syntax is faulty or execution results in division by zero, then the program.
Conditional Statements – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Conditional Statements Reading: Kolman, Section 2.2.
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
CSS342: Quantifiers1 Professor: Munehiro Fukuda. CSS342: Quantifiers2 Review of Propositions Proposition: a statement that is either true or false, but.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
TRUTH TABLES. Introduction The truth value of a statement is the classification as true or false which denoted by T or F. A truth table is a listing of.
Logic and Boolean Algebra. Logic statements  Real life statements  “I use public transportation when the car is broken and I have to go to work”  “All.
Joan Ridgway. If a proposition is not indeterminate then it is either true (T) or false (F). True and False are complementary events. For two propositions,
رياضيات متقطعة لعلوم الحاسب 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.
Conditional Statements Lecture 2 Section 1.2 Fri, Jan 20, 2006.
Mathematics for Computing Lecture 2: Computer Logic and Truth Tables Dr Andrew Purkiss-Trew Cancer Research UK
TRUTH TABLES Edited from the original by: Mimi Opkins CECS 100 Fall 2011 Thanks for the ppt.
Conditional statement or implication IF p then q is denoted p ⇒ q p is the antecedent or hypothesis q is the consequent or conclusion ⇒ means IF…THEN.
Reasoning and Proof Chapter Use Inductive Reasoning Conjecture- an unproven statement based on an observation Inductive reasoning- finding a pattern.
Logic and Truth Tables Winter 2012 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Module Code MA0003NI: Computing mathematics Lecture for Week Autumn.
Chapter 1 Logic and proofs
Logical Operators (Connectives) We will examine the following logical operators: Negation (NOT,  ) Negation (NOT,  ) Conjunction (AND,  ) Conjunction.
2. The Logic of Compound Statements Summary
CSS 342 Data Structures, Algorithms, and Discrete Mathematics I
Information Technology Department
CSS 342 Data Structures, Algorithms, and Discrete Mathematics I
Presentation transcript:

CSS342: Propositions1 Professor: Munehiro Fukuda

CSS342: Propositions2 Introduction Propositional logic is useful in CS to analyze such behavior of code portions. Proposition: a statement that is either true or false, but not both Logic: reasoning whether a consequence of given statements is correct, but not whether each statement is true. Example: –Proposition p:All mathematicians wear sandals. (A → B) –Proposition q:Anyone who wears sandals is an algebraist (B → C) –From p and q:All mathematicians are algebraists. (A → C)

CSS342: Propositions3 Propositions Examples: –In math 1.The only positive integers that divide 7 are 1 and 7 itself: (true) 2.For every positive integer n, there is a prime number larger than n: (true) –In history 1.Alfred Hitchcock won an Academy Award in 1940 for directing “Rebecca”: (false, he has never won one for directing) 2.Seattle held the World’s Fair, Expo 62: (true ) –In programming languages 1.Boolean expressions in if-else, while, and for statements for ( index = 0; index < 100; index++ ) { …….; } A proposition Not a proposition

CSS342: Propositions4 Compound propositions Conjunction of p and q –notations: p ^ q, p && q –True only if both p and q are true –truth table Disjunction of p or q –Notations: p v q, p || q –True if either p or q or both are true –truth table pqp ^ q FFF FTF TFF TTT pqp v q FFF FTT TFT TTT

CSS342: Propositions5 Binary Expressions in C++ Part1 How do you examine the behavior of if-else? –if ( a > = 1 && a <= 100 ) true if 1 ≤ a ≤ 100 –if ( a >= 1 || a <= 100 ) always true a < 11 <= a <= < a a >= 1 a <= 100 false true false condition proposition a < 11 <= a <= < a a >= 1 a <= 100 false true false condition proposition

CSS342: Propositions6 Negation The negation of p –Notations: p, not p, ¬p !p –Truth table: Example: –P: = 3 (false) –!p: !(1 + 1 = 3) ≡ ≠ 3 (true) P!p FT TF

CSS342: Propositions7 Boolean Algebra (Axioms) When T = true and F = false: 1.If p ≠ F then p = T, If p ≠ T then p = F 2.F && F = F, T || T = T 3.T && T = T, F || F = F 4.F && T = T && F = F 5.F || T = T || F = T 6.!T = F, !F = T

CSS342: Propositions8 Boolean Algebra (Theorems) When T = true and F = false: p && q = q && p, p || q = q || p (p && q) && r = p && (q && r), (p || q ) || r = p || (q || r) (p || q) && (p || r) = p || q && r, p && q || p && r = p && (q || r) p && F = F, p || T = T p && T = p,p || F = p p && !p = F,p || !p = T p && p = p,p || p = p p && (p || q) = p,p || p && q = p !(!p) = p p + q && !p = p + q Commutative Law Associative Law Distributive Law Complement Law Double Negation Absorption Law Square Law Consensus Law

CSS342: Propositions9 Binary Expressions in C++ Part2 How do you examine the behavior of if-else statements? –Given two distance objects, d1 and 2, if ( d1 < d2 ) p: d1.feet < d2.feet q: d1.feet == d2.feet a: d1.inches < d2.inches b: d1.inches == d2.inches c: d1.inches > d2.inches false true d1 < d2d2.inchesd1.inchesd2.feet d1.feet < < < < < < = = = = = = > > > > > >

CSS342: Propositions10 Binary Expressions in C++ Part2 (Cont’d) bool Distance::operator < ( const Distance& d2 ) const { return ( feet < d2.feet ) || (feet == d2.feet) && (inches < d2.inches); } p: d1.feet < d2.feet q: d1.feet == d2.feet a: d1.inches < d2.inches b: d1.inches == d2.inches c: d1.inches > d2.inches p && a || p && b || p && c || q && aDistributive Law = p && (a || b || c ) || q && a!a = b || c = p && (a || !a ) || q && aComplement Law = p && T || q && aTheorem 6 = p || q && a = ( d1.feet < d2.feet ) || ( d1.feet == d2.feet ) && (d1.inches < d2.inches)

CSS342: Propositions11 Conditional Propositions Given two propositions such as p and q, If p then qor p → q is called a conditional proposition. –P: hypothesis, antecedent, or sufficient condition –Q: conclusion, consequent, or necessary condition if p then q ≡ p only if q: called logically equivalent. –John may take CSS342 only if he advances to CSS343. –If John takes CSS342, he advances to CSS343. q p

CSS342: Propositions12 Truth Table of Conditional Propositions Chair statement: if CSS gets an additional $80,000, it will hire one new faculty member. P: CSS gets an additional $80,000. Q: CSS will hire one new faculty member. If both p and q are true, the chair said a correct statement. If p is true but q is false, the chair said a wrong statement. If p is false, the chair is not responsible for his statement. We should regard it as true. pqp → q TTT TFF FTT FFT

CSS342: Propositions13 Two propositions: P: 1 > 2 Q: 4 < 8 According to the truth table, p → q is true, while q → p is false. C++ program: What’s the execution result? –Linux: 1 > 2 -> 4 < 8: < 2: 0 –Goodall 1 > 2 -> 4 < 8: < 2: 0 It depends on how result1 was initialized. In math, we consider all initialized in true. Binary Expressions in C++ Part3 void main( ) { bool result1; if ( 1 > 2 ) result1 = 4 < 8; cout 2 -> 4 < 8: " << result1 << endl; bool result2; if ( 4 < 8 ) result2 = 1 > 2; cout 1 > 2: " << result2 << endl; }

CSS342: Propositions14 Logical Equivalence If two different compound propositions have the same truth values no matter what truth values their constituent propositions have, they are called: –logically equivalent Example: –!(p || q) ≡ !p && !q (De Morgan’s Laws) pqp || q!(p || q)!p!q!p && !q TTTFFF F TFTFFT F FTTFTF F FFFTTT T

CSS342: Propositions15 De Morgan’s Laws !(p || q) ≡ !p && !q –Proved by the truth page on the previous page. !(p && q) ≡ !p || !q pqp && q!(p && q)!p!q!p || !q TTTFFF F TFFTFT T FTFTTF T FFFTTT T

CSS342: Propositions16 Biconditional Propositions Given two propositions such as p and q, p if and only if qp iff qor p ↔ q is called a conditional proposition. P: a necessary and sufficient condition for Q Q: a necessary and sufficient condition for P pqp ↔ q TTT TFF FTF FFT

CSS342: Propositions17 Biconditional Propositions Proof of the Truth Table pqp → qq → p(p → q) && (q → p)p ↔ q TTTTTT TFFTFF FTTFFF FFTTTT

CSS342: Propositions18 Contrapositive !q →!p –The contrapositive of p → q –Logically equivalent pqp → q!q!p!q →!p TTTFFT TFFTFF FTTFTT FFTTTT