Some Prolog Prolog is a logic programming language

Slides:



Advertisements
Similar presentations
Inference in First-Order Logic
Advertisements

Artificial Intelligence 8. The Resolution Method
Artificial Intelligence
First-Order Logic.
Russell and Norvig Chapter 7
Inference Rules Universal Instantiation Existential Generalization
Standard Logical Equivalences
ITCS 3153 Artificial Intelligence Lecture 15 First-Order Logic Chapter 9 Lecture 15 First-Order Logic Chapter 9.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Artificial Intelligence
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.
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.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
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.
Logic Use mathematical deduction to derive new knowledge.
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Propositional Logic Reading: C , C Logic: Outline Propositional Logic Inference in Propositional Logic First-order logic.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Resolution in Propositional and First-Order Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Inference in First-Order Logic
Artificial Intelligence
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Inference is a process of building a proof of a sentence, or put it differently inference is an implementation of the entailment relation between sentences.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Inference in First-Order logic Department of Computer Science & Engineering Indian Institute of Technology Kharagpur.
Logical Inference 2 rule based reasoning
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.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
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.:
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Computing & Information Sciences Kansas State University Monday, 25 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 14 of 42 Monday, 25 September.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
Artificial Intelligence 7. Making Deductive Inferences Course V231 Department of Computing Imperial College, London Jeremy Gow.
1 Inference in First Order Logic CS 171/271 (Chapter 9) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Propositional Logic Predicate Logic
© 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.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
CS.462 Artificial Intelligence SOMCHAI THANGSATHITYANGKUL Lecture 05 : Knowledge Base & First Order Logic.
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
For Friday Finish chapter 9 Program 1 due. Program 1 Any questions?
CS 416 Artificial Intelligence Lecture 13 First-Order Logic Chapter 9 Lecture 13 First-Order Logic Chapter 9.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
EA C461 Artificial Intelligence
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Artificial Intelligence
Methods of Proof Chapter 7, second half.
RESOLUTION.
Presentation transcript:

Some Prolog Prolog is a logic programming language Used for implementing logical representations and for drawing inference We will do: Some examples of Prolog for motivation Generalized Modus Ponens, Unification, Resolution Wumpus World in Prolog

Inference in First-Order Logic Need to add new logic rules above those in Propositional Logic Universal Elimination Existential Elimination (Person1 does not exist elsewhere in KB) Existential Introduction

Example of inference rules “It is illegal for students to copy music.” “Joe is a student.” “Every student copies music.” Is Joe a criminal? Knowledge Base:

Example cont... Universal Elimination Existential Elimination Modus Ponens Example partially borrowed from http://sern.ucalgary.ca/courses/CPSC/533/W99/presentations/L1_9A_Chow_Low/main.html

How could we build an inference engine? Software system to try all inferences to test for Criminal(Joe) A very common behavior is to do: And-Introduction Universal Elimination Modus Ponens

Example of this set of inferences 4 & 5 Generalized Modus Ponens does this in one shot

Substitution A substitution s in a sentence binds variables to particular values Examples:

Unification A substitution s unifies sentences p and q if ps = qs. p q Knows(John,x) Knows(John,Jane) Knows(y,Phil) Knows(y,Mother(y))

Unification p q s Knows(John,x) Knows(John,Jane) {x/Jane} Knows(y,Phil) {x/Phil,y/John} Knows(y,Mother(y)) {y/John, x/Mother(John)} Use unification in drawing inferences: unify premises of rule with known facts, then apply to conclusion If we know q, and Knows(John,x)  Likes(John,x) Conclude Likes(John, Jane) Likes(John, Phil) Likes(John, Mother(John))

Generalized Modus Ponens Two mechanisms for applying binding to Generalized Modus Ponens Forward chaining Backward chaining

Forward chaining Start with the data (facts) and draw conclusions When a new fact p is added to the KB: For each rule such that p unifies with a premise if the other premises are known add the conclusion to the KB and continue chaining

Forward Chaining Example

Backward Chaining Start with the query, and try to find facts to support it When a query q is asked: If a matching fact q’ is known, return unifier For each rule whose consequent q’ matches q attempt to prove each premise of the rule by backward chaining Prolog does backward chaining

Backward Chaining Example

Completeness in first-order logic A procedure is complete if and only if every sentence a entailed by KB can be derived using that procedure Forward and backward chaining are complete for Horn clause KBs, but not in general

Example

Resolution Resolution is a complete inference procedure for first order logic Any sentence a entailed by KB can be derived with resolution Catch: proof procedure can run for an unspecified amount of time At any given moment, if proof is not done, don’t know if infinitely looping or about to give an answer Cannot always prove that a sentence a is not entailed by KB First-order logic is semidecidable

Resolution

Resolution Inference Rule

Resolution Inference Rule In order to use resolution, all sentences must be in conjunctive normal form bunch of sub-sentences connected by “and”

Converting to Conjunctive Normal Form (briefly)

Example: Using Resolution to solve problem

Sample Resolution Proof

What about Prolog? (10.3) Only Horn clause sentences semicolon (“or”) ok if equivalent to Horn clause Negation as failure: not P is considered proved if system failes to prove P Backward chaining with depth-first search Order of search is first to last, left to right Built in predicates for arithmetic X is Y*Z+3 Depth-first search could result in infinite looping

Some more Prolog Bounded depth first search Cut

Theorem Provers (10.4) Theorem provers are different from logic programming languages Handle all first-order logic, not just Horn clauses Can write logic in any order, no control issue

Sample theorem prover: Otter Define facts (set of support) Define usable axioms (basic background) Define rules (rewrites or demodulators) Heuristic function to control search Sample heuristic: small and simple statements are better OTTER works by doing best first search http://www-unix.mcs.anl.gov/AR/sobb/ Boolean algebras