Intro to Discrete Structures

Slides:



Advertisements
Similar presentations
Logic: The foundation of reasoning
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.
Logic & Critical Reasoning
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
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.
CS128 – Discrete Mathematics for Computer Science
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Today’s Topics n Review Logical Implication & Truth Table Tests for Validity n Truth Value Analysis n Short Form Validity Tests n Consistency and validity.
1 Chapter 7 Propositional and Predicate Logic. 2 Chapter 7 Contents (1) l What is Logic? l Logical Operators l Translating between English and Logic l.
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.
From Chapter 4 Formal Specification using Z David Lightfoot
1 Math 306 Foundations of Mathematics I Math 306 Foundations of Mathematics I Goals of this class Introduction to important mathematical concepts Development.
Let remember from the previous lesson what is Knowledge representation
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,
Propositional Calculus Math Foundations of Computer Science.
Copyright © Cengage Learning. All rights reserved.
Adapted from Discrete Math
Lecture 8 Introduction to Logic CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Propositional Logic Review
Course Outline Book: Discrete Mathematics by K. P. Bogart Topics:
Chapter 1 The Logic of Compound Statements. Section 1.1 Logical Form and Logical Equivalence.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
MATH 224 – Discrete Mathematics
CSci 2011 Textbook ^Discrete Mathematics and Its Applications,  Rosen  6th Edition  McGraw Hill  2006.
1 Propositional Logic Proposition 2 Propositions can be divided into simple propositions and compound propositions. A simple (or basic) proposition is.
MATH 102 Contemporary Math S. Rook
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.
CISC 2315 Discrete Structures Professor William G. Tanner, Jr. Spring 2011 Slides created by James L. Hein, author of Discrete Structures, Logic, and Computability,
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
SSK3003 DISCRETE STRUCTURES
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
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.
Chapter 7 Logic, Sets, and Counting
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.
Chapter 8 – Symbolic Logic Professor D’Ascoli. Symbolic Logic Because the appraisal of arguments is made difficult by the peculiarities of natural language,
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
How do I show that two compound propositions are logically equivalent?
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
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.
CS6133 Software Specification and Verification
1 Propositional Logic Introduction. 2 What is propositional logic? Propositional Logic is concerned with propositions and their interrelationships. 
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
1 Section 6.2 Propositional Calculus Propositional calculus is the language of propositions (statements that are true or false). We represent propositions.
Outline Logic Propositional Logic Well formed formula Truth table
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Metalogic Soundness and Completeness. Two Notions of Logical Consequence Validity: If the premises are true, then the conclusion must be true. Provability:
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Logic and Truth Tables Winter 2012 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Chapter 1 Logic and proofs
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Chapter 7. Propositional and Predicate Logic
Propositional Calculus: Boolean Functions and Expressions
Lecture 1 – Formal Logic.
Knowledge Representation and Reasoning
Propositional Calculus: Boolean Functions and Expressions
Propositional Calculus: Boolean Algebra and Simplification
CS201: Data Structures and Discrete Mathematics I
Back to “Serious” Topics…
Computer Security: Art and Science, 2nd Edition
Chapter 7. Propositional and Predicate Logic
Foundations of Discrete Mathematics
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

Intro to Discrete Structures Spring 2014 Text: Mathematical Structures for Computer Science

Course Overview Discrete versus continuous Major topics: Develop abstract thinking through the study of logical arguments, proofs Develop recursive thinking, which provides problem solving tools such as recurrence relations and induction Algorithms & analysis (explored more fully in CS 317) Combinatorial techniques for counting objects Discrete structures such as graphs, sets, functions, trees, CS 214 - Chapter 1

1.1: Statements, Symbolic Representation, and Tautologies Formal Logic: Chapter 1 1.1: Statements, Symbolic Representation, and Tautologies

Why Study Formal Logic? Natural languages are ambiguous Formal logical proofs are based on the structure of logical expressions, or well-formed formulas, not the semantics Do conclusions follow necessarily from the truth of a set of initial statements. This is deductive reasoning A valid deduction can still be wrong, however, if the logical statements that are its initial assumptions are actually false. CS 214 - Chapter 1

Applications of Formal Logic Proof of program correctness Not easy, but can be done in limited cases Digital circuit design Formal specification of computer systems or programming languages Conditional statements are based on logic CS 214 - Chapter 1

Formal Logic: 1.1 – Overview Contents Connectives and Truth Values Tautologies Logical connectives in the real world Objectives Learn to use formal symbols of propositional logic Find the truth value of expressions in propositional logic CS 214 - Chapter 1

Statements, Connectives, and Truth Tables Statement (proposition): a sentence that is either true or false (but not both at the same time) e.g. “Jane is a doctor” but not “Are you happy?” or “It is pretty” Often used to represent facts TRUE and FALSE (T/F, 1/0) are absolute – not “mostly true” or “almost always false” Simple statements are represented by letters from the beginning of the alphabet: A, B, C, … CS 214 - Chapter 1

Statements, Connectives, and Truth Tables Logical connectives are used to combine several simple statements into compound statements. e.g., “The sun is shining and the temperature is 80” AND and OR are common connectors - binary If A and B are two simple statements, then A  B or A  B are compound statements. NOT is a logical modifier that changes the truth value of whatever it modifies (unary connective) If A is true, then A’ (or !A ) is false CS 214 - Chapter 1

Connectives and Truth Tables F A B A v B T F A ! A T F NEGATION CONJUNCTION DISJUNCTION Truth tables compute the value of logical expressions based on the truth values of their components. They consist of one column for each variable (statement letters, in our case) and one column for the result of each logical computation that the table represents. The number of rows is a function of the number of variables. There is one row for each possible combination of truth values for the variables. For example with two variables, A & B, the combinations are A = T, B = T, A = T, B = F, etc. For two variables, 22 = 4 rows, for 3 variables, 23 rows, … CS 214 - Chapter 1

Connectives and Truth Tables Implication is a logical connective that represents the combination “If A then B” In logic it is represented as “A → B”, read as “A implies B” A is the antecedent, B is the consequent Logic interpretation somewhat different from natural language interpretation Here we ask “is it true that A implies B?” The result depends on the truth values of A and B If A is false, what can we conclude? CS 214 - Chapter 1

Example What if A = “you make an A on the final exam” B = “you will get an A in the course” A → B “If you make an A on the final exam you will get an A in the course” When is this statement true, and when is it false? What is the truth value of A → B if A = T and B = T ? If A = T and B = F? If A = F and B = T? If A = F and B = F? CS 214 - Chapter 1

Connectives and Truth Tables F T ?? B A B→A T F T ?? A→B B→A (A→B) && (B→A) T F Equivalence 1 Logical values are always either true or false, never “I don’t know”, so by convention we assume that if the antecedent of an implication is false the consequent is true. See previous slide. The equivalence relation is written as A ↔ B. A & B are equivalent if it is true that whenever “A implies B” is true, it is also true that “B implies A”. Another way to state this relation is “B is true if and only if A is true” or “A is true if and only if B is true” Notice that A ↔ B only when A and B have the same truth value. A B A ↔ B T F Equivalence 2 simplified CS 214 - Chapter 1

English to Logic See Table 1.5 for correspondence between words in English and logical connectives. Work some examples on pages 4 & 5 CS 214 - Chapter 1

Well-formed Formulas (wff’s) The basic tokens in logical statements are the statement letters, connector symbols AND, OR, NEGATION, IMPLICATION, & parentheses Syntax is governed by precedence rules; from highest to lowest they are Negation AND and OR Implication Equivalence Parentheses can override the normal order, just as in programming languages. Syntactically correct statements are sometimes called well-formed formulas (wff) CS 214 - Chapter 1

Examples of wff’s A  B’ represents A  (B’), not (A  B)’ A  B → C means (A  B) → C Well formed formulas are represented by letters from the end of the alphabet: P, Q, R, … For example, A  B → C can be written as P → Q It is often easier to simplify around the main connector (the operator that is evaluated last, or that has the lowest precedence). CS 214 - Chapter 1

Tautologies & Contradictions A tautology is a statement that is always true, regardless of the truth values assigned to its variables Example: A  A’ A contradiction is a statement that is always false Example: A  A’ Contradictions are usually represented by 0 and tautologies by 1 CS 214 - Chapter 1

Truth Table for a Tautology CS 214 - Chapter 1

Tautological Equivalences Commutativity A  B  B  A A  B  B  A Associativity (A  B )  C  A  (B  C) (A  B )  C  A  (B  C) Distribution A  (B  C)  A  (B  C)  (A  B )  (A  C ) (A  B )  (A  C ) Identity A  0  A A  1  A Complement A  A’  1 A  A’  0 Equivalents: the left side may be substituted for the right, and vice versa Tautologies: the equivalences above are also tautologies; always true, regardless of the truth values assigned to A, B, C. (See Table 1.9 on page 9 for examples) Similar relations exist in mathematics (6 + 3 = 3 + 6, for example) For each pair of relations, the relation on the left is the dual of the relation on the right – and vice versa It’s useful to be familiar with equivalences because in constructing logical arguments (or even writing conditions in a computer program), one may be easier to understand than another. CS 214 - Chapter 1

DeMorgan’s Laws (A  B)’ A’  B’ (A  B)’ A’  B’ DeMorgan’s laws are helpful in forming the negation of compound statements. Example: suppose P is “ice cream is cold and sweet” Negation? “Ice cream is not cold and sweet” No; P should really be “ice cream is cold and ice cream is sweet”. The negation is “Ice cream is not cold OR ice cream is not sweet” Be careful to think in terms of complete statements – this is an example of fuzzy natural language meaning, a reason for using logical notation to avoid ambiguity. CS 214 - Chapter 1

Why Do We Care? Equivalences allow us to choose the easiest way to write a particular logical condition Logical connectives are useful in building precise descriptions of things – example: refining a web search e.g. recipe AND chicken AND easy (or “recipe + chicken + easy” ) CS 214 - Chapter 1

Algorithm An algorithm is a set of instructions that can be mechanically executed in a finite amount of time in order to solve some problem. Important features: Finiteness “Mechanical” : the steps are clearly described and can be executed by hand or on a computer Algorithms are often described in pseudocode See the example on page 12: an algorithm to determine if, given two wffs P and Q, is P → Q a tautology. CS 214 - Chapter 1

Preview of 1.2 – Propositional Logic In this section we’ll see how to use wffs to perform deductive reasoning. Propositional logic (also called propositional calculus or statement logic) is a formal system for reaching logical conclusions derived from a given set of statements, or facts. First homework will be assigned. CS 214 - Chapter 1