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