Ontologies Reasoning Components Agents Simulations Rule-Based Deduction Jacques Robin.

Slides:



Advertisements
Similar presentations
First Order Logic Logic is a mathematical attempt to formalize the way we think. First-order predicate calculus was created in an attempt to mechanize.
Advertisements

Some Prolog Prolog is a logic programming language
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
Semantics Static semantics Dynamic semantics attribute grammars
Logic Programming Automated Reasoning in practice.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Automated Reasoning Systems For first order Predicate Logic.
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)
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
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.
ISBN Chapter 3 Describing Syntax and Semantics.
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.
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.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Ontologies Reasoning Components Agents Simulations Introduction to Rule-Based Reasoning Jacques Robin.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Logical Agents Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2005.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Artificial Intelligence Chapter 17 Knowledge-Based Systems Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Describing Syntax and Semantics
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.
Ontologies Reasoning Components Agents Simulations Belief Update, Planning and the Fluent Calculus Jacques Robin.
Fall 98 Introduction to Artificial Intelligence LECTURE 7: Knowledge Representation and Logic Motivation Knowledge bases and inferences Logic as a representation.
Logical Inference 2 rule based reasoning
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 17 Wednesday, 01 October.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
The AI War LISP and Prolog Basic Concepts of Logic Programming
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.:
CSE Winter 2008 Introduction to Program Verification January 31 proofs through simplification.
Logic Programming and Prolog Goal: use formalism of first-order logic Output described by logical formula (theorem) Input described by set of formulae.
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.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
Ontologies Reasoning Components Agents Simulations Logic Programming Jacques Robin.
Programming Languages Third Edition Chapter 4 Logic Programming.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
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.
Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.
COMP 412, FALL Type Systems C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Rule-Based Reasoning Jacques Robin.
Artificial Intelligence: Agents and Propositional Logic.
Methods of Proof Chapter 7, second half.
Introduction to Rule-Based Reasoning
Representations & Reasoning Systems (RRS) (2.2)
Presentation transcript:

Ontologies Reasoning Components Agents Simulations Rule-Based Deduction Jacques Robin

Outline  Rewrite rules and systems  Abstract syntax  High-level operational semantics  Example rule bases  Special cases  Practical applications  Implementing rewrite systems in CHR   Production rules and systems  Abstract syntax  High-level operational semantics  Example rule bases  Special cases  Practical applications  Comparison with production rules  Implementing rewrite systems in CHR   Logic Programming  Abstract syntax  Declarative logical semantics  High-level operational semantics  Example rule bases  Comparison with rewrite and production rules  Practical applications  Implementing a Prolog program in CHR   Logic programming limitations  Logic programming extensions  Constraint Logic Programming  CLP and CHR 

Rewrite Rules: Abstract Syntax Rewrite Rule Base Rewrite Rule * RHS plus(X,0)  X fib(suc(suc(N)))  plus(fib(suc(N)),fib(N)) Functional Term Non-Functional Term Ground Term Non-Ground Term Function Symbol Constant Symbol Variable * args {disjoint, complete} LHS Term

Rewrite Rules: Operational Semantics : Rewrite Rule Base T : Term Unify LHS of Rewrite Rule Base against sub-terms of Term : Unifying Set of Pairs: - Instantiated Rule - Instantiated Sub-term [ Matching Pair Set Empty ] [ Matching Pair Set Singleton ] : Pair - Instantiated Rule R - Instantiated Sub-Term S Pick one Pair Set [ Else ] Substitute Sub-Term S in Term T by RHS of Rule R

Rewrite Rule Base Computation Example a)plus(X,0)  X b)plus(X,suc(Y))  suc(plus(X,Y)) c)fib(0)  suc(0) d)fib(suc(0))  suc(0) e)fib(suc(suc(N))  plus(fib(suc(N)),fib(N)) 1.fib(suc(suc(suc(0)))) w/ rule e  2.plus(fib(suc(suc(0))),fib(suc(0))) w/ rule d  3.plus(fib(suc(suc(0))),suc(0)) w/ rule b  4.suc(plus(fib(suc(suc(0))),0)) w/ rule a  5.suc(fib(suc(suc(0)))) w/ rule e  6.suc(plus(fib(suc(0)),fib(0))) w/ rule c  7.suc(plus(fib(suc(0)),suc(0))) w/ rule b  8.suc(suc(plus(fib(suc(0)),0))) w/ rule a  9.suc(suc(fib(suc(0)))) w/ rule c  10.suc(suc(suc(0)))

Conditional Rewrite Rules: Abstract Syntax Rewrite Rule Base Rewrite Rule * LHS Term RHS Condition Equation * 2 X = 0  Y = 0 | X + Y  0 Rule with matching LHS can only be fired if condition is also verified Proving condition can be recursively done by rewriting it to true

Rewrite Rule Base Deduction Example: Is West Criminal? Rewrite Rule Base: a)criminal(P)  american(P)  weapon(W)  nation(N)  hostile(N)  sells(P,N,W) b)sells(west,nono,W)  owns(nono,W)  missile(W) c)hostile(N)  enemy(N,america) d)weapon(W)  missile(W) e)owns(nono,m1)  missile(m1)  american(west)  nation(nono)  enemy(nono,america)  true f)A  B  B  A g)A  A  A Term: criminal(P) american(P)  weapon(W)  nation(N)  hostile(N)  sells(P,N,W) w/ rule a american(P)  weapon(W)  nation(N)  hostile(N)  owns(nono,W)  missile(W) w/ rule b american(P)  weapon(W)  nation(N)  enemy(N,america)  owns(nono,W)  missile(W) w/ rule c american(P)  missile(W)  nation(N)  enemy(N,america)  owns(nono,W)  missile(W) w/ rule d american(P)  missile(W)  nation(N)  enemy(N,america)  owns(nono,W) w/ rule g... w/ rule f owns(nono,W)  missile(W)  american(P)  nation(N)  enemy(N,america) w/ rule f true w/ rule e

Rewriting Systems: Practical Application  Theorem proving  CASE:  Programming language formal semantics  Program verification  Compiler design and implementation  Model transformation and automatic programming  Data integration  Using XSLT an XML-based language to rewrite XML-based data and documents  Web server pages and web services (also using XSLT)

Implementing a Rewriting System in CHR   Map each conditional rewrite system rule of the form Condition | LHS  RHS onto a CHR  simplification rule of the form LHS  Condition | RHS i.e., map the rewrite rule condition onto the CHR  guard the rewrite rule LHS onto the CHR  head the rewrite rule RHS onto the CHR  body  For example: X = 0  Y = 0 | X + Y  0 becomes X + Y  X= 0, Y = 0 | 0  But this translation is naive and not working in the general case  The inferior expressive power of uni-directional and top-level only matching of a CHR  rule head with a constraint conjunction;  as compared to rewrite systems bi-directional and recursively down to any embedded sub-level unification of a rewrite rule LHS with an expression.

Implementing a Rewriting System in CHR   Overcoming matching's mono-directionality:  Ground terms in the rewrite rules must be transformed into non-ground terms with their variable values instantiated in the CHR  rule guard;  Overcoming matching's lack of recursivity down the embedded structures:  Each rewrite rule, must be translated into a set of CHR  simplification rules, one for each embedding context in which it can be recursively unified  In the general case, this can lead to an a CHR  base that is exponentially larger than the rewrite system base  ex: r) fib(0)  suc(0) translated as: fib(X)  X = 0 | suc(X) suc(fib(X))  X = 0 | suc(suc(X)) suc(suc(fib(X)))  X = 0 | suc(suc(suc(X)))... plus(X,fib(Y))  Y = 0 | plus(X,suc(Y)) plus(fib(X),Y)  X= 0 | plus(suc(X),suc(Y))...

CHR V vs. Rewriting Systems CHR V :  Matching applied to atomic formula conjunctions  Rule head is matched with constraint store sub-set, which requires head to be more general than sub-set  Propagation rules provide further simplification opportunities Rewriting Systems:  Unification of LHS is applied recursively down to sub-terms  Rule LHS is unified with sub-term which can thus be more general than LHS  All reasoning done through rewriting (no propagation rules) Common characteristics:  Forward chains rules  Requires conflict resolution strategy to choose:  Which of several matching rules to fire  Non-monotonic reasoning due to:  Constraint retraction in Rule-Defined Constraint Store  Retraction of substituted sub-term  Tricky confluence and termination issues

Production Rules: Abstract Syntax Production Rule Base Production Rule * Arithmetic Predicate Symbol Right-Hand Side (RHS) Action * Arithmetic Constant Symbol IF (p(X,a) OR p(X,b)) AND p(Y,Z) AND q(c) AND X <> Y AND X > 3.5 THEN Z = X + 12 AND add{r(a,c,Z} AND delete{p(Y,Z)} Fact Base * Atom And-Or Formula Connective: enum{and,or} Left-Hand Side (LHS) 2..* Arithmetic Calculation Fact Base Update Operator: enum{add,delete} Predicate Symbol Non-Ground Atom Constant Symbol Variable Ground Atom Non-Functional Term args Functor

Production System Architecture Fact Base Management Component Rule Firing Policy Component Host Language API Action Execution Component Fact Base Rule Base Pattern Matching Component Candidate Rules

Production Rules: Operational Semantics [Matching Instantiated Rule Set Empty] Pick one Instantiated Rule to Fire [Else] [Matching Instantiated Rule Set Singleton] Selected Instantiated Rule Execute in Sequence Actions in RHS of Selected Instantiated Rule Match LHS of Rule Base against Fact Base Rule Base Fact Base Matching Instantiated Rule Set

Conflict Resolution Strategies  Conflict resolution strategy:  Heuristic to choose at each cycle which of the matching rule set to fire  Common strategies:  Follow writing order of rules in rule base  Follow absolute priority level annotations associated with each rule or rule class  Follow relative priority level annotations associated with pairs of rules or rule classes  Prefer rules whose LHS match the most recently derived facts in the fact base  Prefer rules that have remained for the longest time unfired while matching a fact  Apply control meta-rules that declaratively specify arbitrarily sophisticated strategies

Production Rule Base Example: Is West Criminal? Production Rule Base: IF american(P) AND weapon(W) AND nation(N) AND hostile(N) AND sell(P,N,W) THEN add{criminal(P)} IF owns(nono,W) AND missile(W) THEN add{sells(west,nono,W) IF missile(W) THEN add{weapon(W)} IF enemy(N,america) THEN add{hostile(N)} Initial Fact Base: owns(nono,m1) missile(m1) american(west) nation(nono) enemy(nono,america) nation(america)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(W)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(W)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(m1)enemy(nono,N)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(m1)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(W)enemy(nono,N)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(m1)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(m1)enemy(nono,N)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(m1)nation(N)hostile(nono)sells(P,N,W) criminal(west)? missile(W)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enemy(nono,N)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(m1)nation(N)hostile(nono)sells(P,N,W) criminal(west)? missile(m1)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enemy(nono,america)owns(nono,m1) sells(west,nono,W)

Production Rule Inference Example: Is West Criminal? criminal(P) american(P)weapon(m1)nation(N)hostile(nono)sells(P,N,W) criminal(west)? missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

Production Rule Inference Example: Is West Criminal? criminal(P) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

Production Rule Inference Example: Is West Criminal? criminal(west) weapon(m1)hostile(nono) criminal(west)? missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

Production Rule Inference Example: Is West Criminal? criminal(west) weapon(m1)hostile(nono) criminal(west)? yes missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

Properties of Production Systems  Confluence:  From confluent rule base, same final fact base is derived independently of rule firing order  Makes values of queries made to the system independent of the conflict resolution strategy  Termination:  Terminating system does not enter in an infinite loop;  Example of non-termination production rule base:  Initial fact base: p(0)  Production rule base: IF p(X) THEN Y = X + 1 AND add{p(Y)}  Any production system which conflict resolution strategy does not prevent the same rule instance to be fired in two consecutive cycles is trivially non-terminating.

Production System Inference vs. Lifted Forward Chaining Production System Inference  Sequential conjunction of actions in rule RHS  Non-monotonic reasoning due to delete actions  Matching only Datalog atoms (i.e., atoms which arguments are all non- functional terms)  Matching ground fact atoms against non-ground atoms in rule LHS And-Or atom  Neither sound nor complete inference engine Lifted Forward Chaining  Unique conclusion in Horn Clause  Monotonic reasoning  Unifying arbitrary first-order atoms, possibly functional  Unifying two arbitrary atoms, possibly both non-grounds  Sound and refutation-complete Common characteristics:  Data driven reasoning  Requires conflict resolution strategy to choose:  Which of several matching rules to fire  Which of several unifying clauses for next Modus Ponens inference step

Embedded Production System: Abstract Syntax HPL Operation HPL Ground Data Structure HPL Data Structure args * HPL Boolean Operation Right-Hand Side (RHS) Action * Fact Base Update Operator: enum{add,delete} Fact Base * Production Rule Base Production Rule * Left-Hand Side (LHS) And-Or Formula Connective: enum{and,or} 2..* HPL Boolean Operator HPL Operator

Generalized Production Rules: ECA Rules  Event-Condition-Action rule: extension of production rule with triggering event external to addition of facts in fact base  Only the rule subset which event just occurred is matched against the fact base  Events thus partition the rule base into subsets, each one specifying a behavior in response to a given events Event Condtion Action Rule Event LHS RHS Agent’s Percept HPL Boolean Operation

Production Systems: Practical Applications  Reactive agents  Expert systems in domains without complex entity taxonomy nor uncertainty  Business rules GUI Layer Data Layer Business Logic Layer Classic 3-Tier Information System Architecture Imperative OO Program Imperative OO Language SQL API Imperative OO Language GUI API Classic Imperative OO Implementation Rule-Based Implementation Imperative OO Host Language Embedded Production Rule Engine Imperative OO Language SQL API Imperative OO Language GUI API Production Rule Base Generic Component Reusable in Any Application Domain Easier to reflect frequent policy changes than imperative code

Semi-Natural Language Syntax for Production Rules  Associate key word or key phrase to:  Each domain model constant, function and predicate symbol  Each production rule syntactic construct  Each host programming language construct  Substitute in place of these constructs and symbols the associated words or phrase  Example: “Is West Criminal?” in semi-natural language syntax IF P is American AND P sells a W to N AND W is a weapon AND N is a nation AND N is hostile THEN P is a criminal IF nono owns a W AND W is a missile THEN west sells nono to W IF W is a missile THEN W is a weapon IF N is an enemy of America THEN N is hostile

Production Rules vs. Rewriting Rules Production System Inference  Fact base implicitly conjunctive  Matching only Datalog atoms (i.e., atoms which arguments are all non- functional terms)  Matching ground fact atoms against non-ground atoms in rule LHS And-Or atom Term Rewriting  Reified logical connectives in term provide full first-order expressivity  Unifying arbitrary first-order atoms, possibly functional  Unifying two arbitrary atoms, possibly both non-grounds Common characteristics:  Data driven reasoning  Requires conflict resolution strategy to choose:  Which of several matching rules to fire  Which of several rules with an LHS unifying with a sub-term  Non-monotonic reasoning due to:  Fact deletion actions in RHS  Retraction of substituted sub-term  Tricky confluence and termination issues

CHR V vs. Production Systems CHR V :  Constraint store contains arbitrary atoms including functional, non-ground atoms  Simplification rules allow straightforward modeling for goal-driven reasoning, with rewriting simulating Prolog-like backward chaining  Disjunctive bodies  Built-in backtracking search Production Systems:  Fact base only contains ground Datalog atoms  Cumbersome modeling to implement goal-driven reasoning  No disjunctions in RHS  No built-in search Common characteristics:  Forward chains rules  Requires conflict resolution strategy to choose:  Which of several matching rules to fire  Non-monotonic reasoning due to:  Constraint retraction in Rule-Defined Constraint Store  Fact retraction in the RHS  Tricky confluence and termination issues

Implementing a Production System in CHR   Map each production rule of the form: If m 1 and... and m l then a 1 and... and a n where: {a 1,..., a n } = {add(n 1 ),..., add(n i )}  {delete(o 1 ),..., delete(o j )}  {hplOp 1 (p 11,..., p 1n ),..., hplOp k (p k1,..., p km )}  onto a CHR  simpagation rule of the form: p 1,..., p r \ o 1,..., o j  hplOp 1 (p 11,..., p 1n ),..., hplOp k (p k1,..., p km ) | n 1,..., n i. where {p 1,..., p r } = {m 1,..., m l } \ {o 1,..., o j }  Valid only when:  {o 1,..., o j } \ {m 1,..., m l } = , and   C  {hplOp 1 (p 11,..., p 1n ),...,hplOp k (p k1,..., p km )},  O  {o 1,...,o j },  N  {n 1,...,n i } C occurs before O and N in a 1 and... and a n  i.e., there no direct way in CHR  to:  delete facts (ground constraints) not matched in the rule head  call host programming language operations after some matched facts have been deleted or add to the fact base (constraint store)  two possibilities allowed in production systems that make the resulting rule base operational behavior hard to comprehend, verify and maintain

Formal Logic Theory Intelligent Databases Formal Software Specification Automated Reasoning Declarative Programming Logic Programming: a Versatile Metaphor Logic Programming

Logic Programming: Key Ideas Logical Theory Software Specification Declarative Programming Automated Reasoning Intelligent Databases Logical Formula Abstract Specification Declarative Program / Data Structure Knowledge Base Database Theorem Prover Specification Verifier Interpreter / Compiler Inference Engine Query Processor Theorem Proof Specification Verification Program ExecutionInferenceQuery Execution Theorem Proving Strategy Verification Algorithm Single, Fixed, Problem-Independent Control Structure Inference Search Algorithm Query Processing Algorithm

Logic programming vision logic-based declarative semantics  Single language with logic-based declarative semantics that is: programming  A Turing-complete, general purpose programming language knowledge representation  A versatile, expressive knowledge representation language to support deduction and other reasoning services useful for intelligent agents (abduction, induction, constraint solving, belief revision, belief update, inheritance, planning) Data definition, query and update  Data definition, query and update language for databases with built-in inference capabilities  "One tool solves all" philosophy:  Any computation = resolution + unification + search  Programming = declaring logical axioms (Horn clauses)  Running the program = query about theorems provable from declared axioms  Algorithmic design entirely avoided (single, built-in control structure)  Same language for formal specification (modeling) and implementation  Same language for model checking and code testing

Prolog  First and still most widely used logic programming language  Falls short to fulfill the vision in many respect:  Many imperative constructs with no logical declarative semantics  No commercial deductive database available  Most other logic programming languages both:  Extend Prolog  Fulfill better one aspect of the logic programming vision  In the 80s, huge Japanese project tried to entirely rebuild all of computing from ground up using logic programming as hardware basis

Definite Logic Program +connective =  Definite Query +connective =  Definite Clause +connective =  clauses Pure Prolog: abstract syntax Pure Prolog Atom arg headbody 0..1 * * arg Pure Prolog Term * c 1 1 (...,X k 1,...) :- p 1 1 (...,X i 1,...),..., p m 1 (...,X j 1,...).... c 1 n (...,X k n,...) :- p 1 n (...,X i n,...),..., p m n (...,X j n,...). parent(al,jim)  parent(jim,joe)  anc(A,D)  parent(A,D)  anc(A,D)  parent(A,P)  anc(P,D) Numerical Symbol Function-Free TermFunctional Term Variable functor * Symbol predicate

Full Prolog Full Prolog Atom Full Prolog Query +connective =  Full Prologl Clause +connective =  head body 0..1 Full Prolog Program +connective =  * Semantics of full Prolog: Cannot be purely logic-based Must integrate algorithmic ones User-Defined Symbol Built-in Symbol Built-in Logical Symbol Built-in Imperative Symbol Meta-Programming Predicate Symbol Numerical Symbol I/O Predicate Symbol Program Update Predicate Symbol Search Customization Predicate Symbol Full Prolog Term Function-Free Term Functional Term Variable Symbol functor arg predicate * Prolog Literal +connective = naf arg *

Pure Prolog program declarative formal semantics  Declarative, denotational, intentional:  Clark’s transformation to CFOL formula  First-order formula semantically equivalent to program  Declarative, denotational, extentional, model-theoretic:  Least Herbrand Model  Intersection of all Herbrand Models  Conjunction of all ground formulas that are deductive consequences of program

CFOL x Prolog Semantic Assumptions Classical First-Order Predicate Logic:  No Unique Name Assumption (UNA): two distinct symbols can potentially be paraphrases to denote the same domain entity  Open-World Assumption (OWA): If KB |≠ Q but KB |≠  Q, the truth value of Q is considered unknown  Ex: KB: true  core(ai)  true  core(se)  core(C)  offered(C,T)  true  offered(mda,fall) Q: true  offered(mda,spring)  OWA necessary for monotonic, deductively sound reasoning: If KB |= T then  A, KB  A |= T Logic Programming:  UNA: two distinct symbols necessarily denote two distinct domain entities  Closed-World Assumption (CWA): If KB |≠ Q but KB |≠  Q, the truth value of Q is considered false  Ex: ?- offered(mda,spring) fail  CWA is a logically unsound form of negatively abductive reasoning  CWA makes reasoning inherently non-monotonic as one can have: KB |= T but KB  A |≠ T if the proof KB |= T included steps assuming A false by CWA  Motivation: intuitive, representational economy, consistent w/ databases

Clark’s completion semantics  Transform Pure Prolog Program P into semantically equivalent CFOL formula comp(P)  Same answer query set derived from P (abductively) than from F P (deductively)  Example P: core(se). core(ai). offered(mda,fall). offered(C,T) :- core(C). ?- offered(mda,spring) no ?-  Naive semantics naive(P):  C,T true  core(ai)  true  core(se)  true  offered(mda,fall)  core(C)  offered(C,T) naive(P) |≠  offered(mda,spring)  Clark’s completion semantics comp(P):  C,T,C 1,T 1 (core(C 1 )  (C 1 =ai  C 1 =se))  (offered(C 1,T 1 )  (C 1 =mda  T 1 =fall)  (  C,T (C 1 =C  T 1 =T  core(C))))   (ai=se)   (ai=mda)   (ai=fall)   (se=fall)   (se=mda)   (mda=fall) F p |=  offered(mda,spring)

Clark’s transformation  Axiomatizes closed-world and unique name assumptions in CFOL  Starts from naive Horn formula semantics of pure Prolog program  Partitions program in clause sets, each one defining one predicate (i.e., group together clauses with same predicate c(t 1,..., t n ) as conclusion)  Replaces each such set by a logical equivalence  One side of this equivalence contains c(X 1,..., X n ) where X 1,..., X n are fresh universally quantified variables  The other side contains a disjunction of conjunctions, one for each original clause  Each conjunction is either of the form:  X i = c i ...  X j = c i, if the original clause is a ground fact   Y i... Y j X i = Y i ...  X j = Y j  p 1 (...) ...  p n (... ) if the original clause is a rule with body p 1 (...) ...  p n (... ) containing variables Y i... Y j  Joins all resulting equivalences in a conjunction  Adds conjunction of the form  (c i = c j ) for all possible pairs (c i,c j ) of constant symbols in pure Prolog program

SLD Resolution  SLD resolution (Linear resolution with Selection function for Definite logic programs):  Joint use of goal-driven set of support and input resolution heuristics  Always pick last proven theorem clause with next untried axiom clause  Always questions last pick even if unrelated to failure that triggered backtracking  A form of goal-driven backward chaining of Horn clauses seen as deductive rules  Prolog uses special case of SLD resolution where:  Axiom clauses tried in top to bottom program writing order  Atoms to unify in the two picked clauses:  Conclusion of selected axiom clause  Next untried premise of last proven theorem clause in left to right program writing order (goal)  Unification without occur-check  Generates proof tree in top-down, depth-first manner Generates proof tree in top-down, depth-first manner  Failure triggers systematic, chronological backtracking: Failure triggers systematic, chronological backtracking  Try next alternative for last selection even if clearly unrelated to failure  Reprocess from scratch new occurrences of sub-goals previously proven true or false  Simple, intuitive, space-efficient, time-inefficient, potentially non- terminating (incomplete)

Refutation Resolution Proof Example Refutation proof principle:  To prove KB |= F  Prove logically equivalent: (KB  F) |= True  In turn logically equivalent to: (KB   F) |= False (american(P)  weapon(W)  nation(N)  hostile(N)  sells(P,N,W)  criminal(P)) //1  (T  owns(nono,m1)) //2a  (T  missile(m1)) //2b  (owns(nono,W)  missile(W)  sells(west,nono,W)) //3  (T  american(west)) //4  (T  nation(nono)) //5  (T  enemy(nono,america)) //6  (missile(W)  weapon(W)) //7  (enemy(N,america)  hostile(N)) //8  (T  nation(america)) //9  (criminal(west)  F) //0 1. Solve 0 w/ 1 unifying P/west: american(west)  weapon(W)  nation(N)  hostile(N)  sells(west,N,W)  F //10 2. Solve 10 w/ 4: weapon(W)  nation(N)  hostile(N)  sells(west,N,W)  F //11 3. Solve 11 w/ 7: missile(W)  nation(N)  hostile(N)  sells(west,N,W)  F //12 4. Solve 12 w/ 2b unifying W/m1: nation(N)  hostile(N)  sells(west,N,m1)  F //13 5. Solve 13 w/ 5 unifying N/nono: hostile(nono)  sells(west,nono,m1)  F //14 6. Solve 14 w/ 8 unifying N/nono: enemy(nono,america)  sells(west,nono,m1)  F //15 7. Solve 15 w/ 6: sells(west,nono,m1)  F //16 8. Solve 16 w/ 3 unifying W/m1: owns(nono,m1)  missile(m1)  F //17 9. Solve 17 with 2a: missile(m1)  F // Solve 18 with 2b: F

SLD resolution example criminal(P) american(P)weapon(W)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(P)weapon(W)nation(N)hostile(N)sells(P,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(W)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(W)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,W) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,W) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? yes missile(m1)enemy(nono,america)owns(nono,m1) missile(m1)american(west)nation(nono) nation(america) enermy(nono,america)owns(nono,m1) sells(west,nono,m1)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(america)sells(west,america,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(america)sells(west,america,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(america)sells(west,america,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(america)sells(west,america,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W) fail

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(america)hostile(america)sells(west,america,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W) fail backtrack

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W) backtrack

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(N)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with backtracking criminal(west) american(west)weapon(m1)nation(nono)hostile(N)sells(west,N,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

SLD resolution example with bactracking criminal(west) american(west)weapon(m1)nation(nono)hostile(nono)sells(west,nono,m1) criminal(west)? missile(m1)enemy(N,america)owns(nono,W) missile(m1)american(west) nation(nono) nation(america)enermy(nono,america)owns(nono,m1) sells(west,nono,W)

Dual use of Prolog for AI knowledge representation  As knowledge representation language programming  As Turing-complete programming language Knowledge Base: Prolog Facts and Rules Inference Engine: Prolog Compiler/ Interpreter Ask Tell Retract Knowledge Base: Sentences in formalism F Inference Engine Implementing in Prolog Reasoning R in formalism F Ask Tell Retract Inference Engine: Prolog Compiler/ Interpreter

Limitations of Pure Prolog and ISO Prolog knowledge representation For knowledge representation:  search customization:  No declarative constructs  Limited support procedimental constructs (cuts)  no support for uncertain reasoning  forces unintuitive rule-based encoding of inherently taxonomic and procedural knowledge  knowledge base updates non- backtrackable and without logical semantics  ab :- assert(a), b. if b fails, a remains as true programming For programming:  no fine-grained encapsulation  no code factoring (inheritance)  poor data structures (function symbols as only construct)  mismatch with dominant object- oriented paradigm  not integrated to comprehensive software engineering methodology  IDE not friendly enough  scarce middleware  very scarce reusable libraries or components (ex, web, graphics)  mono-thread declarative logic For declarative logic programming:  imperative numerical computation, I/O and meta-programming without logical semantics

Limitation of SLD resolution engines  Unsound: unification without occur-check  Incomplete: left-recursion  Correct ancestor Prolog program: anc(A,D) :- parent(A,D). anc(A,D) :- parent(P,D), anc(A,P).  Logically equivalent program (since conjunction is a commutative connective) that infinitely loops: anc(A,D) :- anc(A,P), parent(P,D). anc(A,D) :- parent(A,D).  Inefficient:  repeated proofs of same sub-goals  irrelevant chronological backtracking

Prolog’s imperative arithmetics fac(0,1) :- !. fac(I,O) :- I1 is I - 1, fac(I1,O1), O is I * O1. ?- fac(1,X). X = 1 ?- fac(3,X). X = 6 ?- I1 is I -1 error ?- I1 = I -1 I1 = I -1 ?- I = 2, I1 = I -1 I1 = 2 -1 ?- I = 2, I1 is I -1 I1 = 1  Arithmetic functions and predicates generate exception if queried with non-ground terms as arguments  is: requires a uninstantiated variable on the left and an arithmetic expression on the right  Relational programming property lost  Syntax more like assembly than functional ! variable assignment  is: Prolog’s sole explicit variable assignment predicate (only for arithmetics) query  =: is a bi-directional, general- purpose unification query predicate

Prolog’s redundant sub-goal proofs

Extensions of pure Prolog Pure Prolog ISO Prolog High-Order LP Functional LP Constraint LP Abductive LP Transaction LP Frame (OO) LP Preference LP Tabled LP Inductive LP XSB Aleph Flora

Constraint Logic Programming (CLP)  CSP libraries’ strengths:  Specification level, declarative programming for predefined sets of constraints over given domains  Efficient  Extensive libraries cover both finite domain combinatorial problems and infinite numerical domain optimization problems  CSP libraries’ weaknesses:  Constraint set extension can only be done externally through API using general-purpose programming language  Same problem for mixed constraint problems (ex, mixing symbolic finite domain with real variables) Prolog’s s trengths:  Allows specification level, declarative programming of arbitrary general purpose problems  A constraint is just a predicate  New constraints easily declaratively specified through user predicate definitions  Mixed-domain constraints straightforwardly defined as predicate with arguments from different domains  Prolog’s weakness:  Numerical programming is imperative, not declarative  Very inefficient at solving finite domain combinatorial problem

CLP  Integrate Prolog with constraint satisfaction and solving libraries in a single inference engine  Get the best of both worlds:  Declarative user definition of arbitrary constraints  Declarative definition of arbitrarily mixed constraints  Declarative numerical and symbolic reasoning, seamlessly integrated  Efficient combinatorial and optimization problem solving  Single language to program constraint satisfaction or solving problems and the rest of the application CLP Engine CLP Application Rule Base Prolog Engine Procedural Solver for Domain D 1 Procedural Solver for Domain D k Solver Programming Language L... Prolog/L Bridge

Implementing a Prolog Program in CHR   Map Prolog fact base of the form {f f n.}  onto a fact introduction CHR  propagation rule: facts  f 1,..., f n.  Map each set of Prolog deductive rules of the form {p(t 1 1,...,t n 1 ) :- b p(t 1 k,...,t n k ) :- b k.} that provide the intentional part of the definition for predicate p  onto a CHR  simplification rule of the form p(x 1,...,x n )  (x 1 =t 1 1,..., x n =t n 1, b 1 ) ;...; (x 1 =t 1 k,..., x n =t n k, b k ). where {x 1,...,x n } is a set of fresh variables not occurring in {t 1 1,...,t n 1,b 1,... p(t 1 k,...,t n k ), b k }  Map each set of Prolog facts of the form {p(t' 1 1,...,t' n 1 ).,..., p(t' 1 k,...,t' n k ).} that provide the extensional part of the definition for predicate p  onto a CHR  world closure propagation rule of the form p(x 1,...,x n )  (x 1 =t' 1 1,..., x n =t' n 1 ) ;...; (x 1 =t' 1 k,..., x n =t' n k ).  Valid only for pure Prolog programs

Example Prolog Program Implemented in CHR   Prolog Program father(john,mary). father(john,peter). mother(jane,mary). person(john,male). person(peter,male). person(jane,female). person(mary,female). person(paul, male). parent(P,C) :- father(P,C). parent(P,C) :- mother(P,C). sibling(C1,C2) :- not C1 = C2, parent(P,C1), parent(P,C2).  CHR  Translation facts  father(john,mary), father(john,peter), mother(jane,mary), person(john,male), person(peter,male), person(jane,female), person(mary,female), person(paul, male). parent(P,C)  father(P,C) ; mother(P,C). sibling(C1,C2)  C1  C2 | parent(P,C1), parent(P,C2). father(F,C)  (F=john,C=mary) ; (F=john,C=peter). mother(M,C)  (M=jane,C=mary). person(P,G)  (P=john, G=male) ; (P=peter, G=male) ; (P=jane, G=male) ; (P=mary, G=male) ; (P=paul, G=male).

CHR V vs. Prolog  CFOL semantics of CHR V guardless, single head simplification rule, equivalent to CFOL semantics of pure Prolog clause set sharing same conclusion (Clark's completion)  Simplification rule: sh true | b 1 1,..., b k p ;... ; b 1 1,..., b l q. w here: {X 1,..., X n } = vars(sh i ), and {Y 1,..., Y m } = vars(b 1 ...  b k ) \ {X 1,..., X n }  X 1,..., X n true  (sh   Y 1,..., Y m ((b 1 1 ...  b k p ) ...  (b 1 1 ...  b k q ))  Equivalent Prolog clauses: { sh :- b 1 1,..., b k p.,..., sh :- b 1 1,..., b l q.}  Thus, using Clark's completion, any Prolog program can be reformulated into a semantically equivalent CHR V program  CHR V extends Prolog with:  Conjunctions in the heads  Guards  Non-ground numerical constraints heads, guards and bodies  Propagation rules

CLP with CHR CLP Engine CLP Application Rule Base Prolog Engine CHR Host Programming Language L CHR Engine CHR Base for Domain D 1 Solver CHR Base for Domain D k Solver... Prolog/L Bridge

CLP with CHR  CLP Application Rule Base CHR  Host Programming Language L CHR  Engine CHR Base for Domain D 1 Solver CHR Base for Domain D k Solver...