CISC 1400: Logic Fall 2011, X. Zhang, Fordham Univ. 1.

Slides:



Advertisements
Similar presentations
TRUTH TABLES Section 1.3.
Advertisements

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
Grading Lecture attendance: -1% per 2 unexcused absences
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.
The basics of propositional 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.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Boolean Algebra Computer Science AND (today is Monday) AND (it is raining) (today is Monday) AND (it is not raining) (today is Friday) AND (it is.
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.
Propositional Logic Lecture 2: Sep 9. Conditional Statement If p then q p is called the hypothesis; q is called the conclusion “If your GPA is 4.0, then.
Copyright © Cengage Learning. All rights reserved.
TRUTH TABLES. Introduction Statements have truth values They are either true or false but not both Statements may be simple or compound Compound statements.
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
Propositional Logic.
CISC 1100: Logic Fall 2014, X. Zhang, Fordham Univ. 1.
Intro to Discrete Structures
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.
The Foundations: Logic and Proofs
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.
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.
© Jalal Kawash 2010 Logic Peeking into Computer Science.
BY: MISS FARAH ADIBAH ADNAN IMK. CHAPTER OUTLINE: PART III 1.3 ELEMENTARY LOGIC INTRODUCTION PROPOSITION COMPOUND STATEMENTS LOGICAL.
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
(CSC 102) Lecture 3 Discrete Structures. Previous Lecture Summary Logical Equivalences. De Morgan’s laws. Tautologies and Contradictions. Laws of Logic.
Logical Form and Logical Equivalence Lecture 2 Section 1.1 Fri, Jan 19, 2007.
CSNB143 – Discrete Structure LOGIC. Learning Outcomes Student should be able to know what is it means by statement. Students should be able to identify.
Boolean Algebra. Logical Statements A proposition that may or may not be true:  Today is Monday  Today is Sunday  It is raining.
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
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
1 Introduction to Abstract Mathematics Expressions (Propositional formulas or forms) Instructor: Hayk Melikya
Lecture 9 Conditional Statements CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
How do I show that two compound propositions are logically equivalent?
Chapter 7 Logic, Sets, and Counting Section 1 Logic.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
LOGIC.
Logical Form and Logical Equivalence Lecture 1 Section 1.1 Wed, Jan 12, 2005.
Boolean Algebra Monday/Wednesday 7th Week. Logical Statements Today is Friday AND it is sunny. Today is Friday AND it is rainy. Today is Monday OR it.
1 Propositional Logic Introduction. 2 What is propositional logic? Propositional Logic is concerned with propositions and their interrelationships. 
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.
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
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,
Outline Logic Propositional Logic Well formed formula Truth table
رياضيات متقطعة لعلوم الحاسب 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.
TRUTH TABLES Edited from the original by: Mimi Opkins CECS 100 Fall 2011 Thanks for the ppt.
3/6/20161 Let’s get started with... Logic !. 3/6/20162 Logic Crucial for mathematical reasoningCrucial for mathematical reasoning Used for designing electronic.
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.
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.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
Logic.
(CSC 102) Discrete Structures Lecture 2.
Logic X. Zhang, Fordham Univ. 1.
Principles of Computing – UFCFA3-30-1
Information Technology Department
CS201: Data Structures and Discrete Mathematics I
CSRU 1400 Discrete Structure: Logic
Discrete Structures Prepositional Logic 2
CS201: Data Structures and Discrete Mathematics I
Presentation transcript:

CISC 1400: Logic Fall 2011, X. Zhang, Fordham Univ. 1

Motivating example 2 Four machines A, B, C, D are connected on a network. It is feared that a computer virus may have infected the network. Your security team makes the following statements: – If D is infected, then so is C. – If C is infected, then so is A. – If D is clean, then B is clean but C is infected. – If A is infected, then either B is infected or C is clean. Based on these statements, what can you conclude about status of the four machines?

Smullyan’s Island Puzzle  You meet two inhabitants of Smullyan’s Island (where each one is either a liar or a truth-teller).  A says, “Either B is lying or I am”  B says, “A is lying”  Who is telling the truth ? 3

Symbolic logic 4  Subjects: statements that is either true or false, i.e., propositions  Understand relations between statements  Equivalent statement: can we simplify and therefore understand a statement better ?  Contradictory statements: can both statements be true ?  Reasoning: does a statement follow from a set of hypothesis ?  Application: solve logic puzzle, decide validity of reasoning/proof …

Roadmap 5  Simple Proposition  Logic operations & compound proposition  Unary operation: negation  Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( )  Evaluating order & truth table  Tautology, contradiction, equivalence  Logic operation laws  Applications: solving logic puzzles

Proposition 6  Proposition: a statement which is either true or false  For example:  Ten is less than seven.  There are life forms on other planets in the universe.  A set of cardinality n has 2 n subsets.  The followings are not propositions:  How are you ?  x+y<10

Proposition 7  If a proposition is true, we say it has a truth value of true; otherwise, we say it has a truth value of false.  a lower case letter is used to represent a proposition  Let p stands for “Ten is smaller than seven”  p has truth value of false, i.e., F.  Analogy to numerical algebra  Variables represented by letters  Possible values for variables are {T, F}

Compound Proposition 8  One can connect propositions using “and”, “or”, “not”, “only if” …to form compound proposition:  It will not rain tomorrow.  Fishes are jumping and the cotton is high.  If the ground is wet then it rains last night.  Truth value of compound proposition depends on truth value of the simple propositions  We will formalize above connectives as operations on propositions

Outline 9  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Tautology, contradiction, equivalent  Logic operation laws  Applications: solving logic puzzles

Negation 10  It will not rain tomorrow.  It’s not the true that it will rain tomorrow.  It’s false that it will rain tomorrow.  Negation ( ) applies to a single proposition  If p is true, then is false  If p is false, then is true  We can use a table to summarize : p p TF FT All possible values of the input, output/function values

Truth table 11  Truth table: a table that defines a logic operation or function, i.e., allow one to look up the function’s value under given input values p TF FT All possible values of the input, output/function values

Conjunction Connective (AND, ) 12  To say two propositions are both true:  Peter is tall and thin.  The hero is American and the movie is good.  The whole statement is true if both simple propositions are true; otherwise it’s false.  We use (read as “and”) to denote such connective: th TTT TFF FTF FFF

Recognizing conjunction connectives 13  English words connecting the propositions might be “but”, “nevertheless”, “unfortunately”, …. For example:  Although the villain is French, the movie is good.  The hero is not American, but the villain is French.  As long as it means that both simple propositions are true, it’s an AND operation.

Practice  Introduce letters to stand for simple propositions, and write the following statements as compound propositions:  It’s sunny and cold.  The movie is not long, but it’s very interesting.

Different meaning of “OR” 15  “… or …, but not both”.  You may have coffee or you may have tea.  Mike is at the tennis court or at the swimming pool.  “… or …, or both”.  The processor is fast or the printer is slow.  To avoid confusion:  By default we assume the second meaning, unless it explicitly states “not both”.

Exclusive Or  Exclusive or ( ) : exactly one of the two statements is true, cannot both be true  I will watch movies or read a book tonight, but not both.  You may have coffee or you may have tea, but not both.  Mike is at the tennis court or at the swimming pool. 16 cd TTF TFT FTT FFF

Inclusive Or 17  Inclusive or ( ) : at least one of the two statements is true (can be both true)  The processor is small or the memory is small.  “The process is small” (p) or “The memory is small” (m), denoted as  Truth table for inclusive or: pm TTT TFT FTT FFF

Outline 18  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Logic equivalence  Logic operation laws  Applications: solving logic puzzles

Logic Connection: implication/ conditional 19  Some compound propositions states logical connection between two simple propositions (rather than their actual truthfulness)  If it rains, then the ground is wet.  Logic implication statement has two parts:  If part: hypothesis  Then part: conclusion  If the hypothesis is true, then the conclusion is true.  use to connect hypothesis and conclusion  logic implication is called conditional in textbook

Truth table for logic implication 20  “If I am elected, then I will lower the taxes next year”.  e: I am elected.  l: I lower the taxes next year.  i.e., if e is true, then l must be true.  We use to denote this compound statement. el TTT TFF FTT FFT

Understand logic implication 21  Under what conditions, the promise is broken, i.e., the statement is false ?  When I am elected, but I do not lower the taxes next year.  For all other scenarios, I keep my promise, i.e., the statement is true.  I am elected, and lower the taxes next year  I am not elected, I lower the taxes next year.  I am not elected, I do not lower the taxes next year. el TTT TFF FTT FFT

Many different English Expressions 22 In spoken language, there are many ways to express implication (if … then…) It rains, therefore the ground is wet.  Wet ground follows rain.  As long as it rains, the ground is wet.  Rain is a sufficient condition for the ground to be wet.  When translating English to proposition forms  Rephrase sentence to “if …. Then…” without change its meaning

Example: from English to Proposition form 23  Write the following in proposition form:  A British heroine is a necessary condition for the movie to be good.  b: “The heroine is a British”.  m: “The movie is good”  The heroine needs/has to be a British for the movie to be true.  If the movie is good, then the heroine is a British.  So the propositional form is

Write following in propositional forms: 24  If the movie is good, only if the hero is American.  A good diet is a necessary condition for a healthy cat.  A failed central switch is a sufficient condition for a total network failure.

Some exercises 25  Purchasing a lottery ticket is a ______ condition for winning the lottery.  Winning the lottery is a ______ condition for purchasing a lottery ticket.  You have to take the final exam in order to pass the CISC1100 course.  Taking the final exam is a ______ condition of passing CISC1100.  Passing CISC1100 is a _______ condition of taking the final exam.

Outline 26  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Tautology, contradiction, equivalent  Logic operation laws  Applications: solving logic puzzles

Complicated propositions 27  Connectives can be applied to compound propositions, e.g.:  The order of evaluation (book P. 43) pq TTTF TFFT FTFT FFFT

Writing truth table : 28  First fill in all possible input values  For 2 variables, p, q, there are 4 possible input values:  Next, create a column for each compound propositions,  Third, fill in the columns one by one, starting from simple ones pq TT TF FT FF

Input values 29  For a propositions with n variables  There are 2 n possible input value combinations, i.e., 2 n rows for the truth table  Use the following pattern to enumerate all input value combinations  The last variable follows TFTF… pattern (1)  The second last variable: TTFFTTFF… pattern (2)  The third last: TTTTFFFFTTTTFFFF... (4)  The fourth last: TTTTTTTTFFFFFFFF … (8) ……

An example 30  For a form with 3 simple propositions pqr TTTFTF TTFFFF TFTFFF TFFFFF FTTTTT FTFTFF FFTTFF FFFTFF

Practice  Introduce letters to stand for simple propositions, and write the following statements as compound propositions:  The food is good or the service is excellent.  Neither the food is good nor the service is excellent.  He is good at math, or his girl friend is and helps him.

Sufficient and necessary condition 32  Examples:  Lighting is sufficient and necessary condition for thunder.  The knight will win if and only if the armor is strong.  The knight will win if the armor is strong.  The knight will win only if the armor is strong.

Biconditional connective 33  p if and only if q,  p is sufficient and necessary condition of q pq TTTTT TFFTF FTTFF FFTTT

Precedence Rules 34  Parenthesized subexpressions come first  Precedence hierarchy  Negation ( ˥ ) comes next  Multiplicative operations ( ∧ ) is done before additive operations ( ⋁, ⊕ )  Conditional-type operations ( ) are done last  In case of a tie, operations are evaluated in left-to-right order, except for conditional operator ( ) which is evaluated in right-to-left order  is evaluated as

Outline 35  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Propositional equivalence  Propositional identities  Applications: solving logic puzzles

Logical equivalence Two propositional forms are logically equivalent, ifthey have same truth value under all conditions Analogous to algebra rules  We represent logical equivalence using  To prove or disprove logical equivalency  Draw and Compare true tables of the two forms 36

Outline 37  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Propositional equivalence ◦ Logic operation laws (propositional identities)  Applications: solving logic puzzles

Logic Identities (1) 38  Commutative  1.  2.  Associative  1.  2.

Logic Identities (2) 39 DeMorgan’s laws – 1. – 2.

Logic Identities (3) 40  Distributive  1.  2.

Logic Identities (4) 41  Double negative  Contrapositive

Simplify propositional forms 42  Simplify the following propositional forms, i.e., find a simpler equivalent form  Human beings understand the simplified form much better…  Put negation closer to the simple proposition  Get rid of double negation  Key: apply logical equivalence rules such as DeMorgan Law, implication law, double negation …

Simplify propositional forms (2) 43  Key: apply logical equivalence rules such as DeMorgan Law, implication law, double negation …  We don’t know how to directly negate a “if … then” form  First apply implication law, then use DeMorgan law:

Outline  Simple Proposition  Logic operations & compound proposition ◦ Unary operation: negation ◦ Binary operation: conjuction (AND), disjuction (OR), conditional ( ), biconditional ( ) ◦ Evaluating order & truth table  Propositional equivalence  Propositional identities  Applications: solving logic puzzles 44

Solving problem using logic 45 Four machines A, B, C, D are connected on a network. It is feared that a computer virus may have infected the network. Your security team makes the following statements: – If D is infected, then so is C. – If C is infected, then so is A. – If D is clean, then B is clean but C is infected. – If A is infected, then either B is infected or C is clean.

Solving problem using logic 46 Four machines A, B, C, D are connected on a network. It is feared that a computer virus may have infected the network. Your security team makes the following statements: – If D is infected, then so is C. – If C is infected, then so is A. – If D is clean, then B is clean but C is infected. – If A is infected, then either B is infected or C is clean. How many possibilities are there ? 1. A, B,C, D are all be clean 2. A, B,C are clean, D is infected, 3. A,B,D are clean, C is infected, 4. …. … Is the first case possible ? The second ? …

Smullyan’s Island Puzzle 47  You meet three inhabitants of Smullyan’s Island (where each one is either a liar or a truth-teller).  A says, “Exactly one of us is telling the truth”.  B says, “We are all lying.”  C says, “The other two are lying.”  Now who is a liar and who is a truth-teller ?

How to solve such puzzle ? 48  The key: each inhabitant is either a liar or a truth-teller. A liar always lies; a truth-teller always tells the truth.  How many possibilities are there ? 1. A,B,C are all truth-tellers 2. A,B are truth-tellers, C is a liar 3. … …  Is case 1 possible ? Case 2 ?

Express statements as propositional forms 49  A says: Exactly one of us is telling the truth  B says: we are all lying.  C says: the other two are lying.

Examine all possibilities 50 abcA’s statementB’s statementC’s statement TTTFFF TTFFFF TFTFFF TFFTFF FTTFFF FTFTFF FFTTFT FFFFTT All of us are lying Exactly one of us is telling the truth other two are lying. Which scenarios, if any, are consistent, i.e., truth-tellers told the truth, and liars lied ? * A is truth-teller, B and C are liars.

Smullyan’s Island Puzzle 51  You meet two inhabitants of Smullyan’s Island (where each one is either a liar or a truth-teller).  A says, “Either B is lying or I am”  B says, “A is lying”  Who is telling the truth ?

Next: application to computer 52