Www.sti-innsbruck.at © Copyright 2008 STI INNSBRUCK www.sti-innsbruck.at Intelligent Systems Lecture II – xx 2009 Propositional Logic Dieter Fensel and.

Slides:



Advertisements
Similar presentations
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Advertisements

Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Automated Reasoning Systems For first order Predicate Logic.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
First Order Logic Resolution
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Logic Use mathematical deduction to derive new knowledge.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Intelligent Systems Propositional Logic.
Logic.
Logic Concepts Lecture Module 11.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Introduction to Computability Theory
CSE (c) S. Tanimoto, 2008 Propositional Logic
Brief Introduction to Logic. Outline Historical View Propositional Logic : Syntax Propositional Logic : Semantics Satisfiability Natural Deduction : Proofs.
Logic in Computer Science Transparency No Chapter 3 Propositional Logic 3.6. Propositional Resolution 3.7. Natural Deduction.
Existential Graphs and Davis-Putnam April 3, 2002 Bram van Heuveln Department of Cognitive Science.
Knoweldge Representation & Reasoning
Let remember from the previous lesson what is Knowledge representation
Proof by Deduction. Deductions and Formal Proofs A deduction is a sequence of logic statements, each of which is known or assumed to be true A formal.
Intro to Discrete Structures
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Intro. to Logic CS402 Fall Propositional Calculus - Semantics (2/3) Propositional Calculus - Semantics (2/3) Moonzoo Kim CS Division of EECS Dept.
MATH 224 – Discrete Mathematics
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Of 33 lecture 12: propositional logic – part I. of 33 propositions and connectives … two-valued logic – every sentence is either true or false some sentences.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS6133 Software Specification and Verification
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Logics for Data and Knowledge Representation ClassL (part 1): syntax and semantics.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Lecture II – xx 2009 Propositional Logic Dieter Fensel and.
Chapter 1 Logic and proofs
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
CENG 424-Logic for CS Introduction Based on the Lecture Notes of Konstantin Korovin, Valentin Goranko, Russel and Norvig, and Michael Genesereth.
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
Knowledge Representation and Reasoning
The Propositional Calculus
Logics for Data and Knowledge Representation
Propositional Calculus: Boolean Algebra and Simplification
Logics for Data and Knowledge Representation
Logic Use mathematical deduction to derive new knowledge.
Back to “Serious” Topics…
Computer Security: Art and Science, 2nd Edition
Chapter 7. Propositional and Predicate Logic
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
ece 720 intelligent web: ontology and beyond
Presentation transcript:

© Copyright 2008 STI INNSBRUCK Intelligent Systems Lecture II – xx 2009 Propositional Logic Dieter Fensel and Dumitru Roman

2 Where are we? #DateTitle 1Introduction 2Propositional Logic 3Predicate Logic 4Theorem Proving, Logic Programming, and Description Logics 5Search methods 6CommonKADS 7Problem-Solving Methods 8Planning 9Agents 10Rule learning 11Inductive Logic Programming 12Formal Concept Analysis 13Neural Networks 14Semantic Web and Exam Preparation

3 Outline Motivation Technical Solution –Formulas, Models, Tableaux –Deductive Systems –Resolution Illustration by Larger Examples Extensions Summary References Note: Most of the content of this lecture is based on Chapters 1-4 of the book Mathematical Logic for Computer Science (by Mordechai Ben-Ari)

4 MOTIVATION 4

5 Logic and Deduction Logic is used to formalize deduction Deduction = derivation of true statements (called conclusions) from statements that are assumed to be true (called premises) Natural language is not precise, so the careless use of logic can lead to claims that false statements are true, or to claims that a statement is true, even tough its truth does not necessarily follow from the premises => Logic provides a way to talk about truth and correctness in a rigorous way, so that we can prove things, rather than make intelligent guesses and just hope they are correct

6 Why Propositional Logic? Propositional logic is a good vehicle to introduce basic properties of logic; used to: –Associate natural language expressions with semantic representations –Evaluate the truth or falsity of semantic representations relative to a knowledge base –Compute inferences over semantic representations One of the simplest and most common logic –The core of (almost) all other logics

7 TECHNICAL SOLUTION 7

8 What is Propositional Logic? An unambiguous formal language, akin to a programming language –Syntax: Vocabulary for expressing concepts without ambiguity –Semantics: Connection to what we're reasoning about Interpretation - what the syntax means –Reasoning: How to prove things What steps are allowed

9 Propositional Logic – Formulas, Models, Tableaux Boolean Operators Propositional Formulas Interpretations Equivalence and Substitution Satisfiability, Validity, and Consequence Semantic Tableaux –Soundness and Completeness

10 Boolean Operators Boolean type: T (true), F (false) Boolean operator: a function on the set {T,F}. These operators can be unary, binary, etc. –Since the set of Boolean values is finite, the number of possible n-place operators op(x 1,…,x n ) is finite for each n –There are 2 2 n n-place operators op(x 1,…,x n ) There are = 4 possible 1-place operators: There are = 16 possible 2-place operators:

11 Boolean Operators (cont’) Most common Boolean operators and their negations: and their definitions:

12 Propositional Formulas BNF (Backus-Naur Form) Grammars: –Rules of the form symbol ::= symbol 1 symbol 2... symbol n, or symbol ::= symbol 1 |symbol 2 |... |symbol n –symbol is a non-terminal symbol of the grammar –symbols that can never occur on the left-hand side of a grammar rule are called terminal symbols –P is the set of all propositional letters (atoms) A formula in the propositional logic is any string that can be derived from the initial non-terminal fml using the following BNF rules: 1.fml ::= p, for any p in P 2.fml ::= (¬ fml ) 3.fml ::= (fml V fml ) 4.fml ::= (fml /\ fml ) 5.fml ::= (fml → fml ) 6.fml ::= (fml ↔ fml )

13 Propositional Formulas (cont’) Derivation tree: tree representing the derivation of the formula using the BNF grammar for propositional logic Formation tree: tree representing the structure of the formula; i.e. the tree whose nodes are the connectives occurring in the formula and whose leaves are propositional variables Examples:

14 Interpretations In propositional logic, truth values are assigned to the atoms of a formula in order to evaluate the truth value of the formula An assignment is a function v : P → {T,F} v assigns a truth value to any atom in a given formula (P is the set of all propositional letters, i.e. atoms) Suppose F denotes the set of all propositional formulas. We can extend an assignment v to a function v : F → {T,F} which assigns the truth value v(A) to any formula A in F. v is called an interpretation.

15 Interpretations (cont’) Evaluation of truth values of formulas (inductive definitions):

16 Interpretations (cont’) Example: –Suppose v is an assignment for which v(p) = F,v(q) = T. –If A = (¬p → q) ↔ (p V q), what is v(A)? Solution: v(A)= v((¬p → q) ↔ (p V q)) = v(¬p → q) ↔ v(p V q) = (v(¬p) → v(q)) ↔ (v(p) V v(q)) = (¬v(p) → v(q)) ↔ (v(p) V v(q)) = (¬F → T) ↔ (F V T) = (T → T) ↔ (F V T) = T ↔ T = T

17 Equivalence and Substitution If A,B in F are such that v(A) = v(B) for all interpretations v, A is (logically) equivalent to B: A ≡ B Example: ¬p V q ≡ p → q since both formulas are true in all interpretations except when v(p) = T, v(q) = F and are false for that particular interpretation Caution: ≡ does not mean the same thing as ↔ : –A ↔ B is a formula (syntax) –A ≡ B is a relation between two formula (semantics) Theorem: A ≡ B if and only if A ↔ B is true in every interpretation; i.e. A ↔ B is a tautology.

18 Equivalence and Substitution (cont’) A is a subformula of B if it is a formula occurring within B; i.e. the formation tree for A is a subtree of the formation tree for B. –Example: The subformulas of p /\ (r ↔ p \/ ¬q) are p /\ (r ↔ p V ¬q), p, r ↔ p V ¬q, r, p V ¬q, ¬q, q Suppose A is a subformula of B, and A’ is any formula. Then, we say that B’ is a formula that results from substitution of A’ for A in B, and we write it as B’ = B{A ← A’} if we obtain B’ from B by replacing all occurrences of A in B with A’. –Example: Suppose B = (p → q) ↔ (¬q → ¬p), A = p → q, A’ = ¬p V q then,B’ = B{A ← A’} = (¬p V q) ↔ (¬q → ¬p) Theorem: Let A be a subformula of B, and let A’ be a formula such that A ≡ A’. Then B ≡ B{A ← A’}

19 Equivalence and Substitution (cont’) Examples of logically equivalent formulas Example: Simplify –Solution:

20 Satisfiability, Validity, and Consequence A propositional formula A is satisfiable iff v(A) = T in some interpretation v Such an interpretation is called a model for A. A is valid (or, a tautology), denoted |= A, iff v(A) = T, for all interpretations v A is unsatisfiable (or, contradictory) if it is false in every interpretation A is not valid (or, falsifiable), denoted |≠ A if we can find some interpretation v, such that v(A) = F

21 Satisfiability, Validity, and Consequence (cont’) Relationship between validity, satisfiability, falsifiability, and unsatisfiability:

22 Satisfiability, Validity, and Consequence (cont’) Examples: –Valid (tautology): –Not valid, but satisfiable: –False (contradiction): Theorem: (a) A is valid if and only if ¬A is unsatisfiable (b) A is satisfiable if and only if ¬A is falsifiable

23 Satisfiability, Validity, and Consequence (cont’) Suppose V is a set of formulas. An algorithm is a decision procedure for V if, given an arbitrary formula A, the algorithm terminates and returns as the answer either –’yes’ if A in V ; or –’no’, if A not in V Main Problem: Develop an algorithm which decides whether a propositional formula A is valid or not (so, the set V in this particular problem is the set of all valid propositional formulas) –Truth-Table Method: provides a decision algorithm but it is too time-consuming; in general, it requires exponential time for the majority of propositional formulas –A different approach: instead of A, consider ¬A and try to decide whether ¬A is satisfiable or not

24 Satisfiability, Validity, and Consequence (cont’) A set of formulas U = {A 1,A 2,…,A n } is satisfiable iff there exists an interpretation v such that v(A 1 ) = v(A 2 ) =…= v(A n ) = T; Such an interpretation is called a model of U –U is unsatisfiable if no such interpretation exists Relevant properties: –If U is satisfiable, then so is U − {A i } for any i = 1, 2,…, n –If U is satisfiable and B is valid, then U U {B} is also satisfiable –If U is unsatisfiable and B is any formula, U U {B} is also unsatisfiable –If U is unsatisfiable and some A i is valid, then U − {A i } is also unsatisfiable

25 Satisfiability, Validity, and Consequence (cont’) Let U be a set of formulas and A a formula. A is a (logical) consequence of U, if any interpretation v which is a model of U is also a model for A: U |= A Example: If some interpretation v is a model for the set, it must satisfy but in this interpretation, we also have

26 Satisfiability, Validity, and Consequence (cont’) A set of formulas T is a theory if it closed under logical consequence. This means that, for every formula A, if T |= A, then A is in T Let U be a set of formulas. Then, the set of all consequences of U T(U) = {A | U |=A} is called the theory of U. The formulas in U are called the axioms for the theory T(U).

27 Semantic Tableaux A more efficient method for deciding satisfiability of a propositional formula than using truth-tables Preliminary definitions: –A literal is an atom or its negation. Atom: positive literal Negation of an atom: negative literal –{p,¬p} - complementary pair of literals –{A,¬A} - complementary pair of formulas General Idea: Given a formula A, first transform it into an equivalent formula, which is a disjunction of conjunctions of literals. After this, we can analyze this new form of A to see if we can construct a truth assignment v, such that v(A) = T. If there is one, A is satisfiable; if there is no such v, A is not satisfiable.

28 Semantic Tableaux (cont’) Example of semantic tableau: Determine if B = (p \/ q) /\ (¬p /\ ¬q) is satisfiable. Since both sets of literals contain complementary pairs, neither set of literals is satisfiable, therefore it is impossible to find a model for B, i.e. B is unsatisfiable.

29 Semantic Tableaux (cont’) In order to use this method, the formula needed to be rewritten using ¬, \/, and /\ only. The method can be made more general if we eliminate also the connectives → and ↔ within a tableau:

30 Semantic Tableaux (cont’) Algorithm for construction of a semantic tableau: –INPUT: formula A –OUTPUT: a tableau T for A, all of whose leaves are marked as open or closed –Initially, T is a single node (root) labeled {A} –The tableau is built inductively, by choosing an unmarked leaf, which is labeled by a set of formulas U(l), and apply one of the following rules: If U(l) is just a set of literals, check if it contains a pair of complementary literals. If it does, mark the leaf as closed (×); if not, mark it as open (o) If U(l) is not just a set of literals, choose one formula in U(l) which is not a literal. (a) if one of the α-rules applies, replace U(l) with (U(l) − {α}) U {α 1, α 2 }. (b) if one of the β-rules applies, replace U(l) with two descendent nodes labeled (U(l) − {β}) U {β 1 } and (U(l) − {β}) U {β 2 }.

31 Semantic Tableaux (cont’) A tableau is said to be completed if its construction terminates; i.e. eventually, all branches end with leaves containing literals only –It is closed if all its leaves are closed; otherwise, we say that the tableau is open Theorem: The construction of a semantic tableau for a propositional formula always terminates. –This construction can be extended to non-atomically closed tableaux: All leaves eventually contain a pair of complementary formulas A,¬A

32 Soundness and Completeness Main Theorem: A completed semantic tableau for a formula A is closed if and only if A is unsatisfiable –Soundness: If a tableau is closed, then A is unsatisfiable –Completeness: If A is unsatisfiable, then any tableau for A is closed Relevant corollaries: –A is a satisfiable formula if and only if any tableau for A is open –A is a valid formula (tautology) if and only if a tableau for ¬ A is closed –The method of semantic tableaux is a decision procedure for the validity of formulas in propositional logic

33 Deductive Systems Deductive (Proof) System Gentzen System G Hilbert System H –Soundness and Completeness

34 Deductive (Proof) System Deductive system: 1.(finite) set of axioms 2.(finite) set of rules of inference Proof in a deductive system: A finite sequence of formulas such that each formula in the sequence is either: (a) an axiom; or (b) derived from previous formulas in the sequence using a rule of inference. The last formula A in the sequence is called a theorem ├ A Two proof systems for propositional logic: 1.Gentzen system G 2.Hilbert system H

35 Gentzen System G (cont’) The Gentzen proof system is based on the reversal of semantic tableaux Main Idea: –In order to prove that A is valid, we are trying to show that ¬A is unsatisfiable, i.e. that its semantic tableau is closed –After that, we write the proof in G by traversing the tableau from the bottom to the top, changing every formula in every node to its negation

36 Gentzen System G (cont’) Example: Prove that ├ (p /\ q) → (q /\ p) –Solution: Construct a tableau for ¬[(p /\ q) → (q /\ p)]: The corresponding proof in G :

37 Gentzen System G (cont’) Axioms: All sets of formulas containing a pair of complementary literals Rules of Inference: –α-rules: –β-rules: where the classification into α- and β-formulas is the dual of the classification for semantic tableaux:

38 Gentzen System G (cont’) Theorem: Suppose U is a set of formulas and U’ is the set of complements of formulas from U. Then ├ U in system G if and only if there is a closed semantic tableau for U’. Corollary: ├ A in system G if and only if there is a closed semantic tableau for ¬A. Theorem (Soundness and Completeness): |= A if and only if ├ G A

39 Gentzen System G (cont’) Example: Prove ├ G (A → B) → (¬B → ¬A) –Solution: A semantic tableau for ¬[(A → B) → (¬B → ¬A)]: Proof in G :

40 Hilbert System H Deductive systems for single formulas (unlike Gentzen systems which are deductive systems for sets of formulas) In Gentzen systems there is one axiom and many rules, while in Hilbert systems there are several axioms but only one rule; For any formulas A, B, C: Axioms: Rule of Inference (Modus Ponens): (Axiom 1) (Axiom 2) (Axiom 3)

41 Hilbert System H (cont’) Theorem: ├ H A → A Proof: The proof is rather complicated for such a trivial formula We can simplify proofs in system H by using “shortcuts”; namely, if we have proved a certain theorem or a rule, we can use it in later proofs  New rules of derivation (derived rules)  Most important is the Deduction Rule  Other derived rules: Contrapositive, Transitivity, Exchange of Antecedent, Double Negation, Reduction to Contradiction

42 Hilbert System H (cont’) U ├ A will mean the following: A can be proved from axioms and additional assumptions U, using Modus Ponens Deduction Rule: Theorem (Deductive rule): The deduction rule is a sound derived rule Proof: Proof is by induction on the length of the proof of

43 Hilbert System H (cont’) Contrapositive Rule: Proof: Suppose Then,

44 Hilbert System H (cont’) Theorem: Proof: The above proves the Transitivity Rule:

45 Hilbert System H (cont’) Theorem: Proof: The above proves the Exchange of Antecedent Rule:

46 Hilbert System H (cont’) Theorem: Proof: The above proves the Double Negation Rule:

47 Hilbert System H (cont’) One can prove similarly: Notation –false = any contradictory formula, e.g. ¬(p → p) –true = any valid formula, e.g. p → p Reduction to Contradiction Rule: We need to prove in H : Proof:

48 Hilbert System H (cont’) One can now introduce the remaining logical connectives /\, \/, ↔ into H as abbreviations for certain equivalent formulas that use ¬ and → only: –A /\ B means ¬(A → ¬B) –A \/ B means ¬A → B –A ↔ B means (A → B) /\ (B → A) (or: ¬((A → B) → ¬(B → A)))

49 Hilbert System H (cont’) Example: Prove Solution:

50 Example: Prove Solution: It suffices to show The other implication has an analogous proof. Hilbert System H (cont’)

51 Hilbert System H (cont’) Theorem: Hilbert system H is sound; i.e. if ├ A then |= A Proof: By induction on the length n of the proof ├A If n = 1, A is an axiom, and every axiom is a valid formula If n > 1, then A is derived from two previous lines of the proof using Modus Ponens: By inductive hypothesis: |= B, |= B → A so A must be valid, too. Theorem: Hilbert system H is complete; i.e. if |= A then ├ A

52 Hilbert System H (cont’) A set of formulas U is inconsistent if, for some formula A, U ├ A and U ├ ¬A Theorem: A set of formulas U is inconsistent if, and only if, for all formulas A, U ├ A Theorem (Compactness Theorem) An infinite set of propositional formulas U is satisfiable if and only if every finite subset of U is satisfiable

53 Resolution One desirable property of a deductive system is that it should be easy to mechanize an efficient proof It is very difficult to search for a proof in a Hilbert system because there is no obvious connection between the formula and its proof Resolution is frequently an efficient method for searching for a proof Preliminary definition: A formula is in conjunctive normal form (CNF) if it is a conjunction of disjunctions of literals –Examples: Formula in CNF: Formula not in CNF:

54 Resolution (cont’) Theorem: Every propositional formula can be transformed into an equivalent formula in CNF Proof (Algorithm): 1.Eliminate all connectives other than ¬,\/, and /\ 2.Push all negations inward using De Morgan’s laws: 3.Eliminate double negations 4.Use distributivity to eliminate conjunctions within disjunctions:

55 Resolution (cont’) Example: Transform the formula (p → q) → (¬q → ¬p) into an equivalent formula in CNF Solution:

56 Resolution (cont’) A clause is a set of literals which is assumed (implicitly) to be a disjunction of those literals –Example: Unit clause: clause with only one literal; e.g. {¬q} Clausal form of a formula: Implicit conjunction of clauses Example: Abbreviated notation: Notation: –l-literal, l c -complement of l –C-clause (a set of literals) –S-a clausal form (a set of clauses)

57 Resolution – Properties of Clausal Forms (1) If l appears in some clause of S, but l c does not appear in any clause, then, if we delete all clauses in S containing l, the new clausal form S' is satisfiable if and only if S is satisfiable Example: Satisfiability of is equivalent to satisfiability of (2) Suppose C = {l} is a unit clause and we obtain S' from S by deleting C and l c from all clauses that contain it; then, S is satisfiable if and only if S' is satisfiable Example: is satisfiable iff is satisfiable

58 Resolution – Properties of Clausal Forms (cont’) (3) If S contains two clauses C and C', such that C is a subset of C', we can delete C‘ without affecting the (un)satisfiability of S Example: is satisfiable iff is satisfiable (4) If a clause C in S contains a pair of complementary literals l, l c, then C can be deleted from S without affecting its (un)satisfiability Example: is satisfiable iff is such

59 Resolution Rule Suppose C 1,C 2 are clauses such that l in C 1, l c in C 2. The clauses C 1 and C 2 are said to be clashing clauses and they clash on the complementary literals l, l c C, the resolvent of C 1,C 2 is the clause C 1 and C 2 are called the parent clauses of C.

60 Resolution Rule (cont’) Example: The clauses clash on C 1,C 2 also clash on so, another way to find a resolvent for these two clauses is

61 Resolution (cont’) Theorem: Resolvent C is satisfiable if and only if the parent clauses C 1,C 2 are simultaneously satisfiable Resolution Algorithm: Input: S – a set of clauses Output: “S is satisfiable” or “S is not satisfiable” 1.Set S 0 := S 2.Suppose S i has already been constructed 3.To construct S i+1, choose a pair of clashing literals and clauses C 1,C 2 in S (if there are any) and derive C := Res(C 1,C 2 ) S i+1 := S i U {C} 1.If C is the empty clause, output “S is not satisfiable”; if S i+1 = S i, output “S is satisfiable” 2.Otherwise, set i := i + 1 and go back to Step 2

62 Resolution (cont’) Example: Show that (p → q) → (¬q → ¬p) is a valid formula Solution: We will show that ¬[(p → q) → (¬q → ¬p)] is not satisfiable. (1) Transform the formula into CNF: (2) Show, using resolution, that C is the empty clause A derivation of the empty clause from S is called a refutation of S

63 Resolution (cont’) Theorem: If the set of a clauses labeling the leaves of a resolution tree is satisfiable, then the clause at the root is satisfiable Theorem (Soundness): If the empty clause is derived from a set of clauses, then the set of clauses is unsatisfiable Theorem (Completeness) If a set of clauses is unsatisfiable, then the empty clause can be derived from it using resolution algorithm

64 ILLUSTRATION BY LARGER EXAMPLES 64

65 Example 1 Problem (Duality Theorem): (a) If A is a formula involving only ¬, /\ and V as its connectives, and A' results from A by replacing each /\ by V and each V by /\, show that A is valid if and only if ¬A' is valid. (b) Also, show that if A → B is valid, for some formula B which only uses ¬, /\ and V, then B' → A' is also valid. Solution: (a) We will use structural induction on A –Base Case: If A is an atom p, there is nothing to prove since the formula has no dual. –Inductive Hypothesis: Suppose B and C are formulas for which the Duality Theorem holds. Notice the following: if the inductive hypothesis holds for some formula B, then it also holds for its dual B' since B and B' have the same number of connectives. Also, for every formula B, (B')' = B.

66 Example 1 (cont’) –If A = ¬B, then A' = ¬B'. By inductive hypothesis, ¬B' is valid if and only if B is valid. By the remark above, the hypothesis also holds for B'. ¬ A' = ¬(¬B') is valid  B' is valid  ¬(B')' is valid (ind.hyp.)  ¬B = A is valid –If A = B /\ C, then A' = B' V C'. We are assuming that ¬B' is valid if and only if B is valid and the same for C. Then, A = B /\ C is valid  B,C are valid  ¬B',¬C' are valid  ¬B' /\ ¬C' is valid  ¬(B' V C') is valid  ¬A' is valid

67 Example 1 (cont’) –If A = B V C with the same assumptions on B and C as above, then A' = B' /\ C', and ¬A ' = ¬(B ' /\ C ') is valid  ¬B' V ¬C' is valid  B V C is valid (ind.hyp.)  A is valid –The inductive proof is now complete. (b) Suppose A → B is valid. This also means that ¬A V B is valid. By part (a) ¬(¬A V B)' = ¬(¬A' /\ B') ≡ A' V ¬B' will be valid, too. But A' V ¬B' ≡ B' V A' and this is precisely what is claimed in (b).

68 Example 2 Problem: Prove U |= A if and only if |= A 1 /\... /\ A n → A Solution: (=>) Suppose {A 1,..., A n } |= A Now, let v be any assignment. If at least one of the formulas A 1,..., A n is false in this assignment, we have v(A 1 /\... /\ A n → A) = F → v(A) = T On the other hand, if v is an assignment in which all formulas A 1,..., A n are true, the definition of logical consequence yields that v(A) = T as well. So, v(A 1 /\... /\ A n → A) = T /\... /\ T → T = T In either case, the implication is true, so |= A 1 /\... /\ A n → A (<=) If A 1 /\... /\ A n → A is a valid formula, then, whenever all formulas A 1,..., A n are true, the conclusion A is also true, which means that {A 1,..., A n } |= A

69 Example 3 Problem: Prove in G (a) ├ (A → B) → (¬B → ¬A) (b) ├ (A → B) → ((¬A → B) → B) (c) ├ ((A → B)) → A) → A) Solution: (a)

70 Example 3 (cont’) (b) (c) (from the book)

71 EXTENSIONS 71

72 Extensions The most immediate way to develop a more complex logical calculus is to introduce rules that are sensitive to more fine-grained details of the sentences being used –When the atomic sentences of propositional logic are broken up into terms, variables, predicates, and quantifiers, they yield first-order logic, which keeps all the rules of propositional logic and adds some new ones Modal logic also offers a variety of inferences that cannot be captured in propositional calculus –For example, from "Necessarily p" we may infer that p. From p we may infer "It is possible that p". Many-valued logics are those allowing sentences to have values other than true and false –For example, neither and both are standard "extra values“; "continuum logic" allows each sentence to have any of an infinite number of "degrees of truth" between true and false –These logics often require calculational devices quite distinct from propositional calculus

73 SUMMARY 73

74 Summary Propositional logic is one of the simplest and most common logic and is the core of (almost) all other logics This lecture focused on three core aspects of the propositional logic: –Syntax: Vocabulary for expressing concepts without ambiguity –Semantics: Connection to what we're reasoning about Interpretation - what the syntax means –Reasoning: How to prove things What steps are allowed

75 REFERENCES 75

76 References Mathematical Logic for Computer Science (2 nd edition) by Mordechai Ben-Ari – http:// Propositional Logic at The Internet Encyclopedia of Philosophy – Propositional Logic on Wikipedia – Many online resources – –

77 Next Lecture #DateTitle 1Introduction 2Propositional Logic 3Predicate Logic 4Theorem Proving, Logic Programming, and Description Logics 5Search methods 6CommonKADS 7Problem-Solving Methods 8Planning 9Agents 10Rule learning 11Inductive Logic Programming 12Formal Concept Analysis 13Neural Networks 14Semantic Web and Exam Preparation

78 Questions?