# CS510 Software Engineering

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang Spring 2015 Additional slides credit: Michael Reniers, Julia Lawall, and Neil Jones.

2 Motivation Many static analysis techniques rely on proofing that some set of conditions hold. We need to come up with a way to express these conditions and reason about them. SAT solving allows to test the satisfiablity of propositional formulas in the domain of Boolean values. SAT solving is used for, e.g., formal equivalence checking, model checking, formal verification, automatic test pattern generation, scheduling problems, and symbolic execution. We need to understand propositional logic and SAT solving to follow the techniques listed above. Mathias Payer (Purdue University) CS510 Software Engineering / 60

3 History of Logic Philosophical Logic (500BC to 19th century) Symbolic Logic (mid to late 19th century) Mathematical Logic (late 19th century to mid 20th century) Logic in Computer Science (now) Mathias Payer (Purdue University) CS510 Software Engineering / 60

4 Syntax of propositional logic Table of Contents 1 Syntax of propositional logic 2 Semantics of propositional logic 3 Semantic entailment Natural deduction of proof system Soundness and completeness 4 Validity and Satisfiability Conjunctive normal forms 5 SAT Solver Mathias Payer (Purdue University) CS510 Software Engineering / 60

5 Syntax Syntax of propositional logic F :== (P) ( F ) (F F ) (F F ) (F F ) P :== p q r... Propositional atoms (p, q, r,...) are used to describe declarative sentences like 1037 is a prime number, Every even number > 2 is the sum of two prime numbers, or All Martians like pepperoni on their pizza (i.e., they can be evaluated to true or false). Connective Symbol Alternative Symbols negation (not) disjunction (or) conjunction (and) & mplication (implies),, Mathias Payer (Purdue University) CS510 Software Engineering / 60

6 Syntax of propositional logic Syntax for propositional logic Binding priorities:,,,, (These help reduce the amount of brackets needed. Also, outermost brackets are often omitted.) Mathias Payer (Purdue University) CS510 Software Engineering / 60

7 Semantics of propositional logic Table of Contents 1 Syntax of propositional logic 2 Semantics of propositional logic 3 Semantic entailment Natural deduction of proof system Soundness and completeness 4 Validity and Satisfiability Conjunctive normal forms 5 SAT Solver Mathias Payer (Purdue University) CS510 Software Engineering / 60

8 Semantics of propositional logic Semantics for Propositional Logic The meaning of a formula depends on: The meaning of the propositional atoms (occurring in the formula) The meaning of the connectives (occurring in the formula) Mathias Payer (Purdue University) CS510 Software Engineering / 60

9 Semantics of propositional logic Semantics: Propositional Atoms The meaning of the propositional atoms (occurring in the formula): A declarative sentence is either true or false Captured as an assignment of truth values (B = {T, F }) to the propositional atoms a valuation v : P B Mathias Payer (Purdue University) CS510 Software Engineering / 60

10 Semantics of propositional logic Semantics: Connectives The meaning of an n-ary connective is captured by a function f : B n B Usually, such functions are specified by a truth table. A B A A B A B A B T T F T T T T F F F T F F T T F T T F F T F F T Mathias Payer (Purdue University) CS510 Software Engineering / 60

11 Semantics of propositional logic Example: Formula Evaluation Evaluate the following formula: (p q) (q r) (p r) p q r p q q r p r A B C T T T T T T T T T T F T F F F T T F T F T F T T T F F F T F F T F T T T T T T T F T F T F F T T F F T T T T T T F F F T T T T T Mathias Payer (Purdue University) CS510 Software Engineering / 60

12 Semantic entailment Table of Contents 1 Syntax of propositional logic 2 Semantics of propositional logic 3 Semantic entailment Natural deduction of proof system Soundness and completeness 4 Validity and Satisfiability Conjunctive normal forms 5 SAT Solver Mathias Payer (Purdue University) CS510 Software Engineering / 60

13 Semantic entailment Areas of Interest Semantic entailment. Many logical arguments are of the form: from the assumptions φ 1, φ 2,... φ n we know ψ. This is formalised by the semantic entailment relation =. E.g., M = A describes that a situation M satisfies a formula A. Formally, φ 1, φ 2,... φ n = ψ iff for all valuations v such that φ i (v) = T for all 1 i n we have ψ (v) = T Validity: a formula φ is valid if = φ holds. Satisfiability: a formula φ is sat if there exists a valuation v so that φ (v) = T. Mathias Payer (Purdue University) CS510 Software Engineering / 60

14 Semantic entailment Semantic Entailment How do we establish semantic entailment φ 1, φ 2,... φ n = ψ? Option 1: Construct a truth table. If formulas contain m propositional atoms, the truth table contains 2 m lines! Option 2: Give a proof. Suppose that (p q) (q r). Suppose that p. Then, as p q follows from (p q) (q r), we have q. Finally, as q r follows from (p q) (q r), we have r. Thus the formula holds (i.e., there is no contradiction). Mathias Payer (Purdue University) CS510 Software Engineering / 60

15 Semantic entailment Semantic Entailment Proof rules for inferring a conclusion ψ from a list of premises φ 1, φ 2,... φ n (x y means that y is provable from x): φ 1, φ 2,... φ n ψ(sequent) What is a proof of a sequent φ 1, φ 2,... φ n ψ? Proof rules may be instantiated: consistent replacement of variables with formulas. Constructing the proof is filling the gap between the premises and the conclusion by applying a suitable sequence of proof rules. Mathias Payer (Purdue University) CS510 Software Engineering / 60

16 Semantic entailment Natural Deduction: Conjunction Natural deduction of proof system Proof rules for conjunction: proofs of ψ φ are a concatenation of proofs for ψ and proofs of φ. introduction: ψ φ ψ φ i elimination: ψ φ ψ e 1 ψ φ φ e 2 Mathias Payer (Purdue University) CS510 Software Engineering / 60

17 Semantic entailment Conjunction: Exercise Natural deduction of proof system Prove (p q) r, s t q s. Given that we have (p q) r and s t we can prove q s. Linear representation: 1 (p q) r premise 2 s t premise 3 p q e q e s e q s i 4,5 Mathias Payer (Purdue University) CS510 Software Engineering / 60

18 Semantic entailment Conjunction: Exercise (2) Natural deduction of proof system Prove (p q) r, s t q s. Given that we have (p q) r and s t we can prove q s. Tree representation: (p q) r p q q e 1 e 2 q s s t s e 1 i Mathias Payer (Purdue University) CS510 Software Engineering / 60

19 Semantic entailment Natural Deduction: Disjunction Natural deduction of proof system Proof rules for disjunction: introduction: ψ ψ φ i 1 φ ψ φ i 2 elminiation: φ ψ φ. χ χ ψ. χ e Mathias Payer (Purdue University) CS510 Software Engineering / 60

20 Semantic entailment Disjunction: Exercise Natural deduction of proof system Prove (p q) (p r) p (q r): 1 (p q) (p r) premise 2 p q assumption (1) 3 p e q e q r i p (q r) i 3, 5 7 p r assumption (2) 8 p e r e q r i p (q r) i 8,10 12 p (q r) e 1, 2-6, 7-11 Mathias Payer (Purdue University) CS510 Software Engineering / 60

21 Semantic entailment Natural Deduction: Implication Natural deduction of proof system Proof rules for implication: introduction elminiation φ φ. ψ φ ψ i φ ψ ψ e Mathias Payer (Purdue University) CS510 Software Engineering / 60

22 Semantic entailment Implication: Exercise Natural deduction of proof system Prove p q, q r p r: 1 p q premise 2 q r premise 3 p assumption 4 q e 1, 3 5 r e 2, 4 6 p r i 3-5 Mathias Payer (Purdue University) CS510 Software Engineering / 60

23 Semantic entailment Natural Deduction: Negation Natural deduction of proof system Proof rules for negation: introduction elimination: φ. φ i φ φ q Mathias Payer (Purdue University) CS510 Software Engineering / 60

24 Negation: Exercise Semantic entailment Natural deduction of proof system Prove p q, p q p: 1 p q premise 2 p q premise 3 p assumption 4 q e 1,3 5 q e 2,3 6 e 4, 5 7 p i 3-6 Mathias Payer (Purdue University) CS510 Software Engineering / 60

25 Semantic entailment Negation: Exercise (2) Natural deduction of proof system Prove p q p q: 1 p q premise 2 p assumption ( e 1 ) 3 p assumption (contradiction) 4 e 3, 2 5 q e 4 6 p q i q assumption ( e 2 ) 8 p assumption 9 q copy 7 10 p q i 8, 9 11 p q e 1, 2-6, 7-10 Mathias Payer (Purdue University) CS510 Software Engineering / 60

26 Semantic entailment Natural Deduction: Falsum Natural deduction of proof system Proof rules for falsum: introduction: there are no proof rules for the introduction of elimination: φ e Mathias Payer (Purdue University) CS510 Software Engineering / 60

27 Semantic entailment Natural deduction of proof system Natural Deduction: Double Negation Proof rules for double negation: introduction: elimination: φ φ i φ φ e Mathias Payer (Purdue University) CS510 Software Engineering / 60

28 Semantic entailment Natural deduction of proof system Natural Deduction: Derived Rules Modus Tollens: φ ψ ψ MT φ Reduction Ad Absurdum: φ. φ RAA Tertium Non Datur: φ φ TND TND can also be called Law of the Excluded Middle. Mathias Payer (Purdue University) CS510 Software Engineering / 60

29 Semantic entailment Soundness and completeness Natural Deduction is Sound and Complete Natural deduction is sound: if φ 1, φ n ψ, then φ 1, φ n = ψ Natural deduction is complete: if φ 1, φ n = ψ, then φ 1, φ n ψ Mathias Payer (Purdue University) CS510 Software Engineering / 60

30 Validity and Satisfiability Table of Contents 1 Syntax of propositional logic 2 Semantics of propositional logic 3 Semantic entailment Natural deduction of proof system Soundness and completeness 4 Validity and Satisfiability Conjunctive normal forms 5 SAT Solver Mathias Payer (Purdue University) CS510 Software Engineering / 60

31 Validity and Satisfiability Validity and Satisfiability of Propositional Formulas A formula φ is valid if for any valuations v, φ (v) = A formula φ is satisfiable if there exists a valuation v such that φ (v) = Mathias Payer (Purdue University) CS510 Software Engineering / 60

32 Validity and Satisfiability Validity and Satisfiability: Example p q satisfiable p (q p) valid(and satisfiable) p p unsatisfiable Mathias Payer (Purdue University) CS510 Software Engineering / 60

33 Validity and Satisfiability Deciding Validity What are the means to decide whether or not a given formula φ is valid? Use techniques for semantic entailment (e.g., natural deduction) Use a calculus for semantical equivalence to prove that φ. Transform φ into some normal form that is semantically equivalent and then apply dedicated (syntactic) techniques. (φ and ψ are semantically equivalent (not φ ψ) iff φ = ψ and ψ = φ. Mathias Payer (Purdue University) CS510 Software Engineering / 60

34 Validity and Satisfiability Deciding Validity (2) Lemma 1.41 A decision procedure for validity can be used for semantic entailment. φ 1, φ n = ψ iff = φ 1 (φ 2 (φ n ψ)) Mathias Payer (Purdue University) CS510 Software Engineering / 60

35 Validity and Satisfiability Deciding Validity (3) If I m wealthy, then I m happy. I am happy.therefore, I m wealthy. If John drinks beer, he is at least 21 years old. John does not drink beer.therefore, John is not yet 21 years old. If I study, then I will not fail basket weaving 101. If I do not play cards too often, then I will study. I failed basket weaving 101.Therefore, I played cards too often. Mathias Payer (Purdue University) CS510 Software Engineering / 60

36 Validity and Satisfiability Conjunctive Normal Form Conjunctive normal forms A literal is either an atom p or the negation of an atom p. A formula φ is in conjunctive normal form (CNF) if it is a conjunction of a number of disjunctions and literals only. L ::= P P C ::= L C C CNF ::= C CNF CNF literal clause CNF Mathias Payer (Purdue University) CS510 Software Engineering / 60

37 CNF Examples Validity and Satisfiability Conjunctive normal forms p, p CNF p not CNF p p CNF (p r) ( r s) q CNF (p q) q not CNF Mathias Payer (Purdue University) CS510 Software Engineering / 60

38 Validity in CNF Validity and Satisfiability Conjunctive normal forms Remember a formula is valid iff any of its equivalent formulas is valid. Reduce the problem of determining whether any φ is valid to the problem of computing an equivalent ψ φ such that ψ is in CNF and then checking ψ. Deciding validity in CNF (C 1 C 2 C n ) is incremental: each clause C i must be valid individually. Each clause C i consists of a disjunction of literals L 1 L 2 L m. A disjunction of literals is valid iff there are 1 i, j m such that L i is L j. Mathias Payer (Purdue University) CS510 Software Engineering / 60

39 Validity and Satisfiability Validity in CNF (2) Conjunctive normal forms We now have a simple way to check the validity of = φ as long as φ is in CNF: inspect all conjuncts ψ k of φ and search for atoms in ψ k so that ψ k also contains their negation. If a match is found for all conjuncts we have = φ. Otherwise (i.e., some conjunct contains no pair L i and L j ), φ is not valid. Mathias Payer (Purdue University) CS510 Software Engineering / 60

40 Validity and Satisfiability Transformation into CNF Conjunctive normal forms 1 IF: Remove all occurrences of : translate ψ η to ψ η (in: formula, out: formula without ). 2 NNF: Obtain a negation normal form (NNF) where only atoms are negated (in: formula without, out: formula in NNF): N ::= P P (N N) (N N) P ::= p q r 3 CNF: Apply distribution laws (in: formula in NNF, out: formula in CNF): replace (φ 1 φ 2 ) ψ by (φ 1 ψ) (φ 2 ψ) replace φ (ψ 1 ψ 2 ) by (φ ψ 1 ) (φ ψ 2 ) Therefore, CNF (NNF (IF (φ))) is in CNF and semantically equivalent with φ. Mathias Payer (Purdue University) CS510 Software Engineering / 60

41 Validity and Satisfiability Conjunctive normal forms Transformation into CNF: IF algorithm Remove implications from the formula by applying the following replacement until you reach a fix-point: ψ η to ψ η Inductive definition of IMPL FREE: IF (p) = p IF ( φ) = IF (φ) IF (φ 1 φ 2 ) = IF (φ 1 ) IF (φ 2 ) IF (φ 1 φ 2 ) = IF (φ 1 ) IF (φ 2 ) IF (φ 1 φ 2 ) = IF (φ 1 ) IF (φ 2 ) Properties of IF : it is (i) well-defined (terminates for any input), (ii) IF (ψ) ψ (output of both formulas are semantically equivalent),and (iii) IF (ψ) is an implication-free formula for any formula ψ. Mathias Payer (Purdue University) CS510 Software Engineering / 60

42 Validity and Satisfiability Conjunctive normal forms Transformation into CNF: NNF algorithm Simplify formula into negation normal form by repeatedly applying pattern rewriting rules: φ replace by φ (φ ψ) replace by φ ψ (φ ψ) replace by φ ψ Inductive definition of NFF: NNF (p) = p NNF ( p) = p NNF ( φ) = NNF (φ) NNF ( (φ ψ)) = NNF ( φ) NNF ( ψ) NNF ( (φ ψ)) = NNF ( φ) NNF ( ψ) NNF (φ ψ) = NNF (φ) NNF (ψ) NNF (φ ψ) = NNF (φ) NNF (ψ) Mathias Payer (Purdue University) CS510 Software Engineering / 60

43 Validity and Satisfiability Conjunctive normal forms Transformation into CNF: NNF algorithm (2) Properties of NNF : it is (i) well-defined (terminates for any input), (ii) NNF (ψ) ψ (output of both formulas are semantically equivalent),and (iii) NNF (ψ) is a negation-free formula for any formula ψ. Mathias Payer (Purdue University) CS510 Software Engineering / 60

44 Validity and Satisfiability Conjunctive normal forms Transformation into CNF: CNF algorithm Simplify formula into conjunctive normal form (CNF) by repeatedly applying pattern rewriting rules: (φ 1 φ 2 ) ψ replace by (φ 1 ψ) (φ 2 ψ) φ (ψ 1 ψ 2 ) replace by (φ ψ 1 ) (φ ψ 2 ) Mathias Payer (Purdue University) CS510 Software Engineering / 60

45 Validity and Satisfiability Conjunctive normal forms Transformation into CNF: CNF algorithm (2) Inductive definition of CNF: CNF (p) = p CNF ( p) = p CNF (φ 1 φ 2 ) = CNF (φ 1 ) CNF (φ 2 ) CNF (φ 1 φ 2 ) = D(CNF (φ 1 ), CNF (φ 2 )) D(φ 11, φ 2 ) D(φ 12, φ 2 ) φ 1 = φ 11 φ 12 D(φ 1, φ 2 ) = D(φ 1, φ 21 ) D(φ 1, φ 22 ) φ 2 = φ 21 φ 22 φ 1 φ 2 otherwise Properties of CNF and D: CNF and D are (i) well-defined (terminate for any input), (ii) D(φ, ψ) φ ψ and CNF (φ) φ (output of both formulas are semantically equivalent),and (iii) CNF (φ) is in CNF for any formula φ in NNF and D(φ, ψ) is in CNF for any formulas φ and ψ in CNF. Mathias Payer (Purdue University) CS510 Software Engineering / 60

46 CNF: Example Validity and Satisfiability Conjunctive normal forms Find a CNF for p q r: p q r premise (p q) r apply IMPL FREE ( p q) r apply NNF ( p q) r apply NNF ( p r) (q r) apply CNF Mathias Payer (Purdue University) CS510 Software Engineering / 60

47 Table of Contents SAT Solver 1 Syntax of propositional logic 2 Semantics of propositional logic 3 Semantic entailment Natural deduction of proof system Soundness and completeness 4 Validity and Satisfiability Conjunctive normal forms 5 SAT Solver Mathias Payer (Purdue University) CS510 Software Engineering / 60

48 SAT Solver SAT Solver Find satisfying valuations to a propositional formula. Develop a systematic approach to test all possible valuations to find a satisfiable valuation. SAT solving is NP-complete, so the worst-case complexity will always be exponential.but good heuristics exist. Mathias Payer (Purdue University) CS510 Software Engineering / 60

49 SAT Solver Forcing Laws: Negation φ φ T F F T o T F o F T Mathias Payer (Purdue University) CS510 Software Engineering / 60

50 SAT Solver Forcing Laws: Conjunction φ ψ φ ψ T T T T F F F T F F F F φ, ψ φ, ψ T = T, T T, T = T?, F = F F,? = F, φ ψ, ψ φ F, T = F F, T = F Mathias Payer (Purdue University) CS510 Software Engineering / 60

51 SAT Solver Forcing Laws: Completeness Is this enough?we now have and. We can convert any propositional formula (without loss of generality) to a formula that only contains and. Simplify formula into, T (p) T ( φ) T (φ ψ) T (φ ψ) T (φ ψ) = p = T (φ) = T (φ) T (ψ) = ( T (φ) T (ψ)) = (T (φ) T (ψ)) This translation results in a linear growth in the formula size. Mathias Payer (Purdue University) CS510 Software Engineering / 60

52 SAT Solving SAT Solver 1 Convert formula to and 2 Translate the formula to a DAG, sharing common subterms. 3 Set the root to T and apply the forcing rules. The formula is satisfiable iff all nodes are consistently annotated. Mathias Payer (Purdue University) CS510 Software Engineering / 60

53 SAT Solver Example: Satisfiability Formula: p (q p) p ( q p): 1T 2T 3F 4T 5T 5T 6F 2T p q 6F Is the formula satisfiable? Yes: p = T, q = F is a witness. Mathias Payer (Purdue University) CS510 Software Engineering / 60

54 Example: Validity SAT Solver Show the validity of (p (p q)) p. This formula is valid if ((p (p q)) p) is not satisfiable.translated formula: ( p (p q)) p. 1T 2T 2T 3F 4F 5T 3F p q Contradiction! Mathias Payer (Purdue University) CS510 Software Engineering / 60

55 SAT Solver Example: Satisfiability Formula: (p (p q)) p ((p (p q)) p) 1T 2F p q We have an unsatisfiable formula. Now what? Mathias Payer (Purdue University) CS510 Software Engineering / 60

56 SAT Solver Limitation of the SAT solver algorithm Fails for all formulas of the form (φ 1 φ 2 ). Yet, some are valid and thus satisfiable: p p (p p) Some are not valid and thus not satisfiable: ( ) (p p p p) ( (p p) (p p)) Mathias Payer (Purdue University) CS510 Software Engineering / 60

57 SAT Solver Extended Algorithm SAT Checking 1 Pick an unmarked node and add temporary T and F marks. 2 Use the forcing rules to propagate both marks. 3 If both marks lead to a contradiction, report a contradiction. 4 If both marks lead to some node having the same value, permanently assign the node that value. 5 Erase the remaining temporary marks and continue. Complexity: O(n 3 ): (i) testing each unmarked node O(n), (ii) testing a given unmarked node O(n), (iii) repeating the process when a new node is marked O(n). Mathias Payer (Purdue University) CS510 Software Engineering / 60

58 SAT Solver Extended Algorithm: Example Formula: (q r) ( (q r) ( q r)): 3F 2T 8T q 6T 7T r 6T 4T 1T 2T 4F 5F 3F 5T 5F 6T 8T q 6T 7T r 6T 7T 7T r 6T 8T q 6T r is true in both cases. Fix r to T. Mathias Payer (Purdue University) CS510 Software Engineering / 60

59 SAT Solver Extended Algorithm: Example (2) 1T 2T 2T 3F 3F 5F q r 4T 7T 8F 6F 7T 5F q r 4T 6T r 4T 5F q Satisfiable! Mathias Payer (Purdue University) CS510 Software Engineering / 60

60 Questions? SAT Solver? Mathias Payer (Purdue University) CS510 Software Engineering / 60

### Logic in general. Inference rules and theorem proving

Logical Agents Knowledge-based agents Logic in general Propositional logic Inference rules and theorem proving First order logic Knowledge-based agents Inference engine Knowledge base Domain-independent

### Discrete Mathematics, Chapter : Propositional Logic

Discrete Mathematics, Chapter 1.1.-1.3: Propositional Logic Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 1.1-1.3 1 / 21 Outline 1 Propositions

### Correspondence analysis for strong three-valued logic

Correspondence analysis for strong three-valued logic A. Tamminga abstract. I apply Kooi and Tamminga s (2012) idea of correspondence analysis for many-valued logics to strong three-valued logic (K 3 ).

### Foundations of Artificial Intelligence

Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard, Bernhard Nebel and Martin Riedmiller Albert-Ludwigs-Universität Freiburg Contents 1 Agents

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### The Foundations: Logic and Proofs. Chapter 1, Part III: Proofs

The Foundations: Logic and Proofs Chapter 1, Part III: Proofs Rules of Inference Section 1.6 Section Summary Valid Arguments Inference Rules for Propositional Logic Using Rules of Inference to Build Arguments

### Mathematical Logic. Tableaux Reasoning for Propositional Logic. Chiara Ghidini. FBK-IRST, Trento, Italy

Tableaux Reasoning for Propositional Logic FBK-IRST, Trento, Italy Outline of this lecture An introduction to Automated Reasoning with Analytic Tableaux; Today we will be looking into tableau methods for

### The Predicate Calculus in AI

Last time, we: The Predicate Calculus in AI Motivated the use of Logic as a representational language for AI (Can derive new facts syntactically - simply by pushing symbols around) Described propositional

### Truth Conditional Meaning of Sentences. Ling324 Reading: Meaning and Grammar, pg

Truth Conditional Meaning of Sentences Ling324 Reading: Meaning and Grammar, pg. 69-87 Meaning of Sentences A sentence can be true or false in a given situation or circumstance. (1) The pope talked to

### Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

### Satisfiability and Validity

6.825 Techniques in Artificial Intelligence Satisfiability and Validity Lecture 4 1 Last time we talked about propositional logic. There's no better way to empty out a room than to talk about logic. So

### Satisfiability Checking

Satisfiability Checking SAT-Solving Prof. Dr. Erika Ábrahám Theory of Hybrid Systems Informatik 2 WS 10/11 Prof. Dr. Erika Ábrahám - Satisfiability Checking 1 / 40 A basic SAT algorithm Assume the CNF

### Likewise, we have contradictions: formulas that can only be false, e.g. (p p).

CHAPTER 4. STATEMENT LOGIC 59 The rightmost column of this truth table contains instances of T and instances of F. Notice that there are no degrees of contingency. If both values are possible, the formula

### Boolean Representations and Combinatorial Equivalence

Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discuss the applications of these representations for proving

### AI Principles, Semester 2, Week 2, Lecture 4 Introduction to Logic Thinking, reasoning and deductive logic Validity of arguments, Soundness of

AI Principles, Semester 2, Week 2, Lecture 4 Introduction to Logic Thinking, reasoning and deductive logic Validity of arguments, Soundness of arguments Formal systems Axioms, Inference, and Proof Propositional

### Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Now that we have a basic understanding

### Artificial Intelligence Automated Reasoning

Artificial Intelligence Automated Reasoning Andrea Torsello Automated Reasoning Very important area of AI research Reasoning usually means deductive reasoning New facts are deduced logically from old ones

### Satisfiability Checking

Satisfiability Checking First-Order Logic Prof. Dr. Erika Ábrahám RWTH Aachen University Informatik 2 LuFG Theory of Hybrid Systems WS 14/15 Satisfiability Checking Prof. Dr. Erika Ábrahám (RWTH Aachen

### CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

### Chapter I Logic and Proofs

MATH 1130 1 Discrete Structures Chapter I Logic and Proofs Propositions A proposition is a statement that is either true (T) or false (F), but or both. s Propositions: 1. I am a man.. I am taller than

### WUCT121. Discrete Mathematics. Logic

WUCT121 Discrete Mathematics Logic 1. Logic 2. Predicate Logic 3. Proofs 4. Set Theory 5. Relations and Functions WUCT121 Logic 1 Section 1. Logic 1.1. Introduction. In developing a mathematical theory,

### Mathematical Induction

Mathematical Induction In logic, we often want to prove that every member of an infinite set has some feature. E.g., we would like to show: N 1 : is a number 1 : has the feature Φ ( x)(n 1 x! 1 x) How

### 2. Propositional Equivalences

2. PROPOSITIONAL EQUIVALENCES 33 2. Propositional Equivalences 2.1. Tautology/Contradiction/Contingency. Definition 2.1.1. A tautology is a proposition that is always true. Example 2.1.1. p p Definition

### Propositional Logic. Definition: A proposition or statement is a sentence which is either true or false.

Propositional Logic Definition: A proposition or statement is a sentence which is either true or false. Definition:If a proposition is true, then we say its truth value is true, and if a proposition is

### Resolution in Propositional and First-Order Logic

Resolution in Propositional and First-Order Logic Inference rules Logical inference creates new sentences that logically follow from a set of sentences (KB) An inference rule is sound if every sentence

### MATH20302 Propositional Logic. Mike Prest School of Mathematics Alan Turing Building Room

MATH20302 Propositional Logic Mike Prest School of Mathematics Alan Turing Building Room 1.120 mprest@manchester.ac.uk April 10, 2015 Contents I Propositional Logic 3 1 Propositional languages 4 1.1 Propositional

### Inference Rules and Proof Methods

Inference Rules and Proof Methods Winter 2010 Introduction Rules of Inference and Formal Proofs Proofs in mathematics are valid arguments that establish the truth of mathematical statements. An argument

### What is logic? Propositional Logic. Negation. Propositions. This is a contentious question! We will play it safe, and stick to:

Propositional Logic This lecture marks the start of a new section of the course. In the last few lectures, we have had to reason formally about concepts. This lecture introduces the mathematical language

### Optimizing Description Logic Subsumption

Topics in Knowledge Representation and Reasoning Optimizing Description Logic Subsumption Maryam Fazel-Zarandi Company Department of Computer Science University of Toronto Outline Introduction Optimization

### Predicate logic Proofs Artificial intelligence. Predicate logic. SET07106 Mathematics for Software Engineering

Predicate logic SET07106 Mathematics for Software Engineering School of Computing Edinburgh Napier University Module Leader: Uta Priss 2010 Copyright Edinburgh Napier University Predicate logic Slide 1/24

### CS 441 Discrete Mathematics for CS Lecture 5. Predicate logic. CS 441 Discrete mathematics for CS. Negation of quantifiers

CS 441 Discrete Mathematics for CS Lecture 5 Predicate logic Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Negation of quantifiers English statement: Nothing is perfect. Translation: x Perfect(x)

### Propositional Logic. A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both.

irst Order Logic Propositional Logic A proposition is a declarative sentence (a sentence that declares a fact) that is either true or false, but not both. Are the following sentences propositions? oronto

### Foundational Proof Certificates

An application of proof theory to computer science INRIA-Saclay & LIX, École Polytechnique CUSO Winter School, Proof and Computation 30 January 2013 Can we standardize, communicate, and trust formal proofs?

### CSE 191, Class Note 01 Propositional Logic Computer Sci & Eng Dept SUNY Buffalo

Propositional Logic CSE 191, Class Note 01 Propositional Logic Computer Sci & Eng Dept SUNY Buffalo c Xin He (University at Buffalo) CSE 191 Discrete Structures 1 / 37 Discrete Mathematics What is Discrete

### 2. The Language of First-order Logic

2. The Language of First-order Logic KR & R Brachman & Levesque 2005 17 Declarative language Before building system before there can be learning, reasoning, planning, explanation... need to be able to

### Beyond Propositional Logic Lukasiewicz s System

Beyond Propositional Logic Lukasiewicz s System Consider the following set of truth tables: 1 0 0 1 # # 1 0 # 1 1 0 # 0 0 0 0 # # 0 # 1 0 # 1 1 1 1 0 1 0 # # 1 # # 1 0 # 1 1 0 # 0 1 1 1 # 1 # 1 Brandon

### Ensuring Consistency in Long Running Transactions

Ensuring Consistency in Long Running Transactions UCLA Computer Science Dept. Technical Report TR-070011 Jeffrey Fischer Rupak Majumdar Department of Computer Science, University of California, Los Angeles

### Automated Theorem Proving - summary of lecture 1

Automated Theorem Proving - summary of lecture 1 1 Introduction Automated Theorem Proving (ATP) deals with the development of computer programs that show that some statement is a logical consequence of

### CS 441 Discrete Mathematics for CS Lecture 2. Propositional logic. CS 441 Discrete mathematics for CS. Course administration

CS 441 Discrete Mathematics for CS Lecture 2 Propositional logic Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Course administration Homework 1 First homework assignment is out today will be posted

### Artificial Intelligence. 4. Propositional Logic

rtificial Intelligence rtificial Intelligence 4. Propositional Logic Lars Schmidt-Thieme Information Systems and Machine Learning Lab (ISMLL) Institute of Economics and Information Systems & Institute

### Lecture 7: NP-Complete Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

### Resolution. Informatics 1 School of Informatics, University of Edinburgh

Resolution In this lecture you will see how to convert the natural proof system of previous lectures into one with fewer operators and only one proof rule. You will see how this proof system can be used

### Predicate Logic Review

Predicate Logic Review UC Berkeley, Philosophy 142, Spring 2016 John MacFarlane 1 Grammar A term is an individual constant or a variable. An individual constant is a lowercase letter from the beginning

### DEDUCTIVE & INDUCTIVE REASONING

DEDUCTIVE & INDUCTIVE REASONING Expectations 1. Take notes on inductive and deductive reasoning. 2. This is an information based presentation -- I simply want you to be able to apply this information to

### (LMCS, p. 317) V.1. First Order Logic. This is the most powerful, most expressive logic that we will examine.

(LMCS, p. 317) V.1 First Order Logic This is the most powerful, most expressive logic that we will examine. Our version of first-order logic will use the following symbols: variables connectives (,,,,

### Computational Methods for Database Repair by Signed Formulae

Computational Methods for Database Repair by Signed Formulae Ofer Arieli (oarieli@mta.ac.il) Department of Computer Science, The Academic College of Tel-Aviv, 4 Antokolski street, Tel-Aviv 61161, Israel.

### Logical Agents. Explorations in Artificial Intelligence. Knowledge-based Agents. Knowledge-base Agents. Outline. Knowledge bases

Logical Agents Explorations in Artificial Intelligence rof. Carla. Gomes gomes@cs.cornell.edu Agents that are able to: Form representations of the world Use a process to derive new representations of the

### Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 11 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical

### Discrete Mathematics Lecture 1 Logic of Compound Statements. Harper Langston New York University

Discrete Mathematics Lecture 1 Logic of Compound Statements Harper Langston New York University Administration Class Web Site http://cs.nyu.edu/courses/summer05/g22.2340-001/ Mailing List Subscribe at

### def: An axiom is a statement that is assumed to be true, or in the case of a mathematical system, is used to specify the system.

Section 1.5 Methods of Proof 1.5.1 1.5 METHODS OF PROOF Some forms of argument ( valid ) never lead from correct statements to an incorrect. Some other forms of argument ( fallacies ) can lead from true

### Boolean or Propositional Logic

Boolean or Propositional Logic SET07106 Mathematics for Software Engineering School of Computing Edinburgh Napier University Module Leader: Uta Priss 2010 Copyright Edinburgh Napier University Boolean

### Approximated Probabilistic Answer Set Programming

Approximated Probabilistic Answer Set Programming Department of Computer Science Universidade de São Paulo São Paulo, Brazil 2014 Toy Example 4 6 2 5 1 3 Limit the percentage of time the edge (1, 3) is

### n logical not (negation) n logical or (disjunction) n logical and (conjunction) n logical exclusive or n logical implication (conditional)

Discrete Math Review Discrete Math Review (Rosen, Chapter 1.1 1.6) TOPICS Propositional Logic Logical Operators Truth Tables Implication Logical Equivalence Inference Rules What you should know about propositional

### MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.

MATHEMATICAL INDUCTION MIGUEL A LERMA (Last updated: February 8, 003) Mathematical Induction This is a powerful method to prove properties of positive integers Principle of Mathematical Induction Let P

### A Theorem Prover for Boolean BI

A Theorem Prover for Boolean BI Jonghyun Park Jeongbong Seo Sungwoo Park Department of Computer Science and Engineering Pohang University of Science and Technology (POSTECH) Republic of Korea {parjong,baramseo,gla}@postech.ac.kr

### Fixed-Point Logics and Computation

1 Fixed-Point Logics and Computation Symposium on the Unusual Effectiveness of Logic in Computer Science University of Cambridge 2 Mathematical Logic Mathematical logic seeks to formalise the process of

### MATH 55: HOMEWORK #2 SOLUTIONS

MATH 55: HOMEWORK # SOLUTIONS ERIC PETERSON * 1. SECTION 1.5: NESTED QUANTIFIERS 1.1. Problem 1.5.8. Determine the truth value of each of these statements if the domain of each variable consists of all

### Propositional Logic. 1. Semantics and Propositions. LX Semantics September 19, 2008

Propositional Logic LX 502 - Semantics September 19, 2008 1. Semantics and Propositions Natural language is used to communicate information about the world, typically between a speaker and an addressee.

### Chapter 1 LOGIC AND PROOF

Chapter 1 LOGIC AND PROOF To be able to understand mathematics and mathematical arguments, it is necessary to have a solid understanding of logic and the way in which known facts can be combined to prove

### npsolver A SAT Based Solver for Optimization Problems

npsolver A SAT Based Solver for Optimization Problems Norbert Manthey and Peter Steinke Knowledge Representation and Reasoning Group Technische Universität Dresden, 01062 Dresden, Germany peter@janeway.inf.tu-dresden.de

### Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)

Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic

### We would like to state the following system of natural deduction rules preserving falsity:

A Natural Deduction System Preserving Falsity 1 Wagner de Campos Sanz Dept. of Philosophy/UFG/Brazil sanz@fchf.ufg.br Abstract This paper presents a natural deduction system preserving falsity. This new

### CS510 Software Engineering

CS510 Software Engineering Dynamic Program Analysis Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15-cs510-se

### LOGICAL INFERENCE & PROOFs. Debdeep Mukhopadhyay Dept of CSE, IIT Madras

LOGICAL INFERENCE & PROOFs Debdeep Mukhopadhyay Dept of CSE, IIT Madras Defn A theorem is a mathematical assertion which can be shown to be true. A proof is an argument which establishes the truth of a

### Section 7.1 First-Order Predicate Calculus predicate Existential Quantifier Universal Quantifier.

Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially or universally. A predicate describes a

### Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement

### Deductive Systems. Marco Piastra. Artificial Intelligence. Artificial Intelligence - A.A Deductive Systems [1]

Artificial Intelligence Deductive Systems Marco Piastra Artificial Intelligence - A.A. 2012- Deductive Systems 1] Symbolic calculus? A wff is entailed by a set of wff iff every model of is also model of

### Definition 10. A proposition is a statement either true or false, but not both.

Chapter 2 Propositional Logic Contrariwise, continued Tweedledee, if it was so, it might be; and if it were so, it would be; but as it isn t, it ain t. That s logic. (Lewis Carroll, Alice s Adventures

### Schedule. Logic (master program) Literature & Online Material. gic. Time and Place. Literature. Exercises & Exam. Online Material

OLC mputational gic Schedule Time and Place Thursday, 8:15 9:45, HS E Logic (master program) Georg Moser Institute of Computer Science @ UIBK week 1 October 2 week 8 November 20 week 2 October 9 week 9

### Software Modeling and Verification

Software Modeling and Verification Alessandro Aldini DiSBeF - Sezione STI University of Urbino Carlo Bo Italy 3-4 February 2015 Algorithmic verification Correctness problem Is the software/hardware system

### Computational Logic and Cognitive Science: An Overview

Computational Logic and Cognitive Science: An Overview Session 1: Logical Foundations Technical University of Dresden 25th of August, 2008 University of Osnabrück Who we are Helmar Gust Interests: Analogical

### Certamen 1 de Representación del Conocimiento

Certamen 1 de Representación del Conocimiento Segundo Semestre 2012 Question: 1 2 3 4 5 6 7 8 9 Total Points: 2 2 1 1 / 2 1 / 2 3 1 1 / 2 1 1 / 2 12 Here we show one way to solve each question, but there

### Examination paper for MA0301 Elementær diskret matematikk

Department of Mathematical Sciences Examination paper for MA0301 Elementær diskret matematikk Academic contact during examination: Iris Marjan Smit a, Sverre Olaf Smalø b Phone: a 9285 0781, b 7359 1750

### Generating models of a matched formula with a polynomial delay

Generating models of a matched formula with a polynomial delay Petr Savicky Institute of Computer Science, Academy of Sciences of Czech Republic, Pod Vodárenskou Věží 2, 182 07 Praha 8, Czech Republic

### Introduction to Logic: Argumentation and Interpretation. Vysoká škola mezinárodních a veřejných vztahů PhDr. Peter Jan Kosmály, Ph.D. 9. 3.

Introduction to Logic: Argumentation and Interpretation Vysoká škola mezinárodních a veřejných vztahů PhDr. Peter Jan Kosmály, Ph.D. 9. 3. 2016 tests. Introduction to Logic: Argumentation and Interpretation

### -123- A Three-Valued Interpretation for a Relevance Logic. In thi.s paper an entailment relation which holds between certain

Dr. Frederick A. Johnson Department of Philosophy Colorado State University Fort Collins, Colorado 80523-23- A Three-Valued Interpretation for a Relevance Logic In thi.s paper an entailment relation which

### 22C:19 Discrete Math. So. What is it? Why discrete math? Fall 2009 Hantao Zhang

22C:19 Discrete Math Fall 2009 Hantao Zhang So. What is it? Discrete mathematics is the study of mathematical structures that are fundamentally discrete, in the sense of not supporting or requiring the

### Algorithmic Software Verification

Algorithmic Software Verification (LTL Model Checking) Azadeh Farzan What is Verification Anyway? Proving (in a formal way) that program satisfies a specification written in a logical language. Formal

### Counting Falsifying Assignments of a 2-CF via Recurrence Equations

Counting Falsifying Assignments of a 2-CF via Recurrence Equations Guillermo De Ita Luna, J. Raymundo Marcial Romero, Fernando Zacarias Flores, Meliza Contreras González and Pedro Bello López Abstract

### Knowledge base. Logical agents. A simple knowledge-based agent. Outline

Knowledge bases Inference engine domain independent algorithms ogical agents Chapter 7 Knowledge base domain specific content Knowledge base = set of sentences in a formal language Declarative approach

### The Classes P and NP

The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the

### Boolean Algebra Part 1

Boolean Algebra Part 1 Page 1 Boolean Algebra Objectives Understand Basic Boolean Algebra Relate Boolean Algebra to Logic Networks Prove Laws using Truth Tables Understand and Use First Basic Theorems

### Mathematical induction & Recursion

CS 441 Discrete Mathematics for CS Lecture 15 Mathematical induction & Recursion Milos Hauskrecht milos@cs.pitt.edu 5329 Sennott Square Proofs Basic proof methods: Direct, Indirect, Contradiction, By Cases,

### DISCRETE MATHEMATICS W W L CHEN

DISCRETE MATHEMATICS W W L CHEN c W W L Chen, 1982, 2008. This chapter originates from material used by the author at Imperial College, University of London, between 1981 and 1990. It is available free

### Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications

Formal Verification Coverage: Computing the Coverage Gap between Temporal Specifications Sayantan Das Prasenjit Basu Ansuman Banerjee Pallab Dasgupta P.P. Chakrabarti Department of Computer Science & Engineering

### Validity Checking. Propositional and First-Order Logic (part I: semantic methods)

Validity Checking Propositional and First-Order Logic (part I: semantic methods) Slides based on the book: Rigorous Software Development: an introduction to program verification, by José Bacelar Almeida,

### Foundations of Computing Discrete Mathematics Solutions to exercises for week 2

Foundations of Computing Discrete Mathematics Solutions to exercises for week 2 Agata Murawska (agmu@itu.dk) September 16, 2013 Note. The solutions presented here are usually one of many possiblities.

### Review Name Rule of Inference

CS311H: Discrete Mathematics Review Name Rule of Inference Modus ponens φ 2 φ 2 Modus tollens φ 2 φ 2 Inference Rules for Quantifiers Işıl Dillig Hypothetical syllogism Or introduction Or elimination And

### First-Order Predicate Logic (2)

First-Order Predicate Logic (2) Predicate Logic (2) Understanding first-order predicate logic formulas. Satisfiability and undecidability of satisfiability. Tautology, logical consequence, and logical

### Generalized Modus Ponens

Generalized Modus Ponens This rule allows us to derive an implication... True p 1 and... p i and... p n p 1... p i-1 and p i+1... p n implies p i implies q implies q allows: a 1 and... a i and... a n implies

### Formal Borel sets a proof-theoretic approach

1/29 Formal Borel sets a proof-theoretic approach Alex Simpson LFCS, School of Informatics University of Edinburgh, UK Formal Borel sets a proof-theoretic approach 2/29 Context of talk Domain theory Topological

### When the Web Meets Programming Languages and Databases: Foundations of XML

1 / 22 When the Web Meets Programming Languages and Databases: Foundations of XML Pierre Genevès CNRS LIG WAM May 16 th, 2008 For more than half of the fifty years computer programmers have been writing

### NP-Completeness and Cook s Theorem

NP-Completeness and Cook s Theorem Lecture notes for COM3412 Logic and Computation 15th January 2002 1 NP decision problems The decision problem D L for a formal language L Σ is the computational task:

### 4. Number Theory (Part 2)

4. Number Theory (Part 2) Terence Sim Mathematics is the queen of the sciences and number theory is the queen of mathematics. Reading Sections 4.8, 5.2 5.4 of Epp. Carl Friedrich Gauss, 1777 1855 4.3.

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 1

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 1 Course Outline CS70 is a course on Discrete Mathematics and Probability for EECS Students. The purpose of the course

### OHJ-2306 Introduction to Theoretical Computer Science, Fall 2012 8.11.2012

276 The P vs. NP problem is a major unsolved problem in computer science It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute to carry a \$ 1,000,000 prize for the

### CSI 2101 Discrete Structures Winter 2012

CSI 2101 Discrete Structures Winter 2012 Prof. Lucia Moura University of Ottawa Homework Assignment #1 (100 points, weight 5%) Due: Thursday Feb 9, at 1:00 p.m. (in lecture); assignments with lateness

### Mathematical Induction

Mathematical Induction Victor Adamchik Fall of 2005 Lecture 2 (out of three) Plan 1. Strong Induction 2. Faulty Inductions 3. Induction and the Least Element Principal Strong Induction Fibonacci Numbers