Fall 2013 Foundations of Logic

Slides:



Advertisements
Similar presentations
Exercises for CS1512 Weeks 7 and 8 Propositional Logic 1 (questions + solutions)
Advertisements

CSE 311: Foundations of Computing Fall 2013 Lecture 3: Logic and Boolean algebra.
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.
Foundations of Logic Mathematical Logic is a tool for working with elaborate compound statements. It includes: A formal language for expressing them.
Syllabus Every Week: 2 Hourly Exams +Final - as noted on Syllabus
Introduction to Logic Sections 1.1 and 1.2 of Rosen Spring 2010
From Chapter 4 Formal Specification using Z David Lightfoot
Discrete Mathematics Math 6A Instructor: M. Welling.
Introduction to Logic Sections 1.1 and 1.2 of Rosen Fall 2010 CSCE 235 Introduction to Discrete Structures URL: cse.unl.edu/~cse235 Questions:
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Chapter 2: The Logic of Compound Statements 2.1 Logical Forms and Equivalence 12.1 Logical Forms and Equivalences Logic is a science of the necessary laws.
Propositional Logic Review
The Foundations: Logic and Proofs
Intro to Discrete Structures
The Foundations: Logic and Proofs
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
Week 1 - Wednesday.  Course overview  Propositional logic  Truth tables  AND, OR, NOT  Logical equivalence.
Discrete Mathematics and Its Applications
CompSci 102 Discrete Math for Computer Science January 17, 2012 Prof. Rodger.
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.
© by Kenneth H. Rosen, Discrete Mathematics & its Applications, Sixth Edition, Mc Graw-Hill, 2007 Ch.1 (Part 1): The Foundations: Logic and Proofs Introduction.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
1 Propositional Logic Rosen 5 th ed., § Foundations of Logic: Overview Propositional logic:Propositional logic: –Basic definitions. –Equivalence.
Propositional Logic Foundations of Logic: Overview Propositional logic (§ ): – Basic definitions. (§1.1) – Equivalence rules & derivations. (§1.2)
1 Logic Logic is a discipline that studies the principles and methods used in correct reasoning It includes: A formal language for expressing statements.
CS 285- Discrete Mathematics Lecture 2. Section 1.1 Propositional Logic Propositions Conditional Statements Truth Tables of Compound Propositions Translating.
Chapter 1: The Foundations: Logic and Proofs
1.1 CompSci 102© Michael Frank Today’s topics Propositional equivalencesPropositional equivalences Predicate logicPredicate logic Reading: Sections Reading:
Review I Rosen , 3.1 Know your definitions!
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Propositional Logic. Propositions Any statement that is either True (T) or False (F) is a proposition Propositional variables: a variable that can assume.
Propositional Logic ITCS 2175 (Rosen Section 1.1, 1.2)
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.
Week 1 - Wednesday.  Course overview  Propositional logic  Truth tables  AND, OR, NOT  Logical equivalence.
Mathematics for Comter I Lecture 2: Logic (1) Basic definitions Logical operators Translating English sentences.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
رياضيات متقطعة لعلوم الحاسب MATH 226. Text books: (Discrete Mathematics and its applications) Kenneth H. Rosen, seventh Edition, 2012, McGraw- Hill.
University of Aberdeen, Computing Science CS2013 Mathematics for Computing Science Adam Wyner Adapted from Michael P. Frank ' s course based on the text.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 01: Boolean Logic Sections 1.1 and 1.2 Jarek Rossignac.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Module #1 - Logic 2016/7/91 Module #1: Logic (Textbook: §1.1~1.4) Dr. Chih-Wei Yi Department of Computer Science National Chiao Tung University.
Propositional Logic. Logic Logic: the science of reasoning, proof, thinking or inference. Logic allows us to analyze a piece of reasoning and determine.
Logic I 권태경 To do so, it should include a language to express statements, a notation to simplify expressions. Logic Mathematical Logic.
Discrete Structures for Computer Science Presented By: Andrew F. Conn Slides adapted from: Adam J. Lee Lecture #1: Introduction, Propositional Logic August.
CSNB 143 Discrete Mathematical Structures
6/20/2018 Discrete Math A word about organization: Since different courses have different lengths of lecture periods, and different instructors go at different.
6/20/2018 Arab Open University Faculty of Computer Studies M131 - Discrete Mathematics 6/20/2018.
COT 3100, Spr Applications of Discrete Structures
(CSC 102) Discrete Structures Lecture 2.
Ch.1 (Part 1): The Foundations: Logic and Proofs
Mathematics for Computing
The Foundations: Logic and Proofs
Principles of Computing – UFCFA3-30-1
Information Technology Department
Propositional Equivalence (§1.2)
CS 220: Discrete Structures and their Applications
CS201: Data Structures and Discrete Mathematics I
Lecture 2: Propositional Equivalences
Discrete Mathematics CMP-200 Propositional Equivalences, Predicates & Quantifiers, Negating Quantified Statements Abdul Hameed
Cs Discrete Mathematics
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Discrete Structures Prepositional Logic 2
CS201: Data Structures and Discrete Mathematics I
The Foundations: Logic and Proofs
Presentation transcript:

Fall 2013 Propositional Logic Rosen 5th ed., §§1.1-1.2

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

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

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 (1815-1864) Chrysippus of Soli (ca. 281 B.C. – 205 B.C.) CS2013 Univ of Aberdeen

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

Examples of NL Propositions Fall 2013 Examples of NL Propositions “It is raining.” (In a given situation.) “Beijing is the capital of China, and 1 + 2 = 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

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

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

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

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

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

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

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

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

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

The semantics of Propositional Logic CS2013 Univ of Aberdeen

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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  p3 1 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 Two truth values (0,1) and three propositions: 23 = 8. CS2013 Univ of Aberdeen

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

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

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

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

Mystery Operator PQR Formula (containing P,Q,R) 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 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

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

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

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

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)) 1 1 0 01 0 1 01 0 1 0 1 1 1 0 01 1 1 1 01 0 1 1 1 1 10 1 1 01 0 0 1 0 1 1 1 10 0 1 1 01 0 0 1 0 0 01 1 1 10 1 1 1 1 1 0 0 01 0 0 1 10 1 1 1 0 0 10 0 1 10 0 0 0 1 1 0 0 10 1 1 1 10 0 0 0 1 0 01 0 0 01 0 1 0 1 0 1 0 01 1 1 0 01 0 1 0 1 0 10 0 0 01 0 0 0 1 0 1 0 10 1 1 0 01 0 0 0 0 0 01 0 0 10 0 1 0 1 0 0 0 01 1 1 0 10 0 1 0 0 0 10 0 0 10 0 0 0 1 0 0 0 10 1 1 0 10 0 0 CS2013 Univ of Aberdeen

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 (1806-1871) CS2013 Univ of Aberdeen

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

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

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

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