Propositional Logic
Total Page:16
File Type:pdf, Size:1020Kb
CS206 Lecture 01 Home Page Propositional Logic Title Page G. Sivakumar Contents Computer Science Department IIT Bombay JJ II [email protected] J I http://www.cse.iitb.ac.in/∼siva Page 1 of 9 Thu, Jan 02, 2003 Go Back Full Screen Plan for Lecture 02 Close • Syntax Quit • Semantics Propositions A Proposition is a statement with a truth value. Home Page • My name is Sivakumar Title Page • Earth is bigger than the Sun. Contents • 2 + 2 = 4 • ... JJ II • This statement is false. J I Which ones mean true and which ones false? A typical puzzle Page 2 of 9 An island is inhabited by two classes of people: knights, who make Go Back only true statements, and knaves, who make only false statements. Three inhabitants are conversing. Ashok says, All of us are knaves. Full Screen Balu says, Exactly one of us is a knight. What are Ashok, Balu, Close and Chandra? Quit Classical Logic Has the law of Excluded Middle. Home Page Any proposition has exactly one of the two possible truth values. No ArdhaNariswara!. Title Page Allows proof by contradiction. Non-Constructive Proofs: You can prove a number is not a prime without Contents revealing any way to factorize it. Many other avours possible. JJ II • Multi-valued logic. yes, no, maybe J I • Fuzzy Logic degree of truth Page 3 of 9 • Probalistic Logic Go Back • Constructive Logic Full Screen • ... Close Quit What is Syntax? • A method to dene legal Alphabet, Words, Sentences ... Home Page • For any formal language, it is possible to give a grammar (set of rules) Title Page using which we can construct (and check) all sentences (formulae) of the language. Contents • Can be done algorithmically (on computer). JJ II • Typically given as an inductive deniton. With base case (atomic formula) and inductive case (compound formula). J I • Computer program to check is typically called Parser Page 4 of 9 Go Back Full Screen Close Quit Propositional Logic Alphabet • Propositional Symbols Home Page Truth Values: t, f (sometimes 1,0) Title Page Propositions: p, q, r • Logical Connectives Contents Unary (One Argument) JJ II ∗ Negation (not, ¬, ∼) Binary (Two Arguments) J I ∗ Conjunction (and, ∧) Page 5 of 9 ∗ Disjunction (or, ∨) Implication (implies, ) Go Back ∗ → ∗ Exclusive-OR (xor, ⊕) Full Screen ∗ Equivalence (↔) ∗ ... Close Quit Sample Formulae • Linear Notation Home Page p ∧ q Title Page ¬(p) → (q ∨ r) (p → q) ↔ (¬(p) ∨ q) Contents ... JJ II • Tree Notation J I Page 6 of 9 Go Back Full Screen Close Quit Propositional Formulae Well Formed Formula (w) Inductive Denition Home Page • Base case (atomic formula) A propositional symbol is a w.. Inductive case If and are ws, then so are Title Page • f1 f2 ¬(f1) Contents (f1) ∧ (f2) JJ II (f1) ∨ (f2) (f1) → (f2) J I ... Page 7 of 9 • Closure condition Nothing else is a w! Go Back Alternative Denition (Tree based) A w is a tree satisying the following: • Leaves are labelled with propositional symbols. Full Screen • Interior nodes are labelled with logical connectives of the myredcorrect Close arity. Correct arity means that the number of children is 1 for unary, 2 for Quit binary etc. Tree notation avoids clumsy paranthesis. Semantics • Semantics is the meaning of a sentence. In classical logic, every sentence must mean either true or false. Home Page • • How to assign a meaning to a formula? Title Page Base Case Contents An interpretation, or truth assignment, is a function from a set of propositional symbols to {t, f}. JJ II Inductive Case Truth Tables for Connectives J I p q ¬p p ∧ q p ∨ q p → q p ↔ q Page 8 of 9 t t f t t t t t f f f t f f Go Back f t t f t t f f f t f f t t Full Screen • p, q above actually any formulae f1, f2. Close • Note: Truth table for → (implication) is non intuitive. Quit If pigs had wings, India will win world cup. Back to Puzzle Let us solve the following, using propositional logic. Home Page An island is inhabited by two classes of people: knights, who make Title Page only true statements, and knaves, who make only false statements. Three inhabitants are conversing. Ashok says, All of us are knaves. Contents Balu says, Exactly one of us is a knight. What are Ashok, Balu, and Chandra? JJ II More CS-related one (homework) J I Either the program never terminates or the value of n is eventually Page 9 of 9 zero. If the value of n is eventually zero then the value of m will also eventually be zero. The program does terminate. Therefore Go Back the value of m will eventually zero. (T: the program terminates; N: the value of n is zero; M: the value of n is zero.) Full Screen Close Quit.