510 likes | 846 Views
Propositional Logic. Sec. 1.1-1.3 12-May. 1. Is the reasoning in your argument valid?. All MSU students are brilliant. You are an MSU student. Therefore, you are brilliant.
E N D
Propositional Logic Sec. 1.1-1.3 12-May Propositional Logic 1
Is the reasoning in your argument valid? • All MSU students are brilliant. You are an MSU student. Therefore, you are brilliant. • If space creatures were kidnapping people and examining them, the space creatures would probably hypnotically erase the memories of the people they examined. These people would thus suffer from amnesia. But in fact many people do suffer from amnesia. This tends to prove they were kidnapped and examined by space creatures. http://www.don-lindsay-archive.org/skeptic/arguments.html • Goal: Learn how to represent such an argument unambiguously, and to determine if it is valid or fallacious. 2 Propositional Logic
Propositions • Definition: A proposition is a statement that is either true or false Egypt is in Africa. Your driver’s side door is not shut. 7*119 is an even integer. Global warming is irreversible. • Truth Values true, false 1, 0 yes, no 3 Propositional Logic
Which are propositions? Their truth values? • 2 + 2 = 4 • It is a proposition. Its truth value is True • 1 = 0 • It is a proposition. Its truth value is False • It will rain tomorrow in East Lansing. • It is a proposition. We’ll know its truth value tomorrow! • Go Green! • Not a proposition • 5 • Not a proposition 4 Propositional Logic
Example • This proposition is false. • Not a proposition • This proposition is true. • Not a proposition • These are examples of self-referential statements; they are not considered propositions 5 Propositional Logic
Notation • We shall use the letters p, q, r, s and so on to stand for propositions. • We write:p: “Lansing is the capital of Michigan.”q: “Horses have nine lives.” • Read it as • p is the proposition “Lansing is the capital of Michigan.” • q stands for “Horses have nine lives.” 6 Propositional Logic
Compound Propositions • New propositions can be formed from existing propositions using logical operators: • Negation ¬ • Conjunction (and) ∧ • Disjunction (or) ∨ • Exclusive OR • Conditional/Implication • Biconditional 7 Propositional Logic
Negation • Definition: Letp be a proposition. The negation of p, denoted ¬p, is the proposition that is true, if p is false, and false, if p is true. • Read as ‘It is not the case that p.’ • Example • p: “Lansing is the capital of Michigan” • ¬p: “It is not the case that Lansing is the capital of Michigan” i.e., “Lansing is not the capital of Michigan.” • q: “Fish are mammals.” • ¬q: “It is not the case that fish are mammals” i.e., “Fish are not mammals.” 8 Propositional Logic
Truth Table • Shows the relationship between the value of a compound proposition and its sub-propositions. • Truth table of ¬p 9 Propositional Logic
Conjunction • Definition: Let p and q be propositions. The conjunction of p and q, denoted p q, is the proposition that is: • true when both p and q are true, and • false otherwise • Example: Let p: “the butler did it” q: “the cook did it.” • What does p q say? • Solution: “Both the butler and the cook did it.” 10 Propositional Logic
Truth Table for pq 11 Propositional Logic
Disjunction • Definition: Let p and q be propositions. The disjunction of p and q, denoted pq, is the proposition that is: • false when both p and q are false, and true otherwise. • Example: • Let p: “the butler did it” q: “the cook did it.” • What does pq say? • Solution: “Either the butler or the cook did it (or both).” Note: In natural language, “or” can be ambiguous; but not in logic! 12 Propositional Logic
Truth Table for p q Note the difference between inclusive and exclusive OR in English 13 Propositional Logic
Exclusive OR • Definition: Let p and q be propositions. The Exclusive OR of p and q, written p q, is the proposition that is true when exactly one ofp and q istrue; and is false, otherwise. • Examples: • “A student in CSE 260 is enrolled in either Section 1 or Section 2”. • “A positive integer is either odd or even.” 14 PROPOSITIONAL LOGIC
Truth table for p q 15 PROPOSITIONAL LOGIC
Conditional Proposition (Implication) • Definition: Let p and q be propositions. The conditional proposition, also called implication,pqis the proposition that is: • false when p istrue and q is false, and true otherwise. 16 Propositional Logic
Conditional Proposition (Implication) • Examples: • “If you have a BS with a major in CSE from MSU, then you know some propositional logic.” • “If you know some propositional logic, then you have a BS with a major in CS from MSU.” 17 Propositional Logic
More on pq The implies operator interpreted as a guarantee: • If pq is true andif p is true, then q is guaranteed to also be true. • But, if pq is true and p is false, then we cannot conclude anything about the value of q. • Ex: Let p = “It is raining”, q = “There are clouds in the sky” • Then pq stands for: “If it is raining then there are clouds in the sky.” 18 Propositional Logic
More on pq • There does not need to be a cause and effect relationship for pq to be true. • “If I can walk then snow is cold.” • “If pigs can fly, then I am the master of the universe.” 19 Propositional Logic
More on pq … • Terminologies used to express pq: • If p then q • p implies q • p only if q • p is a sufficient condition for q • q follows from p • q is a necessary condition for p • q if p • q when p • q whenever p • q unless ¬p 20 Propositional Logic
More on pq … • Other propositions related to pq: • qp is called the converse; • If there are clouds in the sky then it is raining . • ¬p¬q is called the inverse; • If it is not raining then there are no clouds in the sky • ¬q¬p is the contrapositive. • If there no clouds in the sky then it is not raining. 21 Propositional Logic
Biconditional • Definition: Let p and q be propositions. The biconditional pq is the proposition that is true whenp and q have the same truth values, and false otherwise. 22 PROPOSITIONAL LOGIC
Biconditional • The biconditional pq is read as ‘p if and only ifq’ or ‘p precisely if q’ • You can log into your CSE computer account if and only if you enter your user name and password correctly. • Execution reaches line 25 of this program precisely if the values of X and Y are both positive. • Note:pq is true if and only if both of the implications pq and qp are true. 23 PROPOSITIONAL LOGIC
Summary of logical operations How many logical operators can we define? 24 PROPOSITIONAL LOGIC
Application sidebar • Computer circuitry is built to implement logical combinations of bits. • Majors will learn to implement all of the above operations – using transistors and C/C++. • All the above operations can be expressed using just a single operation: NAND¬ (pq) • All the above operations can also be expressed using only the operation: NOR¬ (pq) PROPOSITIONAL LOGIC
Status check • So, we all know the “basic connectives” or “basic operators” • There are 16 boolean functions/operations with two propositions. • BIG IDEA: all boolean functions/operations of two arguments/operands can be constructed using only not, and, or • BIG IDEA: since we can replace not, and, or with NAND (or NOR) all of these functions can be constructed with NAND (or NOR) only PROPOSITIONAL LOGIC
Well-formed Formulas • A well-formed formula (wff) can be generated by using one or more of the following rules finitely many times • A propositional variable standing alone is a wff. • T is a wff and F is a wff. • If f is a wff, so are¬ f and ( f ). • If f and g are wffs, so are:fgfgf gf g . . . • Example: • If p, q, and r are propositional variables, then the following are both propositional formulas (i.e., wffs): p ¬ q r pq ¬ q (r q) PROPOSITIONAL LOGIC
Precedence of Logical Operators Example: • p ¬ q r • p ((¬ q ) r) Exercise #1: What about • p ¬ q r • (p (¬ q)) r • p ¬ q r ¬ q • p ((¬ q) r) (¬ q) A compiler implements an algorithm for checking if a string represents a wff. It creates an “expression tree” representing a wff and the order of operations to be used to compute the wff’s value for some truth assignments. 28 PROPOSITIONAL LOGIC
Tautology, Contradiction, Contingency • Tautology: A wff (proposition) that is true regardless of the truth values of its propositional variables (atomic propositions). • A tautology is true by virtue of logic. • Contradiction: A wff (proposition) that is false regardless of the truth values of its propositional variables (atomic propositions). • A contradiction is false by virtue of logic. • Contingency: A wff (proposition) that is not a tautology and also not a contradiction. 29 PROPOSITIONAL LOGIC
Example • ¬ pis a contingency. • p¬p is a tautology. • p ¬p is a contradiction. 30 PROPOSITIONAL LOGIC
Exercise #2 Classify each of the following propositions as a tautology, a contradiction, or a contingency: • “This instruction produced a run-time error.” • A contingency • “Either this instruction produced a run-time error or it did not produce a run-time error.” • A tautology. • “Either this instruction produced a run-time error or another instruction produced a run-time error.” • A contingency • “This instruction produced a run-time error, but it did not produce a run-time error.” • A contradiction. 31 PROPOSITIONAL LOGIC
Propositional Equivalences • Definition: Two wffs f and g are logically equivalent, if they have the same truth values in all possible cases. • In this case, we write:f ≡ g • Note: f≡g if and only if fgis . . . a tautology. 32 PROPOSITIONAL LOGIC
How to show logical equivalences? • By means of a Truth Table. • Already did a few examples • If n propositions, then 2n rows of truth table • By derivation, using known logical equivalences. 33 PROPOSITIONAL LOGIC
Some Important Equivalences 34 PROPOSITIONAL LOGIC
Some Important Equivalences See tables 6,7,8 in the Rosen text, pages 27 and 28. 35 PROPOSITIONAL LOGIC
Example: ¬ (p q) ≡ ¬ p ¬ q 36 PROPOSITIONAL LOGIC
Example: ¬ (p q) ≡ ¬ p ¬ q 37 PROPOSITIONAL LOGIC
Example: ¬ (p q) ≡ ¬ p ¬ q 38 PROPOSITIONAL LOGIC
Example: ¬ (p q) ≡ ¬ p ¬ q 39 PROPOSITIONAL LOGIC
Example: p (q r) ≡ (p q) (p r) A final column, for p (q r) (p q) (p r), is not strictly needed. It sufficesto notice that the 5th and 8th columns are identical. 41 PROPOSITIONAL LOGIC
Exercise #3: Which of these conditionals are equivalent? 42 PROPOSITIONAL LOGIC
Exercise #3: Which of these conditionals are equivalent? 43 PROPOSITIONAL LOGIC
Exercise #3: Which of these conditionals are equivalent? 44 PROPOSITIONAL LOGIC
Exercise #3: Which of these conditionals are equivalent? 45 PROPOSITIONAL LOGIC
Show that ¬ (p (¬p q)) ≡ ¬p ¬q ¬ (p (¬p q)) ≡ ¬p¬ (¬p q) De Morgan’s law ≡ ¬p (¬ (¬p) ¬q) De Morgan’s law ≡ ¬p (p ¬q) Double negation ≡ (¬pp) (¬p ¬q) Distributive law ≡ F (¬p ¬q) Contradiction ≡(¬p ¬q) F Commutative ≡ ¬p ¬q Identity law 46 PROPOSITIONAL LOGIC
Example • Show that (pq)→ (pq) is a tautology using a derivation. • In other words, show: [(pq)→ (pq)] ≡T (pq)→ (pq) ≡ ¬ (pq)(pq)Implication ≡ (¬p ¬q)(pq)De Morgan’s law ≡ (¬p p)(¬q q)Assoc. & Comm. ≡ T TTautology ≡ TDomination 47 PROPOSITIONAL LOGIC
Logic • Logic is the underpinning of all reasoned argument. The Greeks recognized its role in mathematics and philosophy, and studied it extensively. • Aristotle, in his Organon, wrote the first systematic treatise on logic. His work in particular had a heavy influence on philosophy, science and religion through the Middle Ages. • But Aristotle's logic was logic expressed in ordinary language, so was still subject to the ambiguities of natural languages. • Philosophers began to want to express logic more formally and symbolically, in the way that mathematics is written (Leibniz, in the 17th century, was probably the first to envision and call for such a formalism). • It was with the publication in 1847 of G. Boole's The Mathematical Analysis of Logic and A. DeMorgan's Formal Logic that symbolic logic came into being, and logic became recognized as part of mathematics. This also marked the recognition that mathematics is not just about numbers (arithmetic) and shapes (geometry), but encompasses any subject that can be expressed symbolically with precise rules of manipulation of those symbols. 48 Propositional Logic
Logic… • Since Boole and DeMorgan, logic and mathematics have been inextricably intertwined. • Logic is part of mathematics, but at the same time it is the language of mathematics. • In the late 19th and early 20th century it was believed that all of mathematics could be reduced to symbolic logic and made purely formal. This belief, though still held in modified form today, was shaken by K. Gödel in the 1930's, when he showed that there would always remain truths that could not be derived in any such formal system. Mathematician Hilbert was crushed! • The study of symbolic logic is usually broken into several parts. The first and most fundamental is the propositional logic, and on top of this is the predicate logic, which is the language of mathematics. Source: http://people.hofstra.edu/faculty/Stefan_Waner/RealWorld/logic/logicintro.html 49 Propositional Logic