WFSX programming Prolog programming style, but with the WFSX semantics Requires: –A new proof procedure (different from SLDNF), complying with WFS, and.

Slides:



Advertisements
Similar presentations
SLD-resolution Introduction Most general unifiers SLD-resolution
Advertisements

Logic Programming Automated Reasoning in practice.
Justification-based TMSs (JTMS) JTMS utilizes 3 types of nodes, where each node is associated with an assertion: 1.Premises. Their justifications (provided.
1 Introduction to Prolog References: – – Bratko, I., Prolog Programming.
The coherence principle Generalizing WFS in the same way yields unintuitive results: pacifist(X)  not hawk(X) hawk(X)  not pacifist(X) ¬ pacifist(a)
Default Reasoning the problem: in FOL, universally-quantified rules cannot have exceptions –  x bird(x)  can_fly(x) –bird(tweety) –bird(opus)  can_fly(opus)
Converting formulas into a normal form Consider the following FOL formula stating that a brick is an object which is on another object which is not a pyramid,
Knowledge Representation CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
A rewritting method for Well-Founded Semantics with Explicit Negation Pedro Cabalar University of Corunna, SPAIN.
For Friday Finish chapter 10 No homework (get started on program 2)
Cs774 (Prasad)L7Negation1 Negation by Failure
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
1 Programming with Constraints Jia-Huai You Constraint programming languages - based on non-monotonic logic - Answer set programming (ASP) Knowledge Representation.
The idea of completion In LP one uses “if” but mean “iff” [Clark78] This doesn’t imply that -1 is not a natural number! With this program we mean: This.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Default and Cooperative Reasoning in Multi-Agent Systems Chiaki Sakama Wakayama University, Japan Programming Multi-Agent Systems based on Logic Dagstuhl.
Inference and Resolution for Problem Solving
Tabling To guarantee termination in non-ground programs, instead of ancestors and pruning rules, tabulation mechanisms are required –when there is a possible.
Proof System HY-566. Proof layer Next layer of SW is logic and proof layers. – allow the user to state any logical principles, – computer can to infer.
Extended LPs In Normal LPs all the negative information is implicit. Though that’s desired in some cases (e.g. the database with flight connections), sometimes.
Winter 2004/5Pls – inductive – Catriel Beeri1 Inductive Definitions (our meta-language for specifications)  Examples  Syntax  Semantics  Proof Trees.
1 Chapter 9 Rules and Expert Systems. 2 Chapter 9 Contents (1) l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
1 Knowledge Representation and Reasoning  Representação do Conhecimento e Raciocínio José Júlio Alferes.
ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
1 CILOG User Manual Bayesian Networks Seminar Sep 7th, 2006.
Application of Logic Programming and Updates for the Semantic Web Luís Moniz Pereira Dresden, November 2003.
Artificial Intelligence Chapter 17 Knowledge-Based Systems Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf.
Reasoning with Logic Programming Luís Moniz Pereira José Júlio Alferes Utrecht, August 1999.
CS 211 RECURSION TREES. Trees versus Linked Lists A tree is like a linked list, except instead of a single next node, it can have multiple next nodes.
CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences.
DEDUCTIVE DATABASE.
1 Knowledge Based Systems (CM0377) Lecture 13 (Last modified 2nd May 2002)
For Friday Exam 1. For Monday No reading Take home portion of exam due.
Learning by Answer Sets Chiaki Sakama Wakayama University, Japan Presented at AAAI Spring Symposium on Answer Set Programming, March 2001.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
For Wednesday Read chapter 13 Homework: –Chapter 10, exercise 5 (part 1 only, don’t redo) Progress for program 2 due.
CS 415 – A.I. Slide Set 5. Chapter 3 Structures and Strategies for State Space Search – Predicate Calculus: provides a means of describing objects and.
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.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
For Friday Read Homework: –Chapter 10, exercise 22 I strongly encourage you to tackle this together. You may work in groups of up to 4 people.
Kansas State University Department of Computing and Information Sciences CIS 730: Introduction to Artificial Intelligence Lecture 18 of 41 Friday, 01 October.
KR A Principled Framework for Modular Web Rule Bases and its Semantics Anastasia Analyti Institute of Computer Science, FORTH-ICS, Greece Grigoris.
April 3rd, 1998TAPD'98. Paris 2-3 April, Tabling Abduction José Alferes and Luís Moniz Pereira Univ. Évora and CENTRIA CENTRIA Univ. Nova Lisboa.
For Friday Read Chapter 11, sections 1 and 2 Homework: –Chapter 10, exercises 1 and 5.
NMR98 - Logic Programming1 Learning with Extended Logic Programs Evelina Lamma (1), Fabrizio Riguzzi (1), Luís Moniz Pereira (2) (1)DEIS, University of.
Inverse Entailment in Nonmonotonic Logic Programs Chiaki Sakama Wakayama University, Japan.
1 Knowledge Based Systems (CM0377) Introductory lecture (Last revised 28th January 2002)
For Wednesday Read chapter 13 No homework. Program 2 Any questions?
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
DEDUCTION PRINCIPLES AND STRATEGIES FOR SEMANTIC WEB Chain resolution and its fuzzyfication Dr. Hashim Habiballa University of Ostrava.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Knowledge Representation Fall 2013 COMP3710 Artificial Intelligence Computing Science Thompson Rivers University.
Reasoning with Logic Programming Luís Moniz Pereira José Júlio Alferes Utrecht, August 1999.
1 Section 9.2 Logic Programming A logic program is a set of clauses with the restriction that there is exactly one positive literal in each clause. Such.
Formal Semantics of Programming Languages 虞慧群 Topic 2: Operational Semantics.
1 Section 7.1 First-Order Predicate Calculus Predicate calculus studies the internal structure of sentences where subjects are applied to predicates existentially.
Logic Programming Lecture 2: Unification and proof search.
Knowledge Representation
Limitations of First-Order Logic
Knowledge-Based Systems Chapter 17.
Knowledge Representation
Answer Set Programming
Presentation transcript:

WFSX programming Prolog programming style, but with the WFSX semantics Requires: –A new proof procedure (different from SLDNF), complying with WFS, and with explicit negation –The corresponding Prolog-like implementation: XSB-Prolog

SLX: Proof procedure for WFSX SLX (SL with eXplicit negation) is a top-down procedure for WFSX Is similar to SLDNF –Nodes are either successful or failed –Resolution with program rules and resolution of default literals by failure of their complements are as in SLDNF In SLX, failure doesn’t mean falsity. It simply means non-verity (i.e. false or undefined)

Success and failure A finite tree is successful if its root is successful, and failed if its root is failed The status of a node is determined by: –A leaf labeled with an objective literal is failed –A leaf with true is successful –An intermediate node is successful if all its children are successful, and failed otherwise (i.e. at least one of its children is failed)

Negation as Failure? As in SLS, to solve infinite positive recursion, infinite trees are (by definition) failed Can a NAF rule be used? YES True of not A succeeds if true-or-undefined of A fails True-or-undefined of not A succeeds if true of A fails This is the basis of SLX. It defines: –T-Trees for proving truth –TU-Trees for proving truth or undefinedness

T and TU-trees They differ in that literals involved in recursion through negation, and so undefined in WFSXp, are failed in T-Trees and successful in TU-Trees a  not b b  not a … b not a TU b not a TU a not b T a T X X X X

Explicit negation in SLX ¬-literals are treated as atoms To impose coherence, the semi-normal program is used in TU-trees a  not b b  not a ¬a b not a X a not b not ¬a ¬a¬a true X b not a ¬a¬a true … X X a not b not ¬a X

Explicit negation in SLX (2) In TU-trees: L also fails if ¬L succeeds true I.e. if not ¬L fail as true-or-undefined c  not c b  not c ¬b a  b not a X ¬b¬b true c not c ¬a¬a b not ¬b a not ¬a X X X c not c c c c … X X X X X X

T and TU-trees definition D T-Trees (resp TU-trees) are AND-trees labeled by literals, constructed top-down from the root by expanding nodes with the rules Nodes labeled with objective literal A If there are no rules for A, the node is a leaf Otherwise, non-deterministically select a rule for A A  L 1,…,L m, not L m+1,…, not L n In a T-tree the children of A are L 1,…,L m, not L m+1,…, not L n In a TU-tree A has, additionally, the child not ¬A Nodes labeled with default literals are leafs

Success and Failure D All infinite trees are failed. A finite tree is successful if its root is successful and failed if its root is failed. The status of nodes is determined by: A leaf node labeled with true is successful A leaf node labeled with an objective literal is failed A leaf node of a T-tree (resp. TU) labeled with not A is successful if all TU- trees (resp. T) with root A (subsidiary tree) are failed; and failed otherwise An intermediate node is successful if all its children are successful; and failed otherwise After applying these rules, some nodes may remain undetermined (recursion through not). Undetermined nodes in T-trees (resp.TU) are by definition failed (resp. successful)

Properties of SLX SLX is sound and (theoretically) complete wrt WFSX. If there is no explicit negation, SLX is sound and (theoretically) complete wrt WFS. See [AP96] for the definition of a refutation procedure based on the AND-trees characterization, and for all proofs and details

Infinite trees example s  not p, not q, not r p  not s, q, not r q  r, not p r  p, not q WFM is {s, not p, not q, not r} not pnot qnot r s X p q not s r not q not r r not p p q not snot r r not p p not q X X q r not p p not q q not snot r

Negative recursion example q  not p(0), not s p(N)  not p(s(N)) s  true WFM = {s, not q} … not q p(0) not p(1) not p(0) q not s X X p(1) not p(2) p(2) not p(3) X X X X s true not p(0) … p(1) not p(2) p(0) not p(1) X X X p(2) not p(3)

Guaranteeing termination The method is not effective, because of loops To guarantee termination in ground programs: Local ancestors of node n are literals in the path from n to the root, exclusive of n Global ancestors are assigned to trees: the root tree has no global ancestors the global ancestors of T, a subsidiary tree of leaf n of T’, are the global ancestors of T’ plus the local ancestors of n global ancestors are divided into those occurring in T-trees and those occurring in TU-trees

Pruning rules For cyclic positive recursion: Rule 1 If the label of a node belongs to its local ancestors, then the node is marked failed, and its children are ignored For recursion through negation: Rule 2 If a literal L in a T-tree occurs in its global T-ancestors then it is marked failed and its children are ignored

Rule 2Rule 1 Pruning rules (2) L L L L …

Other sound rules Rule 3 If a literal L in a T-tree occurs in its global TU-ancestors then it is marked failed, and its children are ignored Rule 4 If a literal L in a TU-tree occurs in its global T-ancestors then it is marked successful, and its children are ignored Rule 5 If a literal L in a TU-tree occurs in its global TU-ancestors then it is marked successful, and its children are ignored

Pruning examples a  not b b  not a ¬a b not a X a not b not ¬a ¬a¬a true X c  not c b  not c ¬b a  b not a X ¬b¬b true c not c ¬a¬a b not ¬b a not ¬a X X X X X Rule 3 b Rule 2 X

Non-ground case The characterization and pruning rules apply to allowed non-ground programs, with ground queries It is well known that pruning rules do not generalize to general programs with variables: p(X)  p(Y) p(a) p(X) p(Y) What to do? p(Z) If “fail”, the answers are incomplete If “proceed” then loop

Tabling To guarantee termination in non-ground programs, instead of ancestors and pruning rules, tabulation mechanisms are required –when there is a possible loop, suspend the literal and try alternative solutions –when a solution is found, store it in a table –resume suspended nodes with new solutions in the table –apply an algorithm to determine completion of the process, i.e. when no more solutions exist, and fail the corresponding suspended nodes

Tabling example SLX is also implemented with tabulation mechanisms It uses XSB-Prolog tabling implementation SLX with tabling is available with XSB-Prolog from Version 2.0 onwards Try it at: p(X)  p(Y) p(a) p(X) p(Y) 1) suspend X = a 2) resume Y = a X = _ Table for p(X)

Tabling (cont.) If a solution is already stored in a table, and the predicate is called again, then: –there is no need to compute the solution again –simply pick it from the table! This increases efficiency. Sometimes by one order of magnitude.

A methodology for KR WFSXp provides mechanisms for representing usual KR problems: –logic language –non-monotonic mechanisms for defaults –forms of explicitly representing negation –paraconsistency handling –ways of dealing with undefinedness In what follows, we propose a methodology for representing (incomplete) knowledge of taxonomies with default rules using WFSXp

Representation method (1) Definite rules If A then B: –B  A penguins are birds: bird(X)  penguin(X) Default rules Normally if A then B: –B  A, rule_name, not ¬ B rule_name  not ¬ rule_name birds normally fly:fly(X)  bird(X), bf(X), not ¬fly(X) bf(X)  not ¬bf(X)

Representation method (2) Exception to default rules Under conditions COND do not apply rule RULE: –¬ RULE  COND Penguins are an exception to the birds-fly rule ¬bf(X)  penguin(X) Preference rules Under conditions COND prefer rule RULE + to RULE - : –¬ RULE -  COND, RULE + for penguins, prefer the penguins-don’t-fly to the birds-fly rule: ¬bf(X)  penguin(X), pdf(X)

Representation method (3) Hypotethical rules “If A then B” may or not apply: –B  A, rule_name, not ¬ B rule_name  not ¬ rule_name ¬ rule_name  not rule_name quakers might be pacifists: pacifist(X)  quaker(X), qp(X), not ¬pacifist(X) qp(X)  not ¬qp(X) ¬qp(X)  not qp(X) For a quaker, there is a PSM with pacifist, another with not pacifist. In the WFM pacifist is undefined

Taxonomy example Mammal are animal Bats are mammals Birds are animal Penguins are birds Dead animals are animals Normally animals don’t fly Normally bats fly Normally birds fly Normally penguins don’t fly Normally dead animals don’t fly The taxonomy: Pluto is a mammal Joe is a penguin Tweety is a bird Dracula is a dead bat The elements: Dead bats don’t fly though bats do Dead birds don’t fly though birds do Dracula is an exception to the above In general, more specific information is preferred The preferences:

The taxonomy flies animal bird penguin mammal bat dead animal plutotweetydraculajoe Definite rules Default rules Negated default rules

Taxonomy representation Taxonomy animal(X)  mammal(X) mammal(X)  bat(X) animal(X)  bird(X) bird(X)  penguin(X) deadAn(X)  dead(X) Default rules ¬flies(X)  animal(X), adf(X), not flies(X) adf(X)  not ¬adf(X) flies(X)  bat(X), btf(X), not ¬flies(X) btf(X)  not ¬btf(X) flies(X)  bird(X), bf(X), not ¬flies(X) bf(X)  not ¬bf(X) ¬flies(X)  penguin(X), pdf(X), not flies(X) pdf(X)  not ¬pdf(X) ¬flies(X)  deadAn(X), ddf(X), not flies(X) ddf(X)  not ¬ddf(X) Facts mammal(pluto). bird(tweety). deadAn(dracula). penguin(joe). bat(dracula). Explicit preferences ¬btf(X)  deadAn(X), bat(X), r1(X) r1(X)  not ¬r1(X) ¬btf(X)  deadAn(X), bird(X), r2(X) r2(X)  not ¬r2(X) ¬r1(dracula) ¬r2(dracula) Implicit preferences ¬adf(X)  bat(X), btf(X) ¬adf(X)  bird(X), bf(X) ¬bf(X)  penguin(X), pdf(X)

Taxonomy results Joedraculaplutotweety deadAnnot  batnot  penguin  not mammalnot  bird  not  animal  adf  ¬  ¬ btf  ¬  bf¬  pdf  ddf  ¬  r1  ¬  r2  ¬  flies¬  ¬ 