Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fall 2013 Foundations of Logic

Similar presentations


Presentation on theme: "Fall 2013 Foundations of Logic"— Presentation transcript:

0 Fall 2013 Propositional Logic Rosen 5th ed., §§

1 Fall 2013 Foundations of Logic Mathematical Logic is a tool for handling compound statements. It includes: A formal language for expressing them. A methodology for reasoning about their truth or falsity. (A “calculus”) The ultimate foundation for proofs throughout mathematics CS2013 Univ of Aberdeen

2 Two Logical Systems: Propositional logic Predicate logic (extends 1. )
Fall 2013 Two Logical Systems: Propositional logic Predicate logic (extends 1. ) Many other logical calculi exist, but they all resemble these two CS2013 Univ of Aberdeen

3 Propositional Logic (§1.1)
Fall 2013 Propositional Logic (§1.1) Propositional Logic is the logic of compound statements built from simpler statements using Boolean connectives. Some applications in computer science: Design of digital electronic circuits. Expressing conditions in programs. Queries to databases & search engines. George Boole ( ) Chrysippus of Soli (ca. 281 B.C. – 205 B.C.) CS2013 Univ of Aberdeen

4 Propositions in natural language
Fall 2013 Propositions in natural language In propositional logic, a proposition is simply: a statement (i.e., a declarative sentence) with some definite meaning having a truth value that’s either true (T) or false (F). Only values statements can have. Never both, or somewhere “in between”. However, you might not know the truth value CS2013 Univ of Aberdeen

5 Examples of NL Propositions
Fall 2013 Examples of NL Propositions “It is raining.” (In a given situation.) “Beijing is the capital of China, and = 2” The following are NOT propositions: “Who’s there?” (interrogative: no truth value) “x := x+1” (imperative: no truth value) “1 + 2” (term: no truth value) CS2013 Univ of Aberdeen

6 Propositions in Propositional Logic
Atoms: p, q, r, … (Corresponds with simple English sentences, e.g. ‘I had salad for lunch’) Complex propositions : built up from atoms using operators: pq (Corresponds with compound English sentences, e.g., “I had salad for lunch and I had steak for dinner.”) CS2013 Univ of Aberdeen

7 Defining Propositions
Logic defines notions of atomic and complex propositions and what complex propositions “mean” CS2013 Univ of Aberdeen

8 Connectives (also called operators)
Fall 2013 Connectives (also called operators) A connective combines with n arguments to form a larger expression. Unary connectives take 1 operand; Binary connectives take 2 operands. Later in the course, we will see that operators can themselves be defined in terms of functions. This slide doesn’t define them that way because we haven’t defined functions yet. But for your reference, when you come back to study this section after learning about functions, in general, an n-ary operator O on any set S (the domain of the operator) is a function O:S^n->S mapping n-tuples of members of S (the operands) to members of S. “S^n” here denotes S with n as a superscript, that is, the nth Cartesian power of S. All this will be defined later when we talk about set theory. For Boolean operators, the set we are dealing with is B={True,False}. A unary Boolean operator U is a function U:B->B, while a binary Boolean operator T is a function T:(B,B)->B. Binary operators are conventionally written in between their operands, while unary operators are usually written in front of their operands. (One exception is the post-increment and post-decrement operators in C/C++/Java, which are written after their operands.) CS2013 Univ of Aberdeen

9 Common Boolean Operators
Fall 2013 Common Boolean Operators Formal Name Nickname Arity Symbol Negation operator NOT Unary Conjunction operator AND Binary Disjunction operator OR Exclusive-OR operator XOR Implication operator IMPLIES Biconditional operator IFF CS2013 Univ of Aberdeen

10 The syntax of propositional logic
Atoms: p1, p2, p3, .. Formulas: All atoms are formulas For all  , if  is a formula then ¬  is a formula For all  and , if  and  are formulas then the following are formulas: (  ), (  ), (  ) (etc.) CS2013 Univ of Aberdeen

11 Which of these are formulas, according to this strict definition?
The language of propositional logic defined more properly (i.e., as a formal language) Which of these are formulas, according to this strict definition? p1  ¬ p2 (p1  ¬ p2) ¬ ¬ ¬(p9  p8) (p1 p2  p3) (p1 (p2  p3)) CS2013 Univ of Aberdeen

12 Which of these are formulas, according to this strict definition?
The language of propositional logic defined more properly (i.e., as a formal language) Which of these are formulas, according to this strict definition? p1  ¬ p2 No (p1  ¬ p2) Yes ¬ ¬ ¬(p9  p8) Yes (p1 p2  p3) No (p1 (p2  p3)) Yes CS2013 Univ of Aberdeen

13 Simplifying conventions
Convention 1: outermost brackets may be omitted,: p1  ¬ p2, ¬ ¬ ¬(p9  p8), p1 (p2  p3) Convention 2: associativity allows us to omit even more brackets, e.g.: p1 p2  p3, p1  p2  p3 CS2013 Univ of Aberdeen

14 Which of these are formulas, when using these two conventions?
The language of propositional logic defined more properly (i.e., as a formal language) Which of these are formulas, when using these two conventions? p1  ¬ p2 Yes (p1  ¬ p2) Yes ¬ ¬ ¬(p9  p8) Yes (p1 p2  p3) No (p1 (p2  p3)) Yes CS2013 Univ of Aberdeen

15 The semantics of Propositional Logic
CS2013 Univ of Aberdeen

16 Remember when reading definitions of connectives
Fall 2013 Remember when reading definitions of connectives Propositional Logic is a very simple formalism, because The meaning of a proposition can only be expressed in terms of the truth values True (also: T, 1) and False (also: F, 0). This may not always always allow you to say what you would want to say CS2013 Univ of Aberdeen

17 Fall 2013 The Negation Operator The unary negation operator “¬” (NOT) combines with one prop, transforming the prop into its negation. E.g. If p = “I have brown hair.” then ¬p = “I do not have brown hair.” The truth table for NOT: T :≡ True; F :≡ False “:≡” means “is defined as” Operand column Result column CS2013 Univ of Aberdeen

18 Truth-functionality The meaning of a connective is a function from (one or more) truth values to truth values Truth table expresses truth/falsity of ¬p in terms of truth/falsity of p This not possible for the operator ‘tomorrow’, or `probably’: ‘Tomorrow p’ is true iff p is ….’?? CS2013 Univ of Aberdeen

19 Truth-functionality Truth table expresses truth/falsity of ¬p in terms of truth/falsity of p. Each horizontal line of the table expresses some alternative context. Truth-functional operator: an operator that is a function from the truth values of the component expressions to a truth value. NOT is truth functional. Yesterday is not. Propositional logic is only about truth-functional operators. We can compute the values of the complex expressions. CS2013 Univ of Aberdeen

20 The Conjunction Operator
Fall 2013 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.” CS2013 Univ of Aberdeen

21 Conjunction Truth Table
Fall 2013 Conjunction Truth Table Operand columns Note that a conjunction p1  p2  …  pn of n propositions will have 2n rows in its truth table. Also: ¬ and  operations together can express any Boolean truth table! Note that AND is commutative and associative, which means that we can write a long conjunction (like in the first bullet on the left) without parenthesizing it. It also doesn’t matter what order the n propositions are in. The fact that an n-operand operator has 2^n rows in its truth table is an easy consequence of the product rule of combinatorics. Here is a proof. Note that for the table to be complete, we must have 1 row for every possible assignment of truth values to the n operands. Thus, there is 1 row for every function f:V->B, where V is the set of operand columns {p,q,…} and B={T,F}. Here, |V|=n and |B|=2. The number of functions from a set of size n to a set of size m is m^n. This is because of the product rule, as we will see in a moment. In this case, m=2 so we get 2^n such functions. In terms of the product rule: There are 2 possible values for p. For each of these, there are 2 possible values for q, since the choice of q is independent of the choice of p. And so on. So there are 2x2x…(n repetitions)…x2 possible rows, thus 2^n. Of course, we haven’t defined the product rule, set cardinality, or functions yet, so don’t worry if the above argument doesn’t quite make sense to you yet. In the second bullet, we would say, {NOT,AND} is a universal set of Boolean operators, but we haven’t even defined sets yet. If you already know what a set is, a universal set of operators over a given domain is a set of operators such that nested expressions involving those operators are sufficient to express any possible operator over that domain. In this case, the domain is B={T,F}. The proof that {NOT,AND} is universal is as follows: OR can be defined by p OR q = NOT(NOT(p) AND NOT(q)) (easily verified; this is one of DeMorgan’s Laws, which we will get to later). Now, armed with OR, AND, and NOT, we can show how to express any Boolean truth table, with any number of columns, as follows. Look for the cases where the last (result) column is T. For each such row in the truth table, include a corresponding term in a disjunctive expression for the whole truth table. The term should be a conjunction of terms, one for each input operand in that row. Each of these terms should be p if the entry in that position is “T”, and NOT(p) if the entry in that position is “F”. So, the entire expression basically says, “the value of the operator is T if and only if the pattern of truth values of the input operands exactly matches one of the rows in the truth table that ends in a ‘T’ result.” Thus, the expression directly encodes the content of the truth table. more later CS2013 Univ of Aberdeen

22 The Disjunction Operator
Fall 2013 The Disjunction Operator The binary disjunction operator “” (OR) combines two propositions to form their logical disjunction. p=“My car has a bad engine.” q=“My car has a bad carburator.” pq=“Either my car has a bad engine, or my car has a bad carburetor.” OR is also commutative and associative. The animated picture on the right is just a memory device to help you remember that the disjunction operator is symbolized with a downward-pointing wedge, like the blade of an axe, because it “splits” a proposition into two parts, such that you can take either part (or both), if you are trying to decide how to make the whole proposition true. Note that the meaning of disjunction is like the phrase “and/or” which is sometimes used in informal English. “The car has a bad engine and/or a bad carburetor.” CS2013 Univ of Aberdeen

23 Disjunction Truth Table
Fall 2013 Disjunction Truth Table 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. “¬” and “” together are also universal. Note difference from AND CS2013 Univ of Aberdeen

24 Nested Propositional Expressions
Fall 2013 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) (f  g)  s would mean something different f  g  s would be ambiguous By convention, “¬” takes precedence over both “” and “”. ¬s  f means (¬s)  f rather than ¬ (s  f) As an exercise, drop the truth tables for f /\ (g \/ s) and (f /\ g) \/ s to see that they’re different, and thus the parentheses are necessary. Precedence conventions such as the one in the second bullet help to reduce the number of parentheses needed in expressions. Note that negation, with its tight binding (high precedence), and with its position to the left of its operand, behaves similarly to a negative sign in arithmetic. There is also a precedence convention that you see sometimes (for example, in the C programming language) that AND takes precedence over OR. However, this convention is not quite universally accepted, not all systems adopt it. Therefore, to be safe, you should always include parentheses whenever you are mixing ANDs and ORs in a single sequence of binary operators. CS2013 Univ of Aberdeen

25 Logic as shorthand for NL
Fall 2013 Logic as shorthand for NL Let p=“It rained last night”, q=“The sprinklers came on last night,” r=“The lawn was wet this morning.” ¬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. For slides that have interactive exercises, it may be a good idea to stop the class for a minute to allow the students to discuss the problem with their neighbors, then call on someone to answer. This will help keep the students engaged in the lecture activity. Either the lawn wasn't wet this morning, or it rained last night, or the sprinklers came on last night. CS2013 Univ of Aberdeen

26 Some important ideas: Distinguishing between semantically different kinds of formulas Some formulas that look different may express the same information CS2013 Univ of Aberdeen

27 Fall 2013 Tautologies 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?] CS2013 Univ of Aberdeen

28 Tautologies When every row of the truth table gives T.
Example: p  p T T FT F T TF CS2013 Univ of Aberdeen

29 Fall 2013 Contradictions A contradiction is a compound proposition that is false no matter what! Ex. p  p [Truth table?] CS2013 Univ of Aberdeen

30 Contradictions When every row of the truth table gives F
Example: p  p T F FT F F TF CS2013 Univ of Aberdeen

31 Contingencies All other props. are contingencies:
Fall 2013 Contingencies All other props. are contingencies: Some rows give T, others give F Now: formulas that have the same meaning CS2013 Univ of Aberdeen

32 Propositional Equivalence
Fall 2013 Propositional Equivalence Two syntactically different propositions may be semantically identical (have the same meaning). We call them logically equivalent. Notation: …  … CS2013 Univ of Aberdeen

33 Fall 2013 Logical Equivalence Compound proposition p is logically equivalent to compound proposition q, written pq, IFF p and q contain the same truth values in all rows of their truth tables They express the same truth function (= the same function from values for atoms to values for the whole formula). CS2013 Univ of Aberdeen

34 Proving Equivalence via Truth Tables
Fall 2013 Proving Equivalence via Truth Tables Ex. Prove that pq  (p  q). F T T T F T T F F T T F T F T T F F F T Shows that OR is equivalent to a combination of NOT and AND. CS2013 Univ of Aberdeen

35 Before introducing more connectives
… let us step back and ask a few questions about truth tables CS2013 Univ of Aberdeen

36 Questions for you to think about
Fall 2013 Questions for you to think about What does each line of the table "mean"? Consider a conjunction p1  p2  p3 How many rows are there in its truth table? Consider a conjunction p1  p2  …  pn of n propositions. How many rows are there in its truth table? Explain why ¬ and  together are sufficient to express any Boolean truth table CS2013 Univ of Aberdeen

37 Questions for you to think about
Fall 2013 Questions for you to think about Consider a conjunction p1  p2  p3 How many rows are there in its truth table? 8 p1  p2  p Two truth values (0,1) and three propositions: 23 = 8. CS2013 Univ of Aberdeen

38 Questions for you to think about
Fall 2013 Questions for you to think about 2. Consider p1  p2  …  pn How many rows are there in its truth table? 2*2*2* … *2 (n factors) Hence 2n (This grows exponentially!) CS2013 Univ of Aberdeen

39 Questions for you to think about
Fall 2013 Questions for you to think about 3. Explain why ¬ and  together are sufficient to express any other complex expression in propositional logic. CS2013 Univ of Aberdeen

40 Questions for you to think about
Fall 2013 Questions for you to think about Explain why ¬ and  together are sufficient to express any other complex expression in propositional logic. Obviously, if we add new connectives (like ) we can write new formulas. CLAIM: these formulas would always be equivalent with ones that only use ¬ and  (This is what we need to prove). CS2013 Univ of Aberdeen

41 Fall 2013 Relating AND and OR Saying this in a different way: if we add new connectives, we can write new formulas, but these formulas will always only express truth functions that can already be expressed by formulas that only use ¬ and . That is, they will be equivalent. Example of writing a disjunction in another form (equivalence shown before): p  q  ¬(¬p  ¬q) CS2013 Univ of Aberdeen

42 Mystery Operator PQR Formula (containing P,Q,R) 1 1 1 0 1 1 0 1
Suppose, given the truth values of P, Q, and R, we construct a Formula with the given resulting truth value. This is our 'mystery' operator . Can it be written equivalently with NOT and AND? CS2013 Univ of Aberdeen

43 T-values in Conjunction
Fall 2013 T-values in Conjunction 3. Explain why ¬ and  together are sufficient to express any Boolean truth table Suppose precisely two rows give T. For example, the rows where P=T, Q=T, R=F. This is P  Q  ¬R P=T, Q=F, R=T. This is P  ¬Q  R CS2013 Univ of Aberdeen

44 Table as a disjunction of T-rows
Fall 2013 Table as a disjunction of T-rows Suppose precisely two rows give T. For example, the rows where P=T, Q=T, R=F. This is P  Q  ¬R P=T, Q=F, R=T. This is P  ¬Q  R We’ve proven our claim if we can express the disjunction of these two rows: (P  Q  ¬R)  (P  ¬Q  R) CS2013 Univ of Aberdeen

45 Disjoining rows of the table
Fall 2013 Disjoining rows of the table We’ve arrived if we can express their disjunction: (P  Q  ¬R)  (P  ¬Q  R) But we’ve seen that disjunction can be expressed using  and ¬: A  B  ¬(¬A  ¬B) So: (P  Q  ¬R)  (P  ¬Q  R)  ¬(¬ (P  Q  ¬R)  (P  ¬Q  R)) We’ve only used  and . CS2013 Univ of Aberdeen

46 Check (P  Q  ¬R)  (P  ¬Q  R)  ¬(¬ (P  Q  ¬R)  (P  ¬Q  R))
Fall 2013 Check (P  Q  ¬R)  (P  ¬Q  R)  ¬(¬ (P  Q  ¬R)  (P  ¬Q  R)) CS2013 Univ of Aberdeen

47 About this proof … We’ve made our task a bit easier, assuming that there were only 2 rows resulting in T But the case with 1 or 3 or 4 or …. rows is analogous (and there are always only finitely many rows.) So, the proof can be made precise CS2013 Univ of Aberdeen

48 Having proved this … We can express every possible truth-functional operator in propositional logic in terms of AND and NOT This is sometimes called functional completeness. Also universality. Reduce other operators to other more basic operators. CS2013 Univ of Aberdeen

49 Let’s introduce some additional connectives
A variant of disjunction The conditional The biconditional CS2013 Univ of Aberdeen

50 The Exclusive Or Operator
Fall 2013 The Exclusive Or Operator The binary exclusive-or operator “” (XOR) combines two propositions to form their logical “exclusive or”. p = “I will earn an A in this course,” q = “I will drop this course,” p  q = “I will either earn an A in this course, or I will drop it (but not both!)” CS2013 Univ of Aberdeen

51 Exclusive-Or Truth Table
Fall 2013 Exclusive-Or Truth Table 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. “¬” and “” together are not universal. A good way to remember the symbol for XOR, a plus sign inside an O, is to think of XOR as adding the bit-values of its inputs (mod 2). E.g., 0+0=0, 1+0=0, 1+1=0 (mod 2). Thus XOR is basically an addition, and we put it inside an “O” to remind ourselves that it is a type of “Or”. XOR together with unary operators do not form a universal set of operators over the Booleans. However, it turns out that they are a universal set for quantum logic! However we do not have time to cover quantum computing in this class, interesting though it is. Note difference from OR. CS2013 Univ of Aberdeen

52 Natural Language is Ambiguous
Fall 2013 Natural Language is Ambiguous Note that English “or” can be ambiguous regarding the “both” case! Need context to disambiguate the meaning! For this class, assume “or” means inclusive. CS2013 Univ of Aberdeen

53 Test your understanding of the two types of disjunction
Suppose p  q is true. Does it follow that pq is true? Suppose pq is true. Does it follow that p  q is true? CS2013 Univ of Aberdeen

54 Test your understanding of the two types of disjunction
Suppose p  q is true. Does it follow that pq is true? No: consider p TRUE, q TRUE Suppose pq is true. Does it follow that p  q is true? Yes. Check each of the two assignments that make pq true: a) p TRUE, q FALSE (makes p  q true) b) p FALSE, q TRUE (makes p  q true) CS2013 Univ of Aberdeen

55 The Implication Operator
Fall 2013 The Implication Operator antecedent consequent The implication p  q states that p implies q. I.e., If p is true, then q is true; but if p is not true, then q could be either true or false. E.g., let p = “You study hard.” q = “You will get a good grade.” p  q = “If you study hard, then you will get a good grade.” Note that the definition of “p implies q” says: “If p is true, then q is true, and if p is not true, then q is either true or false.” Well, saying that q is either true or false is not saying anything, since any proposition is, by the very definition of a proposition, either true or false. So, the last part of that sentence (covering the case where p is not true) is not really saying anything. So we may as well say the definition is, “If p is true, then q is true.” Sometimes the antecedent is called the hypothesis and the consequent is called the conclusion. CS2013 Univ of Aberdeen

56 Implication Truth Table
Fall 2013 Implication Truth Table p  q is false only when (p is true but q is not true) p  q does not say that p causes q! p  q does not require that p or q are true! E.g. “(1=0)  pigs can fly” is TRUE! The only False case! Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) CS2013 Univ of Aberdeen

57 Implication Truth Table
Fall 2013 Implication Truth Table Suppose you know that q is T. What do you know about pq ? Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) CS2013 Univ of Aberdeen

58 Implication Truth Table
Fall 2013 Implication Truth Table Suppose you know that q is T. What do you know about pq ? The conditional must be T Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) CS2013 Univ of Aberdeen

59 Implication Truth Table
Fall 2013 Implication Truth Table Suppose you know that p is F. What do you know about pq ? The conditional must be T Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) CS2013 Univ of Aberdeen

60 Implication Truth Table
Fall 2013 Implication Truth Table Suppose you know that p is T. What do you know about pq ? T or F. What do you know about q? T or F. Let’s consider the rows of the truth table, one at a time. In the first row, p is false and q is false. Now, let’s consider the definition of p->q. It says “If p is true, then q is true, but if p is false, then q is either true or false.” Well, in this case, p is false, and q is either true or false (namely false), so the second part of the statement is true. But, of course that part is true, since it is just a tautology that q is either true or false. In other words, and if is always true when its antecedent is false. Similarly, the second row is True. The third row is false, since p is true but q is false, so it is not the case that if p is true then q is true. Finally, in the fourth row, since p is true and q is true, it is the case that if q is true then q is true. Many students have trouble with the implication operator. When we say, “A implies B”, it is just a shorthand for “either not A, or B”. In other words, it is just the statement that it is NOT the case that A is true and B is false. This often seems wrong to students, because when we say “A implies B” in everyday English, we mean that if somehow A were to become true in some way, somehow, the statement B would automatically be thereby made true, as a result. This does not seem to be the case in general when A and B are just two random false statements (such as the example in the last bullet). (However in this case, we might make a convoluted argument that the antecedent really DOES effectively imply the consequent: Note that if 1=0, then if a given pig flies 0 times in his life, then he also flies 1 time, thus he can fly.) In any case, perhaps a more accurate and satisfying English rendering of the true meaning of the logical claim “A implies B”, might be just, “the possibility that A implies B is not contradicted directly by the truth values of A and B”. In other words, “it is not the case that A is true and B is false.” (Since that combination of truth values would directly contradict the hypothesis that A implies B.) CS2013 Univ of Aberdeen

61 Implications between real sentencs
Fall 2013 Implications between real sentencs “If this lecture ever ends, then the sun has risen this morning.” True or False? “If Tuesday is a day of the week, then I am a penguin.” True or False? “If 1+1=6, then Bush is president.” True or False? “If the moon is made of green cheese, then 1+1=7.” True or False? The first one is true because T->T is True. It doesn’t matter that my lecture ending is not the cause of the sun rising tomorrow. The second one is false for me, because although Tuesday is a day of the week, I am most certainly NOT a penguin. (But, if a penguin were to say this statement, then it would be true for him.) The third one is true, because 1+1 is not equal to 6. F->T is True. The last one is true, because the moon is not made of green cheese. F->F is True. In other words, anything that’s false implies anything at all. p->q if p is false. Why? If p is false, then if p is true, then p is both false and true at the same time, and so truth and falsity are the same thing. So if q is false then q is true. CS2013 Univ of Aberdeen

62 Why does this seem wrong?
Fall 2013 Why does this seem wrong? Recall “If [you study hard] then [you’ll get a good grade]” In normal English, this asserts a causal connection between the two propositions. The connective  does not capture this connection. CS2013 Univ of Aberdeen

63 Biconditional Truth Table
Fall 2013 Biconditional Truth Table p  q means that p and q have the same truth value. Note this truth table is the exact opposite of ’s! Thus, p  q means ¬(p  q) p  q does not imply that p and q are true, or that either of them causes the other. Also, p IFF q is equivalent to (p -> q) /\ (q -> p). (“/\” being the AND wedge) CS2013 Univ of Aberdeen

64 Consider ... The truth of p  q, where
p= Scotland is in the UK q= 2+2 =4 p= Scotland is not in the UK q= 2+2 =5 p= Scotland is in the UK q= Wales is not in the UK CS2013 Univ of Aberdeen

65 Consider ... The truth of p  q, where
p= Scotland is in the UK q= 2+2 = TRUE p= Scotland is not in the UK q= 2+2 = TRUE p= Scotland is in the UK q= Wales is not in the UK FALSE CS2013 Univ of Aberdeen

66 Contrapositive Some terminology, for an implication p  q:
Fall 2013 Contrapositive Some terminology, for an implication p  q: Its converse is: q  p. Its contrapositive: ¬q  ¬ p. Which of these two has/have the same meaning (express same truth function) as p  q? Prove it. Also, note that the converse and inverse of p->q also have the same meaning as each other. CS2013 Univ of Aberdeen

67 Fall 2013 Contrapositive Proving the equivalence of p  q and its contrapositive, using truth tables: CS2013 Univ of Aberdeen

68 For you to think about: Can you think of yet another 2-place connective? How many possible connectives do there exist? CS2013 Univ of Aberdeen

69 For you to think about: How many possible connectives do there exist?
p connective q T ? T T ? F F ? T F ? F Each question mark can be T or F, hence 2*2*2*2=16 connectives CS2013 Univ of Aberdeen

70 Example of another connective
p connective q compare: p and q T F T T T T F F F T T F F T F F Names: NAND, Sheffer stroke CS2013 Univ of Aberdeen

71 Some Alternative Notations
Fall 2013 Some Alternative Notations CS2013 Univ of Aberdeen

72 Tautologies revisited
We’ve introduced the notion of a tautology using the example p  p Now, you know more operators, so can formulate many more tautologies, e.g., the following are tautologies: (pq)  (p  q) (pq)  (¬q  ¬ p), and so on CS2013 Univ of Aberdeen

73 Equivalence Laws Similar to arithmetic identities in algebra
Fall 2013 Equivalence Laws Similar to arithmetic identities in algebra Patterns that can be used to match (part of) another proposition Abbreviation: T stands for an arbitrary tautology; F an arbitrary contradiction CS2013 Univ of Aberdeen

74 Equivalence Laws - Examples
Fall 2013 Equivalence Laws - Examples Identity: pT  p pF  p Domination: pT  T pF  F Idempotence: pp  p pp  p Double negation: p  p Commutativity: pq  qp pq  qp Associativity: (pq)r  p(qr) (pq)r  p(qr) CS2013 Univ of Aberdeen

75 Fall 2013 More Equivalence Laws 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  q Trivial tautology/contradiction: p  p  T p  p  F Augustus De Morgan ( ) CS2013 Univ of Aberdeen

76 Defining Operators via Equivalences
Fall 2013 Defining Operators via Equivalences Some equivalences can be thought of as definitions of one operator in terms of others: Exclusive or: pq  (pq)(pq) pq  (pq)(qp) Implies: pq  p  q Biconditional: pq  (pq)  (qp) pq  (pq) CS2013 Univ of Aberdeen

77 How you may use equivalence laws: Example (1)
Fall 2013 How you may use equivalence laws: Example (1) Use equivalences to prove that (r  s)  s  r. CS2013 Univ of Aberdeen

78 How you may use equivalence laws: Example (1)
Fall 2013 How you may use equivalence laws: Example (1) (r  s)  (De Morgan) r  s  (Commutativity) s r  (2x Double Negation) s  r. CS2013 Univ of Aberdeen

79 Summary In practice, Propositional Logic equivalences are seldom strung together into long proofs: using truth tables is usually easier. CS2013 Univ of Aberdeen


Download ppt "Fall 2013 Foundations of Logic"

Similar presentations


Ads by Google