Proositional Logic Andrew Simson Revised by David Lightfoot Agenda Atomic roositions Logical oerators Truth tables Precedence Tautologies, contradictions and contingencies Euational reasoning 1 2 References Atomic roositions Discrete Mathematics by Examle, Andrew Simson, McGraw Hill, 2002 Formal Secification Using Z, David Lightfoot, Palgrave, 2000 Using Z: Secification, Refinement, Proof, Jim Woodcock and Jim Davies, Prentice Hall, 1996 htt://www.usingz.com/ Often in life we encounter statements which may either be or In discrete mathematics, we refer to such statements as roositions The truth value associated with a roosition may always be or, or it may change according to circumstances Proositions whose truth or falsity may be determined without recourse to other information are referred to as atomic roositions 3 4 Examles of atomic roositions Truth values Tuesday is the day before Wednesday Today is Tuesday Rick is a vegetarian It is raining Becky likes biscuits There is nothing on the television George Boole, hence Boolean algebra Every atomic roosition may be associated with a truth value In our treatment of roositional logic, there are two ossible truth values which may be associated with a roosition: and For examle, the statement Wednesday is the day after Tuesday has the associated truth value, whereas Aril is the month immediately before June is 5 6
Combining roositions Determine whether each of the following statements is or : 0 < 1 1 + 1 = 2 1 * 1 = 2 Atomic roositions, together with the truth values and are the building blocks of roositional logic Just as numbers can be combined via addition or multilication, so roositions can be combined via a variety of roositional oerators ( logical oerators ) 7 8 Negation Examles of negation Given any roosition, we may talk about its negation, denoted (ronounced not ) Here, is also a roosition If the truth value associated with is then the truth value associated with its negation,, is If the truth value associated with is then the truth value associated with its negation,, is (Avoid calling negation oosite ) Given the roosition t, which reresents the statement Today is Tuesday, the roosition t is euivalent to the statement Today is not Tuesday Given the roosition r, which reresents the statement Rick is a vegetarian, the roosition r is euivalent to the statement Rick is not a vegetarian 9 10 Truth tables State the negation of each of the following roositions: It is snowing Jon likes Ali x is greater than y Truth tables rovide us with a means of reresenting the truth or falsity of logical statements The values of all atomic roositions contained in the roosition are enumerated and the truth value of the overall roosition can thus be calculated 11 12
Truth table for negation Conjunction The conjunction ( and ) oerator works by taking two roositions and returning if both roositions are and returning otherwise Given two roositions and, the conjunction of and (or conjoined with ) is written (and ronounced and ) ( looks like A in And ) 13 14 Examle of conjunction The conjunction of Rick is a vegetarian, which is denoted by r, and Rick eats chocolate, denoted by c, is written r c Calculate the truth values of the following roositions: (1 < 0) (2 < 1) (0 < 1) (2 < 1) (0 < 1) (1 < 2) 15 16 Truth table for conjunction Disjunction The disjunction ( or ) oerator works by taking two roositions, and returning if at least one of them is euivalent to,and returning otherwise Given two roositions and, the disjunction of and ( disjoined with ) is written (and ronounced or ) ( does not look like A in And ) 17 18
Examle The disjunction of Rick is a vegetarian, which is denoted by r, and Rick likes chocolate, denoted by c, is written r c Calculate the truth values of the following roositions: (1 < 0) (2 < 1) (0 < 1) (2 < 1) (0 < 1) (1 < 2) (x 2) (x 6) 19 20 Truth table for disjunction Imlication Imlication is the third logical oerator, and, for most eole the least intuitive and most difficult to understand The imlication oerator is written and the roosition is ronounced imlies 21 22 Motivation The statement if it rains this afternoon, then Duncan will stay in may be reresented as r s If we think of this statement as if it were a contract, there is only one circumstance under which the contract has been broken: if it did rain this afternoon and Duncan failed to stay in If it did rain and Duncan stayed in, then the contract was not broken Furthermore, if it failed to rain, then it should not worry us too much what Duncan did with his afternoon, as this is outside the boundaries of the contract As such, r s should only logically be euivalent to (that is, the contract is only broken) if r is and s is Determine the truth or falsity of the following statements: If Marilyn Monroe was a man then elehants can fly If 1 + 1 = 2 then Madrid is the caital of Sain If Marilyn Monroe was a man then 1 + 1 = 2 If Madrid is the caital of Sain then elehants can fly 23 24
Truth table for imlication Euivalence The euivalence oerator works by taking two roositions and returning if the truth values of the two roositions are the same and returning otherwise Give two roositions and, if and only if is written 25 26 Truth table for euivalence Determine the truth or falsity of the following statements: Marilyn Monroe was a man if, and only if, elehants can fly 1 + 1 = 2 if, and only if, Madrid is the caital of Sain Marilyn Monroe was a man if, and only if, 1 + 1 = 2 Madrid is the caital of Sain if, and only if, elehants can fly 27 28 Logical euivalences Some imortant laws 1 The notion of euivalence allows us to identify a number of laws of roositional logic Tyically, these laws state that one roosition is logically euivalent to another Such laws allow us to relace one roosition by a logically euivalent one in any roosition For any roositions and : Commutativity Idemotence Associativity ( r) ( ) r ( r) ( ) r De Morgan s laws ( ) ( ) ( ) ( ) ( ) ( ) Excluded middle Distributativity ( r) ( ) ( r) ( r) ( ) ( r) 29 30
Some imortant laws 2 Precedence For any roositions and : ( ) ( ) elimination of imlication ( ) ( ) and ( ) As we have seen, arentheses ( ) can be used to remove ambiguity from the meaning of a roosition: for examle ( ) has a very different meaning from ( ) Sometimes, esecially if we are dealing with a long roosition, using arentheses in this way can be rather cumbersome T overcome these roblems, we assign an order of recedence to our oerators: has highest riority (and therefore binds tightest), followed by, then, then, then, which has lowest riority and so binds loosest Thus if we were to write, this would have the same meaning as ( ) Furthermore, r means ( ) r, NOT ( r ) 31 32 Tautology Write the fully arenthesised version of each of the following roositions: r r r s A roosition that is always is called tautology Examles: ( ) ( ) ( ) ( ) 33 34 Contradictions and contingencies Establishing tautologies A roosition that is always is called contradiction If a roosition is neither a tautology nor a contradiction then it is called a contingency An easy way to determine whether or not a roosition is a tautology is to substitute truth values for the atomic roositions. For examle, given the roosition, if we substitute for, then the overall roosition is euivalent to and if we substitute for then the overall roosition is euivalent to Therefore we conclude that is a tautology On the other hand, if the atomic roosition takes that value in the roosition ( ), the value of is immaterial: under such circumstances, this roosition is euivalent to 35 36
Drawbacks Which of the following roositions are tautologies? ( ) ( ) ( ) ( ) ( ) ( ) Unfortunately, this method only works for relatively simle roositions More general ways of establishing whether or not a roosition is a tautology are via truth tables, via deduction, or via euational reasoning 37 38 Using truth tables Exercise ( ) Give the truth table for ( ) ( ) 39 40 Solution Drawbacks of truth tables ( ) ( ) The size of a truth table for a roosition is related to the number of atomic roositions contained in that roosition A realistic uer limit for constructing truth tables by hand is three atomic roosition We need a more general techniue 41 42
Euational reasoning Examles of euational reasoning We may determine the truth or falsity of roositions by substituting one logically euivalent roosition for another When conduction this rocess we must, at each stage, aly one of the laws of roositional logic If we are strict about alying them, we have a formal rocess, called euational reasoning At each stage we substitute a logically euivalent roosition for the former roosition; this substitution is justified by the alication of one of the laws of roositional logic ( ) ( ) by elimination of imlication ( ) by de Morgan s law by associativity of disjunction by idemotency of disjunction 43 44 Summary Atomic roositions Logical values:, Logical oerators:,,,, Truth tables Precedence Tautologies, contradictions and contingencies Euational reasoning 45