1 Propositional Logic Rosen 5 th ed., § 1.1-1.2 2 Foundations of Logic: Overview Propositional logic:Propositional logic: –Basic definitions. –Equivalence.

Slides:



Advertisements
Similar presentations
Propositional Equivalences
Advertisements

CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
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.
Foundations of Logic Mathematical Logic is a tool for working with elaborate compound statements. It includes: A formal language for expressing them.
Discrete Mathematics Lecture 1 Logic of Compound Statements Harper Langston New York University.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Introduction to Logic Sections 1.1 and 1.2 of Rosen Fall 2010 CSCE 235 Introduction to Discrete Structures URL: cse.unl.edu/~cse235 Questions:
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.
Proofs Using Logical Equivalences Rosen 1.2 List of Logical Equivalences p  T  p; p  F  pIdentity Laws p  T  T; p  F  FDomination Laws p  p.
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.
Logical Equivalence & Predicate Logic
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.
CompSci 102 Discrete Math for Computer Science January 17, 2012 Prof. Rodger.
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.
© 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.
Propositional Logic Foundations of Logic: Overview Propositional logic (§ ): – Basic definitions. (§1.1) – Equivalence rules & derivations. (§1.2)
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
1.1 CompSci 102© Michael Frank Today’s topics Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading:
Review I Rosen , 3.1 Know your definitions!
CompSci Welcome! Discrete Mathematics for Computer Science CompSci 102 D243 LSRC M, W 10:05-11:20 Professor: Jeffrey Forbes.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
CS 381 DISCRETE STRUCTURES Gongjun Yan Aug 25, November 2015Introduction & Propositional Logic 1.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Chapter 1: The Foundations: Logic and Proofs
The Foundations: Logic and Proof, Sets, and Foundations PROPOSITIONS A proposition is a declarative sentence that is either True or False, but not the.
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
Fall 2013 Foundations of 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.
University of Aberdeen, Computing Science CS2013 Mathematics for Computing Science Adam Wyner Adapted from Michael P. Frank ' s course based on the text.
Spring 2003CMSC Discrete Structures1 Let’s get started with... Logic !
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Module #1 - Logic 2016/7/91 Module #1: Logic (Textbook: §1.1~1.4) Dr. Chih-Wei Yi Department of Computer Science National Chiao Tung University.
Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine.
Logic I 권태경 To do so, it should include a language to express statements, a notation to simplify expressions. Logic Mathematical Logic.
Chapter 1 Propositional Logic
2. The Logic of Compound Statements Summary
Discrete Mathematics Lecture 1 Logic of Compound Statements
CSNB 143 Discrete Mathematical Structures
CSCE 235 Introduction to Discrete Structures
CS 202, Spring 2008 Epp, sections 1.1 and 1.2
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
6/20/2018 Discrete Math A word about organization: Since different courses have different lengths of lecture periods, and different instructors go at different.
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
Ch.1 (Part 1): The Foundations: Logic and Proofs
Mathematics for Computing
Propositional Logic (§1.1)
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
CSCI 3310 Mathematical Foundation of Computer Science
Administrivia Course Web:
CS100: Discrete structures
Information Technology Department
Propositional Equivalence (§1.2)
CS 220: Discrete Structures and their Applications
Discrete Mathematics and its Applications
CSE 311 Foundations of Computing I
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.
Discrete Structures Prepositional Logic 2
The Foundations: Logic and Proofs
Presentation transcript:

1 Propositional Logic Rosen 5 th ed., §

2 Foundations of Logic: Overview Propositional logic:Propositional logic: –Basic definitions. –Equivalence rules & derivations. Predicate logicPredicate logic –Predicates. –Quantified predicate expressions. –Equivalences & derivations.

3 Propositional Logic Propositional Logic is the logic of compound statements built from simpler statements using Boolean connectives. Applications: Design of digital electronic circuits.Design of digital electronic circuits. Expressing conditions in programs.Expressing conditions in programs. Queries to databases & search engines.Queries to databases & search engines.

4 Definition of a Proposition A proposition (p, q, r, …) is simply a statement (i.e., a declarative sentence) with a definite meaning, having a truth value that’s either true (T) or false (F) (never both, neither, or somewhere in between). [In probability theory, we assign degrees of certainty to propositions. For now: True/False only!]

5 Examples of Propositions “It is raining.” (Given a situation.)“It is raining.” (Given a situation.) “Beijing is the capital of China.”“Beijing is the capital of China.” “1 + 2 = 3”“1 + 2 = 3” The following are NOT propositions: “Who’s there?” (interrogative, question)“Who’s there?” (interrogative, question) “La la la la la.” (meaningless interjection)“La la la la la.” (meaningless interjection) “Just do it!” (imperative, command)“Just do it!” (imperative, command) “Yeah, I sorta dunno, whatever...” (vague)“Yeah, I sorta dunno, whatever...” (vague) “1 + 2” (expression with a non-true/false value)“1 + 2” (expression with a non-true/false value)

6 An operator or connective combines one or more operand expressions into a larger expression. (E.g., “+” in numeric exprs.) Unary operators take 1 operand (e.g., -3); binary operators take 2 operands (eg 3  4). Propositional or Boolean operators operate on propositions or truth values instead of on numbers. Operators / Connectives

7 The Negation Operator The unary negation operator “¬” (NOT) transforms a prop. into its logical negation. E.g. If p = “I have brown hair.” then ¬p = “I do not have brown hair.” then ¬p = “I do not have brown hair.” Truth table for NOT: Truth table for NOT:

8 The Conjunction Operator The binary conjunction operator “  ” (AND) combines two propositions to form their logical conjunction. E.g. If p=“I will have salad for lunch.” and q=“I will have steak for dinner.”, then p  q=“I will have salad for lunch and I will have steak for dinner.”

9 Note that a conjunction p 1  p 2  …  p n of n propositions will have 2 n rows in its truth table.Note that a conjunction p 1  p 2  …  p n of n propositions will have 2 n rows in its truth table. ¬ and  operations together are universal, i.e., sufficient to express any truth table!¬ and  operations together are universal, i.e., sufficient to express any truth table! Conjunction Truth Table

10 The Disjunction Operator The binary disjunction operator “  ” (OR) combines two propositions to form their logical disjunction. p=“That car has a bad engine.” q=“That car has a bad carburetor.” p  q=“Either that car has a bad engine, or that car has a bad carburetor.”

11 Note that p  q means that p is true, or q is true, or both are true!Note that p  q means that p is true, or q is true, or both are true! So this operation is also called inclusive or, because it includes the possibility that both p and q are true.So this operation is also called inclusive or, because it includes the possibility that both p and q are true. “¬” and “  ” together are also universal.“¬” and “  ” together are also universal. Disjunction Truth Table

12 A Simple Exercise Let p=“It rained last night”, q=“The sprinklers came on last night,” r=“The lawn was wet this morning.” Translate each of the following into English: ¬p = r  ¬p = ¬ r  p  q = “It didn’t rain last night.” “The lawn was wet this morning, and it didn’t rain last night.” “Either the lawn wasn’t wet this morning, or it rained last night, or the sprinklers came on last night.”

13 The Exclusive Or Operator The binary exclusive-or operator “  ” (XOR) combines two propositions to form their logical “exclusive or” (exjunction?). p = “I will earn an A in this course,” q = “I will drop this course,” p  q = “I will either earn an A for this course, or I will drop it (but not both!)”

14 Note that p  q means that p is true, or q is true, but not both!Note that p  q means that p is true, or q is true, but not both! This operation is called exclusive or, because it excludes the possibility that both p and q are true.This operation is called exclusive or, because it excludes the possibility that both p and q are true. “¬” and “  ” together are not universal.“¬” and “  ” together are not universal. Exclusive-Or Truth Table

15 Note that English “or” is by itself ambiguous regarding the “both” case! “Pat is a singer or Pat is a writer.” - “Pat is a man or Pat is a woman.” - Need context to disambiguate the meaning! For this class, assume “or” means inclusive. Natural Language is Ambiguous  

16 The Implication Operator The implication p  q states that p implies q. It is FALSE only in the case that p is TRUE but q is FALSE. E.g., p=“I am elected.” q=“I will lower taxes.” p  q = “If I am elected, then I will lower taxes” (else it could go either way)

17 Implication Truth Table p  q is false only when p is true but q is not true.p  q is false only when p is true but q is not true. p  q does not imply that p causes q!p  q does not imply that p causes q! p  q does not imply that p or q are ever true!p  q does not imply that p or q are ever true! E.g. “(1=0)  pigs can fly” is TRUE!E.g. “(1=0)  pigs can fly” is TRUE!

18 Examples of Implications “If this lecture ends, then the sun will rise tomorrow.” True or False?“If this lecture ends, then the sun will rise tomorrow.” True or False? “If Tuesday is a day of the week, then I am a penguin.” True or False?“If Tuesday is a day of the week, then I am a penguin.” True or False? “If 1+1=6, then George passed the exam.” True or False?“If 1+1=6, then George passed the exam.” True or False? “If the moon is made of green cheese, then I am richer than Bill Gates.” True or False?“If the moon is made of green cheese, then I am richer than Bill Gates.” True or False?

19 Inverse, Converse, Contrapositive Some terminology: The inverse of p  q is: ¬ p  ¬qThe inverse of p  q is: ¬ p  ¬q The converse of p  q is: q  p.The converse of p  q is: q  p. The contrapositive of p  q is: ¬q  ¬ p.The contrapositive of p  q is: ¬q  ¬ p. One of these has the same meaning (same truth table) as p  q. Can you figure out which?One of these has the same meaning (same truth table) as p  q. Can you figure out which?

20 How do we know for sure? Proving the equivalence of p  q and its contrapositive using truth tables:

21 The biconditional operator The biconditional p q states that p is true if and only if (IFF) q is true. The biconditional p  q states that p is true if and only if (IFF) q is true. It is TRUE when both p  q and q  p are TRUE. p = “It is raining.” q = “The home team wins.” p q = “If and only if it is raining, the home team wins.” p  q = “If and only if it is raining, the home team wins.”

22 Biconditional Truth Table p q means that p and q have the same truth value.p  q means that p and q have the same truth value. Note this truth table is the exact opposite of  ’s!Note this truth table is the exact opposite of  ’s! p q means ¬(p  q) p  q means ¬(p  q) p q does not imply p and q are true, or cause each other.p  q does not imply p and q are true, or cause each other.

23 Boolean Operations Summary We have seen 1 unary operator (4 possible) and 5 binary operators (16 possible).We have seen 1 unary operator (4 possible) and 5 binary operators (16 possible).

24 Precedence of Logical Operators ¬1 23  45 Operator Precedence

25 Nested Propositional Expressions Use parentheses to group sub-expressions: “I just saw my old friend, and either he’s grown or I’ve shrunk.” = f  (g  s)Use parentheses to group sub-expressions: “I just saw my old friend, and either he’s grown or I’ve shrunk.” = f  (g  s) – (f  g)  s would mean something different – f  g  s would be ambiguous By convention, “¬” takes precedence over both “  ” and “  ”.By convention, “¬” takes precedence over both “  ” and “  ”. – ¬s  f means (¬s)  f, not ¬ (s  f)

26 Some Alternative Notations

27 Bits and Bit Operations A bit is a binary (base 2) digit: 0 or 1.A bit is a binary (base 2) digit: 0 or 1. Bits may be used to represent truth values.Bits may be used to represent truth values. By convention: 0 represents “true”; 1 represents “false”.By convention: 0 represents “true”; 1 represents “false”. Boolean algebra is like ordinary algebra except that variables stand for bits, + means “or”, and multiplication means “and”.Boolean algebra is like ordinary algebra except that variables stand for bits, + means “or”, and multiplication means “and”.

28 Bit Strings A Bit string of length n is an ordered series or sequence of n  0 bits.A Bit string of length n is an ordered series or sequence of n  0 bits. By convention, bit strings are written left to right: e.g. the first bit of “ ” is 1.By convention, bit strings are written left to right: e.g. the first bit of “ ” is 1. When a bit string represents a base-2 number, by convention the first bit is the most significant bit. Ex =8+4+1=13.When a bit string represents a base-2 number, by convention the first bit is the most significant bit. Ex =8+4+1=13.

29 Bitwise Operations Boolean operations can be extended to operate on bit strings as well as single bits.Boolean operations can be extended to operate on bit strings as well as single bits. E.g.: Bit-wise OR Bit-wise AND Bit-wise XORE.g.: Bit-wise OR Bit-wise AND Bit-wise XOR

30 Tautologies and Contradictions A tautology is a compound proposition that is true no matter what the truth values of its atomic propositions are! Ex. p   p [What is its truth table?] A contradiction is a comp. prop. that is false no matter what! Ex. p   p [Truth table?] Other comp. props. are contingencies.

31 Propositional Equivalence Two syntactically (i.e., textually) different compound propositions may be semantically identical (i.e., have the same meaning). We call them equivalent. Learn: Various equivalence rules or laws.Various equivalence rules or laws. How to prove equivalences using symbolic derivations.How to prove equivalences using symbolic derivations.

32 Proving Equivalences Compound propositions p and q are logically equivalent to each other IFF p and q contain the same truth values as each other in all rows of their truth tables. Compound proposition p is logically equivalent to compound proposition q, written p  q, IFF the compound proposition p  q is a tautology.

33 Ex. Prove that p  q   (  p   q). Proving Equivalence via Truth Tables F T T T T T T T T T F F F F F F F F T T

34 Equivalence Laws These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead.These are similar to the arithmetic identities you may have learned in algebra, but for propositional equivalences instead. They provide a pattern or template that can be used to match much more complicated propositions and to find equivalences for them.They provide a pattern or template that can be used to match much more complicated propositions and to find equivalences for them.

35 Equivalence Laws - Examples Identity: p  T  p p  F  pIdentity: p  T  p p  F  p Domination: p  T  T p  F  FDomination: p  T  T p  F  F Idempotent: p  p  p p  p  pIdempotent: p  p  p p  p  p Double negation:  p  pDouble negation:  p  p Commutative: p  q  q  p p  q  q  pCommutative: p  q  q  p p  q  q  p Associative: (p  q)  r  p  (q  r) (p  q)  r  p  (q  r)Associative: (p  q)  r  p  (q  r) (p  q)  r  p  (q  r)

36 More Equivalence Laws Distributive: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r)Distributive: p  (q  r)  (p  q)  (p  r) p  (q  r)  (p  q)  (p  r) De Morgan’s:  (p  q)   p   q  (p  q)   p   qDe Morgan’s:  (p  q)   p   q  (p  q)   p   q

37 More Equivalence Laws Absorption: p  (p  q)  pAbsorption: p  (p  q)  p p  (p  q)  p p  (p  q)  p Trivial tautology/contradiction: p   p  T p   p  FTrivial tautology/contradiction: p   p  T p   p  F

38 Defining Operators via Equivalences Using equivalences, we can define operators in terms of other operators. Implication: p  q   p  qImplication: p  q   p  q Biconditional: p  q  (p  q)  (q  p) p  q   (p  q)Biconditional: p  q  (p  q)  (q  p) p  q   (p  q) Exclusive or: p  q  (p  q)  (p  q) p  q  (p  q)  (q  p)Exclusive or: p  q  (p  q)  (p  q) p  q  (p  q)  (q  p)

39 An Example Problem Check using a symbolic derivation whether (p   q)  (p  r)   p  q   r.Check using a symbolic derivation whether (p   q)  (p  r)   p  q   r. (p   q)  (p  r)  [Expand definition of  ]  (p   q)  (p  r) [Defn. of  ]   (p   q)  ((p  r)   (p  r)) [DeMorgan’s Law]  (  p  q)  ((p  r)   (p  r))  (  p  q)  ((p  r)   (p  r))

40 Example Continued... (  p  q)  ((p  r)   (p  r))  [  commutes]  (q   p)  ((p  r)   (p  r)) [  associative]  q  (  p  ((p  r)   (p  r))) [distrib.  over  ]  q  (((  p  (p  r))  (  p   (p  r))) [assoc.]  q  (((  p  p)  r)  (  p   (p  r))) [trivial taut.]  q  ((T  r)  (  p   (p  r))) [domination]  q  (T  (  p   (p  r))) [identity]  q  (  p   (p  r))  cont.

41 End of Long Example q  (  p   (p  r)) [DeMorgan’s]  q  (  p  (  p   r)) [Assoc.]  q  ((  p   p)   r) [Idempotent]  q  (  p   r) [Assoc.]  (q   p)   r [Commut.]   p  q   r Q.E.D. (quod erat demonstrandum)