Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.

Slides:



Advertisements
Similar presentations
Logic The study of correct reasoning.
Advertisements

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.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 3.2 Truth Tables for Negation, Conjunction, and Disjunction.
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.
1 Section 1.2 Propositional Equivalences. 2 Equivalent Propositions Have the same truth table Can be used interchangeably For example, exclusive or and.
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.
CSE115/ENGR160 Discrete Mathematics 01/17/12 Ming-Hsuan Yang UC Merced 1.
CSE 311 Foundations of Computing I Autumn 2011 Lecture 2 More Propositional Logic Application: Circuits Propositional Equivalence.
Truth Tables for Negation, Conjunction, and Disjunction.
3.2 – Truth Tables and Equivalent Statements
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 3.2 Truth Tables for Negation, Conjunction, and Disjunction.
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Chapter 1, Part I: Propositional Logic With Question/Answer Animations.
The Foundations: Logic and Proofs
Intro to Discrete Structures
Conditional Statements M Deductive Reasoning Proceeds from a hypothesis to a conclusion. If p then q. p  q hypothesis  conclusion.
Section 1.5 Implications. Implication Statements If Cara has a piano lesson, then it is Friday. If it is raining, then I need to remember my umbrella.
The Foundations: Logic and Proofs
Section 1-4 Logic Katelyn Donovan MAT 202 Dr. Marinas January 19, 2006.
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.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
Chapter 1: The Foundations: Logic and Proofs
Foundations of Computing I CSE 311 Fall CSE 311: Foundations of Computing I Fall 2014 Lecture 1: Propositional Logic.
Copyright © Curt Hill Using Propositional Logic Several applications.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
Fall 2002CMSC Discrete Structures1 Let’s get started with... Logic !
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
Discrete Mathematics Lecture1 Miss.Amal Alshardy.
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.
MAIN TOPIC : Statement, Open Sentences, and Truth Values Negation Compound Statement Equivalency, Tautology, Contradiction, and Contingency Converse, Inverse,
How do I show that two compound propositions are logically equivalent?
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
Chapter 1: The Foundations: Logic and Proofs
Section 1.1. Section Summary Propositions Connectives Negation Conjunction Disjunction Implication; contrapositive, inverse, converse Biconditional Truth.
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.
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,
Section 1.1 Propositions and Logical Operations. Introduction Remember that discrete is –the study of decision making in non-continuous systems. That.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
رياضيات متقطعة لعلوم الحاسب 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.
 2012 Pearson Education, Inc. Slide Chapter 3 Introduction to Logic.
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.
Chapter 1 Logic and proofs
Section 3.2: Truth Tables for Negation, Conjunction, and Disjunction
Logical Operators (Connectives) We will examine the following logical operators: Negation (NOT,  ) Negation (NOT,  ) Conjunction (AND,  ) Conjunction.
Discrete Mathematical
CSCE 235 Introduction to Discrete Structures
Niu Kun Discrete Mathematics Chapter 1 The Foundations: Logic and Proof, Sets, and Functions Niu Kun 离散数学.
Logic.
(CSC 102) Discrete Structures Lecture 2.
Discrete Structures for Computer Science
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
Information Technology Department
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
Discrete Mathematics and Its Applications Kenneth H
Discrete Mathematics Lecture 2: Propositional Logic
MAT 3100 Introduction to Proof
Discrete Structures Prepositional Logic 2
The Foundations: Logic and Proofs
Presentation transcript:

Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August 29 th, 2016

Announcements Homework #1 will be assigned Wednesday.

Today’s Topic: Propositional Logic What is a proposition? Logical connectives and truth tables Translating between English and propositional logic

Example Logic is the basis of all mathematical and analytical reasoning Given a collection of known truths, logic allows us to deduce new truths Logic allows us to advance mathematics through an iterative process of conjecture and proof Base facts: If it is raining, I will not go outside If I am inside, Stephanie will come over Stephanie and I always play Scrabble if we are together during the weekend Today is a rainy Saturday Conclusion: Stephanie and I will play Scrabble today

Propositional logic is a very simple logic Definition: A proposition is a precise statement that is either true or false, but not both. Examples: = 4 (true) All dogs have 3 legs (false) x 2 < 0 (false) Washington, D.C. is the capital of the USA (true)

Not all statements are propositions

We can use logical connectives to build complex propositions We will discuss the following logical connectives: ¬ (not)  (conjunction / and)  (disjunction / or)  (exclusive or)  (implication)  (biconditional)

Negation The negation of a proposition is true iff the proposition is false P¬p TF FT The truth table for negation What we know What we want to know One row for each possible value of “what we know”

Negation Examples Negate the following propositions Today is Monday  Today is not Monday 21 * 2 = 42  21 * 2  42 What is the truth value of the following propositions ¬(9 is a prime number)  true ¬(Pittsburgh is in Pennsylvania)  false

Conjunction The conjunction of two propositions is true iff both propositions are true The truth table for conjunction pq p  q TTT TF F FT F FF F 2 2 = 4 rows since we know both p and q! iff = If and only if

Disjunction The disjunction of two propositions is true if at least one proposition is true The truth table for disjunction pq p  q TT T TF T FT T FF F

Conjunction and disjunction examples Let: p  x 2 ≥ 0 q  A lion weighs less than a mouse r  10 < 7 s  Pittsburgh is located in Pennsylvania What are the truth values of these expressions? p  q p  s p  q q  r true false This symbol means “is defined as” or “is equivalent to”

Exclusive or (XOR) The exclusive or of two propositions is true if exactly one proposition is true The truth table for exclusive or pq p  q TT F TF T FT T FF F Note: Exclusive or is typically used to natural language to identify choices. For example “You may have a soup or salad with your entree.”

Implication The implication p  q is false if p is true and q is false, and true otherwise Terminology p is called the hypothesis q is called the conclusion The truth table for implication pq p  q TT T TF F FT T FF T

Implication (cont.) The implication p  q can be read in a number of (equivalent) ways: If p then q p only if q p is sufficient for q q whenever p

Implication examples Let: p  Jane gets a 100% on her final q  Jane gets an A What are the truth values of these implications: p  q q  p true false

Biconditional The biconditional p  q is true if and only if p and q assume the same truth value The truth table for the biconditional pq p  q TT T TF F FT F FF T Note: The biconditional statement p  q is often read as “p if and only if q” or “p is a necessary and sufficient condition for q.”

Truth tables can also be made for more complex expressions Example: What is the truth table for (p  q)  ¬r? pqr p  q ¬r (p  q)  ¬r TTT TFF TTF TTT TFT FFT TFF FTT FTT FFT FTF FTT FFT FFT FFF FTT 2 3 = 8 rows Subexpressions of “what we want to know” What we want to know

Like mathematical operators, logical operators are assigned precedence levels 1.Negation ¬q  r means (¬q)  r, not ¬(q  r) 2.Conjunction 3.Disjunction q  r  s means (q  r)  s, not q  (r  s) 4.Implication q  r  s means (q  r)  s, not q  (r  s) 5.Biconditional In general, we will try to use parenthesis to disambiguate these types of expressions.

Group Exercises Problem 1: Show that an implication p  q and its contrapositive ¬q  ¬p always have the same value Hint: Construct two truth tables Problem 2: Construct the truth table for the compound proposition p  (¬q  r)  s

Logic also helps us understand bitwise operations Computers represent data as sequences of bits E.g., Bitwise logical operations are often used to manipulate these data If we treat 1 as true and 0 as false, our logic truth tables tell us how to carry out bitwise logical operations

Bitwise logic examples   

Group Exercises Problem 3: Translate the following sentences If it is raining then I will either play video games or watch a movie You get a free salad only if you order off of the extended menu and it is a Wednesday Problem 4: Solve the following bitwise problems  

Applications of this Lets build the “truth table” for binary, single bit, addition. aba + b This is the same truth table as XOR!

Transistors can implement logic gates This electronic circuit implements AND This electronic circuit implements OR

Lets Add! In Circuit Diagrams, logic gates have a short hand notation. AND Gate OR Gate XOR Gate NOT Gate There are others, but this is good for an introduction.

A 1-bit half adder with logic circuits. ABSC

So logic can be used to do Addition? The XOR Gate will give us what is necessary for the first bit of the addition. The additional AND Gate will only be 1 if both A and B are 1. This is a Carry! This is a 1-bit Half Adder. A Full Adder will take A, B, and C as input and allow chaining to get a N-bit adder:

Final Thoughts Propositional logic is a simple logic that allows us to reason about a variety of concepts It is even used inside a CPU to implement Arithmetic! In recitation: More examples and practice problems Be sure to attend! Next lecture: Logic puzzles and logical equivalences Please read sections 1.2 and 1.3