Logic Logic can be traced back to Aristotle, and more recently to Frege who introduced predicate logic as a language for representing and reasoning about.

Slides:



Advertisements
Similar presentations
CS4026 Formal Models of Computation Part II The Logic Model Lecture 1 – Programming in Logic.
Advertisements

Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
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.
Logic Use mathematical deduction to derive new knowledge.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
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)
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Inference and Resolution for Problem Solving
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
Knowledge Representation I (Propositional Logic) CSE 473.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Knoweldge Representation & Reasoning
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
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.
Propositional Calculus Math Foundations of Computer Science.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
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.
CS 4100 Artificial Intelligence Prof. C. Hafner Class Notes Jan 19, 2012.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Pattern-directed inference systems
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
1 CMSC 471 Fall 2002 Class #10/12–Wednesday, October 2 / Wednesday, October 9.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
CS344: Introduction to Artificial Intelligence Lecture: Herbrand’s Theorem Proving satisfiability of logic formulae using semantic trees (from Symbolic.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
S P Vimal, Department of CSIS, BITS, Pilani
Propositional Calculus CS 270: Mathematical Foundations of Computer Science Jeremy Johnson.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
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.:
Propositional calculus
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Extra slides for Chapter 3: Propositional Calculus & Normal Forms Based on Prof. Lila Kari’s slides For CS2209A, 2009 By Dr. Charles Ling;
Automated reasoning with propositional and predicate logics Spring 2007, Juris Vīksna.
Propositional Logic Predicate Logic
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
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.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
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
Knowledge Representation and Reasoning
The Propositional Calculus
Propositional Calculus: Boolean Functions and Expressions
Propositional Calculus: Boolean Algebra and Simplification
Logic Use mathematical deduction to derive new knowledge.
Logic: Top-down proof procedure and Datalog
Back to “Serious” Topics…
PROPOSITIONAL LOGIC - SYNTAX-
Chapter 7. Propositional and Predicate Logic
Predicates and Quantifiers
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Presentation transcript:

Logic Logic can be traced back to Aristotle, and more recently to Frege who introduced predicate logic as a language for representing and reasoning about knowledge. There are many types of logic. Propositional logic is a simpler form of predicate logic. Other forms include modal and higher-order logics. Modal logic includes temporal, spatial, and preference logic. Propositional, predicate, temporal, and higher-order logics are relevant in the study of Formal Methods.

Syntax and Semantics A logic is specified by its syntax and semantics. Syntax is specified by a grammar, e.g. CFG, BNF. Logical semantics has two broad approaches: 1.Model Theory – for the truth value of formulae 2.Proof Theory – for reasoning using proof rules Two key properties: soundness and completeness Soundness  what is true is provable Completeness  what is provable is true

Propositional Logic Propositional Logic is a language of boolean formulae made up of variables and logical connectives such as ¬, Λ, and V. Grammar: F  Var | F Λ F | F V F | ¬ F | ( F ) Example: a Λ b V ¬ c Λ d The grammar is ambiguous WRT precedence of operators – although this is easily remedied. The above formula is interpreted as: (a Λ b) V ((¬ c) Λ d) That is, ¬ has higher precedence than Λ which in turn has higher precedence than V.

Other useful connectives The connectives  and  are useful, and stand for ‘implies’ and ‘if and only if’ respectively. They can be expressed in terms of ¬, Λ, and V. For example, P  Q is equivalent to ¬P V Q. And P  Q is equivalent to P  Q Λ Q  P which is eqvt to ¬P V Q Λ ¬Q V P. When  and  are used, they each have lower precedence that V.

Using Propositional Logic A proposition is a statement that has a truth value, i.e., it is true or false. Examples: “It is Sunday.”, “It is a holiday.” We can abstract such statements by variables. E.g.: P: It is Sunday Q: It is a holiday A statement such as “If it is Sunday then it is a holiday.” can be represented as: P  Q

Semantics: Models An Interpretation I is a mapping from the syntactic domain to a semantic domain. We assign a truth value (T or F) for each variable and we interpret the connectives in the usual way: Λ as ‘logical and’; V means ‘logical or’; etc. An Interpretation I is said to be a Model of a formula F, denoted I |= F, if F evaluates to true under the interpretation I. For propositional logic, the truth table covers all interpretations. Each row of the truth table forms one interpretation, and those rows for which the formula evaluates to true correspond to models.

Truth Table abcd a Λ b v ¬ c Λ d FFF FF FFFTT FFTFF FFTTF FTFFF …………… TTTFT TTTTT Rows that are highlighted in red correspond to models. For example, {a=F, b=F, c=F, d=T} is a model for a Λ b v ¬ c Λ d. Two other models are also highlighted: {a=b=c=T, d=F} and {a=b=c=d=T}.

Some Terminology A formula is said to be satisfiable if it has a model. A formula is inconsistent if it has no model. A formula is valid if it is true in all models. Well-known result: The satisfiability of a propositional logic formula is NP-complete. Given a conjunction of formulae, C, we say that F is a logical consequence of C, written C |= F, if every model for C is also a model for F.

Conjunctive Normal Form Propositional Logic formulae can be put into a Conjunctive Normal Form (CNF): (L 11 V … V L 1k 1 ) Λ … Λ (L n1 V … V L nk n ) where each L ij, called a literal, is either a variable V or the negation of a variable, ¬ V. A propositional logic formula can be rewritten into CNF using the following equivalences: F  G ≡ ¬ F V G ¬ (F V G) ≡ ¬ F Λ ¬ G ¬ (F Λ G) ≡ ¬ F V ¬ G F V (G Λ H) ≡ (F V G) Λ (F V H)

Clause Form The CNF is also known as the clausal form, and this is the basis for many theorem-provers. Each conjunct (L1 V … V L m ) in the CNF is referred to as a clause. A special case occurs when each clause has exactly one positive literal: (V 1 V ¬ V 2 … ¬ V m ). This is called a definite clause and it can be re-written as: V 1  V 2 Λ … Λ V m A definite clause need not have any negative literal in which case it is written just as: V 1

Resolution Theorem Proving Given two clauses (a 1 V … a i … V a m ) and (b 1 V … b j … V b n ) where a i ≡ ¬ b j for some i and j, their resolvent is the disjunction of all literals except a i and b j : (a 1 V … a i-1 V a i+1 … V a m V b 1 V … b j-1 V b j+1 … V b n ) Modus ponens is a special case of resolution: The resolvent of clauses (a) and (¬ a V b) is b.

Resolution (cont’d) A resolution proof is essentially a proof by contradiction. To prove that a formula F is a logical consequence of C, i.e., C |= F, we show that C Λ ¬ F is a contradiction, i.e., the result of applying successive resolution steps to C Λ ¬ F results in the empty clause. In the process of resolution, some simplification of clauses can be performed at each step: (i)removing repeated occurrences of a literal from a clause; (ii)deleting a clause containing a literal whose complement is not present in any clause; (iii) deleting a clause with two complementary literals.

Justifying the Simplifications 1. Removing repeated literals: Since a clause is a disjunction of literals, L V L ≡ L, and hence we can remove repeated occurrences of L 2. Deleting a clause containing a literal P whose complement is not present in any clause. We can safely assign P to be true as it would not contradict any clause. Since a clause is a disjunct of literals, if P ≡ true, the entire clause is true. 3. Deleting a clause with two complementary literals, P and ¬P. Since P V ¬P ≡ true, the entire clause is true and can be removed.

Resolution (cont’d) Multiple resolutions of two clauses are possible when more than one literal occurs in a clause has a complementary literal in another clause. This could happen at each step, and hence a resolution proof involves searching within a tree of possible choices. Example: Let C = (a V ¬ b V ¬ c) Λ b Λ c and F = a To prove C |= F, we derive a contradiction from C Λ ¬ F, as illustrated on the next slide.

An Example Consider the formula: F = (a  b Λ c) Λ b Λ c To prove F |= a, we show that F Λ ¬ a is a contradiction. In clausal form, F Λ ¬ a is: (a V ¬ b V ¬ c) Λ b Λ c Λ ¬ a

(¬ b V ¬ c) Λ b Λ c (a V ¬ c) Λ c Λ ¬ a (a V ¬ b) Λ b Λ ¬ a ¬ c Λ c¬ b Λ b ¬ c Λ ca Λ ¬ a ¬ b Λ b a Λ ¬ a F F FF F F Resolution Search Tree OR

Soundness and Completeness of Resolution Resolution is a sound and complete proof procedure for first-order logic, not just propositional logic. Thus, if some path in the search tree results in a contradiction, all paths will result in a contradiction (for propositional logic). In first-order logic, if some path results in a contradiction, there could be other paths that are infinitely long. But soundness assures us that there will not be another path that is successful. Because of the possibility of infinite paths, the search has to be carried carefully.

From Propositional to Predicate Logic Resolution is known to be a sound and complete proof strategy for propositional (as well as first-order) logic. When the clauses are all definite clauses, the search tree is less complex – this is the underlying idea behind the Prolog language execution model, which is based upon first-order (not propositional) logic. In first-order logic, we have predicates, functions, constants and variables. As a result, some paths of the search tree could be infinite (non-termination), and we need a good control strategy to find a proof if one exists.

Predicate Logic/Calculus (  x,y) parent(x,y)  father(x,y) Λ (  x,y) parent(x,y)  mother(x,y) In clausal form, it will be: (parent(x,y) V ¬ father(x,y)) Λ (parent(x,y) V ¬ mother(x,y)) Λ In Datalog notation: parent(X,Y) :- father(X,Y). parent(X,Y) :- mother(X,Y).

Datalog Datalog is an extension of propositional logic where the logical statements are given as clauses, which are of two kinds: 1. p(terms) 2. p(terms) :- p 1 (terms 1 ) /\ … /\ p n (terms n ) Terms: Comma-separated sequence of constants and/or variables. Finite number of constants.

Examples of Datalog Clauses mother(bob, mary). mother(ann, mary). mother(mark, jane). mother(mary, sue). father(bob, mark). father(ann, mark). father(mark, joe). father(mary, steve). parent(X, Y)  father(X, Y). parent(X, Y)  mother(X, Y).

Recursive Rules How do we define the grandparent relation using the parent relation? How do we define the ancestor relation?

Another Example: Graphs

Datalog Semantics Given a set of clauses, P, the semantics of P can be given as the least fixed point of T P : 2 B  2 B 2 B is the set of all possible interpretations of the predicates. Each interpretation I ⊆ B. B is called the Herbrand Base: B = { p(c 1,…c n ) : p is a predicate in P, each c i is some constant } T P (I) = { Head : Head  Body is ground instance* of some clause and Body ⊆ I } * - replacing all variables by constants.

Fixed Points and Logical Semantics The set of all interpretations, 2 B, forms a lattice under ⊆, with U and ∩ as the lub and glb respectively. T P : 2 B  2 B is monotonic (easy), hence it has a least fixed point, which we can obtain as T P ↑ k ( ∅ ) for some finite k. lfp(T P ) = smallest model for P = the set of logical consequences of P.

Smallest Model of P The term “least model” of P is similar to the concept of “least fixed point”. And a model of P is similar to a fixed point. (Good Periodical Question: Prove that every fixed point of T P is a model of P, a Datalog program.) In pure Datalog, there is no negation operator and all conclusions are “positive” facts. Hence, we can over-estimate a model without causing inconsistencies. Example: Although a model for ‘father’ will have those 4 facts, we can add a spurious fact, such as father(bob,bob), and still have a model. Of course, this will result in ‘parent’, ‘gp’, and ‘ancestor’ also having extra, spurious facts. Hence we are interested in the smallest model, or least model, of P as this coincides exactly with the set of logical consequences of P, a theorem that needs to be proved (later).

Example of T P m(bob, mary). m(ann, mary). m(mark, jane). m(mary, sue). f(bob,mark). f(ann,mark). f(mark,joe). f(mary,steve). p(X, Y) :- f(X, Y). p(X, Y) :- m(X, Y). gp(X,Y) :- p(X,Z), p(Z,Y).