Discrete Structures of Computer Science Propositional Logic III Rules of Inference Gazihan Alankuş (Based on original slides by Brahim Hnich) July 30, 2012
1 Previous Lecture 2 Summary of Laws of Logic 3 Substitution Laws 4 Logic Inference 5 Rules of Inference
Previous Lecture Logically equivalent statement Statements Φ and Ψ are equivalent iff Φ Ψ is a tautology Main logic equivalences double negation DeMorgan s Laws commutative, associative, and distributive laws idempotent, identity, and domination laws the law of contradiction and the law of excluded middle absorption law
Laws of Logic Double Negation : p p DeMorgan s Laws (p q) p q (p q) p q
Algebraic Laws of Logic Commutative laws p q q p p q q p Associative laws Distributive laws Idempotent laws p (q r) (p q) r p (q r) (p q) r p (q r) (p q) (p r) p (q r) (p q) (p r) p p p p p p
Logic Laws of Logic Identity laws p T p p F p Inverse laws also known as the law of contradiction or the law of excluded middle p p F p p T Domination laws Absorption laws p F F p T T p (p q) p p (p q) p
More useful equivalences p q (p q) p q (p q) (q p) p q p q
Example Show that (p q) p q
First Law of Substitution Suppose that the compound statement Φ is a tautology. If p is a primitive statement that appears in Φ and we replace each occurrence of p by the same statement q, then the resulting compound statement Ψ is also a tautology Let Φ = (p q) (q p) be a tautology, and we substitute p by p (s r). Therefore ((p (s r)) q) (q (p (s r))) is a tautology
Second Law of Substitution Let Φ be a compound statement, p an arbitrary (not necessarily primitive) statement that appears in Φ, and let q be a statement such that p q. If we replace one or more occurrences of p by q, then for the resulting compound statement Ψ we have Φ Ψ Let Φ = (p q) (q p), and we substitute the first occurrence of p by p (p q). Therefore ((p (p q)) q) (q p) is logically equivalent to Φ Recall that p p (p q) by absorption law
Logic inference One of the main goals of logic is to distinguish between valid and invalid arguments What can we say about the following arguments? If you have a current password, then you can log onto the network. You have a current password. Therefore, you can log onto the network. If you have a current password, then you can log onto the network. You can log onto the network. Therefore, you have a current password.
Logic inference (cntd) Write the above arguments in symbolic form p stand for you have a current password q stands for you can log onto the network p q p q p q q p stands for Therefore
Inference and Tautologies p q p q Check that Φ = ((p q) p)) q is a tautology If (p q) p is false, that is if one of the p q and p is false, then Φ is true If (p q) p is true, then both p q and p are true. Since the implication p q is true and p is true, q must also be true. Therefore, Φ is true Therefore whatever the values of p and q are, Φ is a tautology The first example is a valid argument!!!
Inference and Tautologies p q q p Let us try Ψ = ((p q) q) p p q p q ((p q) q) Ψ 0 0 1 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 Since Ψ is not a tautology, the second example is not a valid argument!!!
General Definition of Inference The general form of an argument in a symbolic form is (p 1 p 2 p 3... p n ) q where each p i is called a premise and q the conclusion The argument is valid if whenever each of the premises is true, the conclusion is also true The argument is valid if and only if the following compound statement is a tautology (p 1 p 2 p 3... p n ) q
Modus Ponens p q p q If you have a current password, then you can log onto the network. You have a current password. Therefore, you can log onto the network p: You have a current password q: You can log onto the network
Rule of Syllogism p q q r p r If you send an email, then I ll finish writing the program. If I finish writing the program, then I ll go to sleep early p: You will send an email q: I will finish writing the program r: I will go to sleep early Therefore, if you send me an email, then I will go to sleep early Thus ((p q) (q r)) (p r) is a tautology
Rule of Tollens p q q p If today is Friday, then tomorrow I will go biking. I will not go biking tomorrow p: Today is Friday q: I will go biking tomorrow. Therefore, today is not Friday Thus ((p q) q) p is a tautology
Rule of Disjunctive Syllogism p q p q I will go biking on Saturday or on Sunday. I will not go biking on Saturday p: I will go biking on Saturday q: I will go biking on Sunday Therefore, I will go biking on Sunday Thus ((p q) p) q is a tautology
Rule for Proof by Cases p r q r (p q) r If today is Saturday, then I will go biking. If today is Sunday, then I will go biking p: Today is Saturday q: Today is Sunday r: I will go biking Therefore, if today is Saturday or Sunday, then I will go biking Thus ((p r) (q r)) ((p q) r) is a tautology
Rule of Contradiction p F p Thus ( p F ) p is a tautology
Rule of Simplification Thus (p q) p is a tautology p q p
Rule of Amplification Thus p (p q) is a tautology p p q
Argumentation The goal of argument is to infer the required conclusion from given premises Definition An argument is a sequence of statements, each of which is either a premise, or obtained from preceding statements by means of a rule of inference
Example Premises: It is not sunny this afternoon and it is colder than yesterday. We will go swimming only if it is sunny this afternoon. If we do not go swimming, then we will take a canoe trip. If we take a canoe trip, then we will be home by sunset. Conclusion: We will be home by sunset
Example (cntd) Notation: p: It is sunny this afternoon q: It is colder than yesterday r: We will go swimming s: We will take a canoe trip t: We will be home by sunset Premises: p q, r p, r s, and s t Conclusion: t
Example (cntd) Step Reason 1. p q premise 2. p Simplification 3. r p premise 4. r modus tollens 5. r s premise 6. s modus ponens 7. s t premise 8. t modus ponens