C. Varela1 Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure Carlos Varela Rennselaer Polytechnic Institute November.

Slides:



Advertisements
Similar presentations
Resolution Proof System for First Order Logic
Advertisements

Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
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.
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.
Models and Propositional Logic In propositional logic, a model in general simply fixes the truth value – true or false – for every proposition symbol.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Logic Languages Source: Scott, Michael Programming Language Pragmatics 3rd Ed.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
Logic Programming Languages. Objective To introduce the concepts of logic programming and logic programming languages To introduce a brief description.
Propositional Logic. Negation Given a proposition p, negation of p is the ‘not’ of p.
C. Varela1 Programming Languages (CSCI 4430/6969) History, Syntax, Semantics, Essentials, Paradigms Carlos Varela Rennselaer Polytechnic Institute August.
Discrete Mathematics Math 6A Instructor: M. Welling.
CSE115/ENGR160 Discrete Mathematics 01/20/11 Ming-Hsuan Yang UC Merced 1.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Predicates and Quantifiers
CSE 311 Foundations of Computing I Lecture 6 Predicate Logic, Logical Inference Spring
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
ISBN Chapter 16 Logic Programming Languages.
CSCI 115 Chapter 2 Logic. CSCI 115 §2.1 Propositions and Logical Operations.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
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.
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
The Bernays-Schönfinkel Fragment of First-Order Autoepistemic Logic Peter Baumgartner MPI Informatik, Saarbrücken.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 28– Interpretation; Herbrand Interpertation 30 th Sept, 2010.
CHAPTER 15 & 16 Functional & Logic Programming Languages.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
1 Predicate (Relational) Logic 1. Introduction The propositional logic is not powerful enough to express certain types of relationship between propositions.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CSE 311 Foundations of Computing I Lecture 7 Logical Inference Autumn 2012 CSE
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
CS6133 Software Specification and Verification
Chapter 1: The Foundations: Logic and Proofs
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
Propositional Logic Predicate Logic
For Wednesday Finish reading chapter 10 – can skip chapter 8 No written homework.
Knowledge Repn. & Reasoning Lec. #5: First-Order Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2004.
1-1 An Introduction to Logical Programming Sept
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Advanced Algorithms Analysis and Design
CSNB 143 Discrete Mathematical Structures
Propositional Logic Resolution
Horn Clauses and Unification
Logical Inference: Through Proof to Truth
Logic Programming Languages
CSE 311 Foundations of Computing I
Carlos Varela Rensselaer Polytechnic Institute November 10, 2017
Horn Clauses and Unification
Horn Clauses and Unification
Horn Clauses and Unification
CSNB234 ARTIFICIAL INTELLIGENCE
Horn Clauses and Unification
Predicates and Quantifiers
Carlos Varela Rennselaer Polytechnic Institute August 30, 2007
Presentation transcript:

C. Varela1 Logic Programming (PLP 11) Predicate Calculus, Horn Clauses, Clocksin-Mellish Procedure Carlos Varela Rennselaer Polytechnic Institute November 10, 2015

C. Varela2 An Early (1971) “Conversation” USER: Cats kill mice. Tom is a cat who does not like mice who eat cheese. Jerry is a mouse who eats cheese. Max is not a mouse. What does Tom do? COMPUTER: Tom does not like mice who eat cheese. Tom kills mice. USER: Who is a cat? COMPUTER: Tom. USER: What does Jerry eat? COMPUTER: Cheese. USER: Who does not like mice who eat cheese? COMPUTER: Tom. USER: What does Tom eat? COMPUTER: What cats who do not like mice who eat cheese eat.

C. Varela3 Another Conversation USER: Every psychiatrist is a person. Every person he analyzes is sick. Jacques is a psychiatrist in Marseille. Is Jacques a person? Where is Jacques? Is Jacques sick? COMPUTER: Yes. In Marseille. I don’t know.

C. Varela4 Logic programming A program is a collection of axioms, from which theorems can be proven. A goal states the theorem to be proved. A logic programming language implementation attempts to satisfy the goal given the axioms and built-in inference mechanism.

C. Varela5 Propositional Logic Assigning truth values to logical propositions. Formula syntax: f ::= v symbol |f  f and |f  f or |f  f if and only if |f  f implies |  f not

C. Varela6 Truth Values To assign a truth values to a propositional formula, we have to assign truth values to each of its atoms (symbols). Formula semantics: aba  ba  b a  ba  b a  ba  ba  ba  b  a a False FFTTT TrueFTFTT FalseFTFFF True TTTTF

C. Varela7 Tautologies A tautology is a formula, true for all possible assignments. For example:  p  p The contrapositive law: (p  q)  (  q   p) De Morgan’s law:  (p  q)  (  p   q)

C. Varela8 First Order Predicate Calculus Adds variables, terms, and (first-order) quantification of variables. Predicate syntax: a::=p(v 1, v 2,…,v n ) predicate f ::= a atom |v = p(v 1, v 2,…,v n ) equality |v 1 = v 2 |f  f | f  f | f  f | f  f |  f |  v.f universal quantifier |  v.f existential quantifier

C. Varela9 Predicate Calculus In mathematical logic, a predicate is a function that maps constants or variables to true and false. Predicate calculus enables reasoning about propositions. For example:  C [rainy(C)  cold(C)  snowy(C)] Quantifier ( ,  ) Operators ( , , , ,  )

C. Varela10 Quantifiers Universal (  ) quantifier indicates that the proposition is true for all variable values. Existential (  ) quantifier indicates that the proposition is true for at least one value of the variable. For example:  A  B [(  C [ takes(A,C)  takes(B,C)])  classmates(A,B) ]

C. Varela11 Structural Congruence Laws P 1  P 2   P 1  P 2  X [P(X)]   X [  P(X)]  X [P(X)]   X [  P(X)]  (P 1  P 2 )   P 1   P 2  (P 1  P 2 )   P 1   P 2  P  P (P 1  P 2 )  (P 1  P 2 )  (P 2  P 1 ) P 1  (P 2  P 3 )  (P 1  P 2 )  (P 1  P 3 ) P 1  (P 2  P 3 )  (P 1  P 2 )  (P 1  P 3 ) P 1  P 2  P 2  P 1

C. Varela12 Clausal Form Looking for a minimal kernel appropriate for theorem proving. Propositions are transformed into normal form by using structural congruence relationship. One popular normal form candidate is clausal form. Clocksin and Melish (1994) introduce a 5-step procedure to convert first-order logic propositions into clausal form.

C. Varela13 Clocksin and Melish Procedure 1.Eliminate implication (  ) and equivalence (  ). 2.Move negation (  ) inwards to individual terms. 3.Skolemization: eliminate existential quantifiers (  ). 4.Move universal quantifiers (  ) to top-level and make implicit, i.e., all variables are universally quantified. 5.Use distributive, associative and commutative rules of , , and , to move into conjuctive normal form, i.e., a conjuction of disjunctions (or clauses.)

C. Varela14 Example  A [  student(A)  (  dorm_resident(A)   B [takes(A,B)  class(B)])] 1.Eliminate implication (  ) and equivalence (  ).  A [student(A)  (  dorm_resident(A)   B [takes(A,B)  class(B)])] 2.Move negation (  ) inwards to individual terms.  A [student(A)  (  dorm_resident(A)   B [  (takes(A,B)  class(B))])]  A [student(A)  (  dorm_resident(A)   B [  takes(A,B)   class(B)])]

C. Varela15 Example Continued  A [student(A)  (  dorm_resident(A)   B [  takes(A,B)   class(B)])] 3.Skolemization: eliminate existential quantifiers (  ). 4.Move universal quantifiers (  ) to top-level and make implicit, i.e., all variables are universally quantified. student(A)  (  dorm_resident(A)  (  takes(A,B)   class(B))) 5.Use distributive, associative and commutative rules of , , and , to move into conjuctive normal form, i.e., a conjuction of disjunctions (or clauses.) (student(A)   dorm_resident(A))  (student(A)   takes(A,B)   class(B))

C. Varela16 Horn clauses A standard form for writing axioms, e.g.: father(X,Y)  parent(X,Y), male(X). The Horn clause consists of: –A head or consequent term H, and –A body consisting of terms B i H  B 0, B 1, …, B n The semantics is: « If B 0, B 1, …, and B n, then H »

C. Varela17 Clausal Form to Prolog (student(A)   dorm_resident(A))  (student(A)   takes(A,B)   class(B)) 6.Use commutativity of  to move negated terms to the right of each clause. 7. Use P 1   P 2  P 2  P 1  P 1  P 2 (student(A)  dorm_resident(A))  (student(A)   (  takes(A,B)   class(B))) 6.Move Horn clauses to Prolog: student(A) :- dorm_resident(A). student(A) :- takes(A,B),class(B).

C. Varela18 Skolemization  X [takes(X,cs101)  class_year(X,2)] introduce a Skolem constant to get rid of existential quantifier (  ): takes(x,cs101)  class_year(x,2)  X [  dorm_resident(X)   A [campus_address_of(X,A)]] introduce a Skolem function to get rid of existential quantifier (  ):  X [  dorm_resident(X)  campus_address_of(X,f(X)]

C. Varela19 Limitations If more than one non-negated (positive) term in a clause, then it cannot be moved to a Horn clause (which restricts clauses to only one head term). If zero non-negated (positive) terms, the same problem arises (Prolog’s inability to prove logical negations). For example: –« every living thing is an animal or a plant » animal(X)  plant(X)   living(X) animal(X)  plant(X)  living(X)

C. Varela20 Exercises 72.What is the logical meaning of the second Skolemization example if we do not introduce a Skolem function? 73.Convert the following predicates into Conjunctive Normal Form, and if possible, into Horn clauses: a)  C [rainy(C)  cold(C)  snowy(C)] b)  C [  snowy(C)] c)   C [ snowy(C)] 74.PLP Exercise 11.5 (pg 571). 75.PLP Exercise 11.6 (pg 571).