Course staff CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics şıl Dillig nstructor: şil Dillig E-mail: isil@cs.utexas.edu Office hours: Thursday after class until 6:30 pm in GDC 5.726 TA: Yuepeng Wang (ypwang@cs.utexas.edu) Office hours: Mon, Wed 4-5pm in GDC 5.816 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 1/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 2/37 What is this Course About? Why Should You Care? Logic is a fundamental part of computer science: This course is about computational logic and its applications. Explore logical theories widely used in computer science. Learn about decision procedures that allow us to automatically decide satisfiability and validity of logical formulas. Artificial intelligence: planning, automated game playing,... Programming languages: Static analysis, software verification, program synthesis,... Software engineering: automated test generation, automated program repair,... şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 3/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 4/37 Overview of the Course Overview, cont Part : Propositional logic Part : First-order theorem proving SAT solvers Semantics of FOL and theoretical properties Applications and variations (e.g., MaxSAT) Basics of first-order theorem proving Binary Decision Diagrams Decidable fragments of FOL şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 5/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 6/37 1
Overview, cont. Overview, cont. Part : SMT Solving Part V: Applications in formal methods Decision procedures for commonly used theories (e.g., equality, linear arithmetic) Combining theories, Nelson-Oppen method DPLL(T) and practical SMT solvers Hoare Logic Automated verification using SMT nvariant inference şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 7/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 8/37 Logistics Optional Reference #1 All class material (slides, relevant reading etc.) posted on the course website: The Calculus of Computation by Aaron Bradley and Zohar Manna http://www.cs.utexas.edu/ idillig/cs389l Also have a Piazza page: piazza.com/utexas/spring2018/cs389l Please post all non-personal questions on Piazza instead of emailing us! şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 9/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 10/37 Optional Reference #2 Workload and Grading Decision Procedures: An Algorithmic Point of View by Daniel Kroening and Ofer Strichman My philosophy: Maximize your knowledge without taking too much time No programming assignments or big projects Expect problem set once every 2 weeks (35% grade) 2 in-class, closed-book exams (30% of grade each) Class attendance and participation (5% of grade) şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 11/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 12/37 2
Exams Exam dates: March 6, May 1 put these dates on your calendar! (free during finals week) All exams closed-book, closed-notes, closed-laptop, closed-phone etc, but can bring 2 cheat sheets Let s get started! Today: Review of basic propositional logic Should already know this stuff quick refresher! Please introduce yourself! şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 13/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 14/37 Review of Propositional Logic: PL Syntax Atom truth symbols ( true ) and ( false ) propositional variables p, q, r, p 1, q 1, r 1, Literal atom α or its negation α Formula literal or application of a logical connective to formulae F, F 1, F 2 F not (negation) F 1 F 2 and (conjunction) F 1 F 2 or (disjunction) F 1 F 2 implies (implication) F 1 F 2 if and only if (iff) PL Semantics nterpretation : mapping from each propositional variables in F to exactly one truth value : {p, q, } Formula F + nterpretation = Truth value We write = F if F evaluates to under (satisfying interpretation or model) Similarly, = F if F evaluates to under (falsifying interpretation or counter-model). şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 15/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 16/37 nductive Definition of PL Semantics Simple Example Base Cases: = = = p iff [p] = = p iff [p] = nductive Cases: = F iff = F = F 1 F 2 iff = F 1 and = F 2 = F 1 F 2 iff = F 1 or = F 2 = F 1 F 2 iff, = F 1 or = F 2 = F 1 F 2 iff, = F 1 and = F 2 or = F 1 and = F 2 Consider formula F 1 : (p q) (p q) What is its truth value under interpretation 1 : {p, q }? What about formula F 2 : (p q) (q r) and interpretation 2 = {p, q, r }? şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 17/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 18/37 3
Satisfiability and Validity Examples F is satisfiable iff there exists an interpretation such that = F. F valid iff for all interpretations, = F. F is contingent if it is satisfiable but not valid. Sat, unsat, or valid? (p q) p Duality between satisfiability and validity: (p q) ( (p q)) F is valid iff F is unsatisfiable (p (q r)) ((p q) r) Thus, if we have a procedure for checking satisfiability, this also allows us to decide validity şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 19/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 20/37 Deciding Satisfiability and Validity Method 1: Truth Tables Before we talk about practical algorithms for deciding satisfiability, let s review some simple techniques Example F : (p q) (p q) Two very simple techniques: Truth table method: essentially a search-based technique Semantic argument method: deductive way of deciding satisfiability Modern SAT solvers combine search and deduction! p q p q q p q F 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 1 1 Thus F is valid. şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 21/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 22/37 Another Example Bad dea! F : (p q) (p q) p q p q p q F 0 0 0 0 1 satisfying 0 1 1 0 0 falsifying 1 0 1 0 0 1 1 1 1 1 Truth tables are completely brute-force, impractical must list all 2 n interpretations! Does not work for any other logic where domain is not finite (e.g., first-order logic) Thus F is satisfiable, but invalid. şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 23/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 24/37 4
Method 2: Semantic Argument The Proof Rules () Semantic argument method is essentially a proof by contradiction, and is also applicable for theories with non-finite domain. Main idea: Assume F is not valid there exists some falsifying interpretation such that = F According to semantics of negation, from deduce = F : = F = F = F, we can Apply proof rules. f we derive a contradiction in every branch of the proof, then F is valid. Similarly, from = F, we can deduce: = F = F şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 25/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 26/37 The Proof Rules () The Proof Rules () According to semantics of conjunction, from can deduce: = F G = F = G and = F G, we According to semantics of disjunction, from can deduce: = F G = F = G = F G, we Similarly, from = F G, we can deduce: = F G = F = G Similarly, from = F G, we can deduce: = F G = F = G The second deduction results in a branch in the proof, so each case has to be examined separately! şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 27/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 28/37 The Proof Rules (V) The Proof Rules (V) According to semantics of implication: = F G = F = G According to semantics of iff: = F G = F G = F G And: = F G = F = G And: = F G = F G = F G şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 29/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 30/37 5
The Proof Rules (Contradiction) An Example Finally, we derive a contradiction, when both entails F and does not entail F : Prove F : (p q) (p q) is valid. = F = F = şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 31/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 32/37 Another Example Equivalence Prove that the following formula is valid using semantic argument method: F : ((p q) (q r)) (p r) Formulas F 1 and F 2 are equivalent (written F 1 F 2 ) iff for all interpretations, = F 1 F 2 F 1 F 2 iff F 1 F 2 is valid Thus, if we have a procedure for checking satisfiability, we can also check equivalence. şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 33/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 34/37 mplication Example Formula F 1 implies F 2 (written F 1 F 2 ) iff for all interpretations, = F 1 F 2 Prove that F 1 ( F 1 F 2 ) implies F 2 using semantic argument method. F 1 F 2 iff F 1 F 2 is valid Thus, if we have a procedure for checking satisfiability, we can also check implication Caveat: F 1 F 2 and F 1 F 2 are not formulas (they are not part of PL syntax); they are semantic judgments! şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 35/37 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 36/37 6
Summary Next lecture: Normal forms and algorithms for deciding satisfiability Optional reading: Bradley & Manna texbook until Section 1.6 şıl Dillig, CS389L: Automated Logical Reasoning Lecture 1: ntroduction and Review of Basics 37/37 7