LP attracted two kinds of enthousiasts engineers/programmers \Never had I experienced such ease in getting a complex program coded and running" D.H.D.

Similar documents
arxiv:cs/ v1 [cs.ai] 8 Mar 2000

Constraint Solving. Systems and Internet Infrastructure Security

Data Integration: Logic Query Languages

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

has to choose. Important questions are: which relations should be dened intensionally,

Programming Systems in Artificial Intelligence Introduction

Lecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques

Building a Knowledge Base System for an integration of Logic Programming and Classical Logic

8. Negation 8-1. Deductive Databases and Logic Programming. (Sommer 2017) Chapter 8: Negation

Constructive negation with the well-founded semantics for CLP

under the well-founded semantics, namely (a) to ensure that negative We present ecient incremental algorithms for maintaining positive and

COMP4418 Knowledge Representation and Reasoning

Resolution (14A) Young W. Lim 6/14/14

Operational Semantics

Tabled Resolution. CSE 595 Semantic Web Instructor: Dr. Paul Fodor Stony Brook University

Towards a Logical Reconstruction of Relational Database Theory

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

sketchy and presupposes knowledge of semantic trees. This makes that proof harder to understand than the proof we will give here, which only needs the

Lecture 9: Datalog with Negation

Declarative Programming. 2: theoretical backgrounds

Classical Negation in Logic Programs and

Logic Programming and Resolution Lecture notes for INF3170/4171

Chapter 16. Logic Programming. Topics. Unification. Resolution. Prolog s Search Strategy. Prolog s Search Strategy

HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING

Logic Languages. Hwansoo Han

Description Logics Reasoning Algorithms Concluding Remarks References. DL Reasoning. Stasinos Konstantopoulos. IIT, NCSR Demokritos

Logic Programming and Reasoning about Actions

MAX-PLANCK-INSTITUT F UR. Ordered Semantic Hyper-Linking. David A. Plaisted. MPI{I{94{235 August 1994 INFORMATIK. Im Stadtwald. D Saarbrucken

SOFTWARE VERIFICATION RESEARCH CENTRE DEPARTMENT OF COMPUTER SCIENCE THE UNIVERSITY OF QUEENSLAND. Queensland 4072 Australia TECHNICAL REPORT. No.

Principles of AI Planning. Principles of AI Planning. 7.1 How to obtain a heuristic. 7.2 Relaxed planning tasks. 7.1 How to obtain a heuristic

Integrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation

Knowledge Representation and Reasoning Logics for Artificial Intelligence

.Math 0450 Honors intro to analysis Spring, 2009 Notes #4 corrected (as of Monday evening, 1/12) some changes on page 6, as in .

COMP2411 Lecture 20: Logic Programming Examples. (This material not in the book)

Congruence Closure in Intensional Type Theory

21. Distributed Algorithms

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Tutorial. Answer Set Programming for the Semantic Web. Thomas Eiter, Roman Schindlauer. (Univ. Rey Juan Carlos, Madrid)

EXTENDING LOGIC PROGRAMMING WITH COINDUCTION APPROVED BY SUPERVISORY COMMITTEE: Gopal Gupta, Chair. Dung T. Huynh. R. Chandrasekaran.

XSB. Tim Finin University of Maryland Baltimore County. What XSB offers Tabling Higher order logic programming. Negation. sort of.

Part I Logic programming paradigm

Extending the Well-Founded and Valid Semantics for Aggregation. Computer Sciences Department. University of Wisconsin Madison. Raghu Ramakrishnan

From Functional Specications to. The paper investigates a methodology for representing knowledge in logic

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

Detecting Unsolvable Queries for. denite Logic Programs. Maurice Bruynooghe. Henk Vandecasteele. D. Andre de Waal. Marc Denecker

Knowledge Representation and Reasoning Logics for Artificial Intelligence

Answer Set Programming

SAT solver of Howe & King as a logic program

Tidying up the Mess around the Subsumption Theorem in Inductive Logic Programming Shan-Hwei Nienhuys-Cheng Ronald de Wolf bidewolf

Critical Analysis of Computer Science Methodology: Theory

Implementação de Linguagens 2016/2017

AILP. Abductive Inductive Logic Programming

Taxonomic Syntax for First Order Inference. Abstract: We identify a new polynomial time decidable fragment of rst order

The underlying idea for the proposed proof procedure is to transform a formula into a Shannon graph and compile this graph into Horn clauses When run

Semantic Forcing in Disjunctive Logic Programs

1 Recursion. 2 Recursive Algorithms. 2.1 Example: The Dictionary Search Problem. CSci 235 Software Design and Analysis II Introduction to Recursion

Knowledge-Based Systems and Deductive Databases

The CIFF Proof Procedure for Abductive Logic Programming with Constraints

of Sets of Clauses Abstract The main operations in Inductive Logic Programming (ILP) are generalization and

Logical reasoning systems

Lecture 4: January 12, 2015

Infinite Derivations as Failures

Agenda. CS301 Session 20. A logic programming trick. A simple Prolog program. Introduction to logic programming Examples Semantics

STABILITY AND PARADOX IN ALGORITHMIC LOGIC

Incremental Evaluation of Lattice-Based Aggregates in Logic Programming Using Modular TCLP

Answer Sets and the Language of Answer Set Programming. Vladimir Lifschitz

Functional Computations in Logic Programs. Saumya K. Debray Department of Computer Science The University of Arizona Tucson, AZ 85721

Logic and its Applications

Module 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur

Abduction in Logic Programming

contribution of this paper is to demonstrate that rule orderings can also improve eciency by reducing the number of rule applications. In eect, since

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the

Lecture 14: Lower Bounds for Tree Resolution

Chapter 9: Constraint Logic Programming

Conict Resolution in Structured Argumentation

Program Analysis: Lecture 02 Page 1 of 32

More Non-logical Features of Prolog

Transforming general program proofs: a meta interpreter which expands negative literals

express that the arguments have not the shape required by the normal rules. The default rules also impose universal quantications over the free variab

Algebra of Logic Programming Silvija Seres Michael Spivey Tony Hoare Oxford University Computing Laboratory Wolfson Building, Parks Road, Oxford OX1 3

5. Logical Programming

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 11 p. 1/38

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

Choice Logic Programs and Nash Equilibria in Strategic Games

Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence

HD-rules: a hybrid system interfacing Prolog with DL-reasoners

A Gentle Introduction to Program Analysis

Prolog Examples. Distributed Systems / Technologies. Sistemi Distribuiti / Tecnologie

Formally-Proven Kosaraju s algorithm

From Functional Specications to. The paper investigates a methodology for representing knowledge in logic

once. A at term is a variable or a term of the form f(x 1 ; : : : ; x n ), where n 0 and the x i are distinct variables. Atoms are denoted by h, queri

simplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion procedural and declarative semantics and & or

(More) Propositional Logic and an Intro to Predicate Logic. CSCI 3202, Fall 2010

An Abstract Machine for Tabled Execution. of Fixed-Order Stratied Logic Programs. Katholieke Universiteit Leuven SUNY at Stony Brook

Range Restriction for General Formulas

Programming Language Concepts: Lecture 22

Logic Programming: The Prolog Language

Description logic reasoning using the PTTP approach

The Resolution Principle

Transcription:

Logic Programming Revisited Logic Programs as Inductive Denitions An engineers' view Maurice Bruynooghe Katholieke Universiteit Leuven, Belgium Partly based on work of Marc Denecker In the beginning (1974), Logic Programming was simple Then came negation : : : Back to a simple view: Logic programs dene relations What if incomplete information? 1

LP attracted two kinds of enthousiasts engineers/programmers \Never had I experienced such ease in getting a complex program coded and running" D.H.D. Warren about his rst experience with Prolog (1974) in writing Warplan, in Foreword to The Art of Prolog Compare with the eort in Pascal: reason for excitement mathematicians Logic! 2

The early view: I. In the beginning Logic programs rst order predicate logic Restriction allows for: procedural interpretation (hence control) ecient theorem provers: Prolog still widespread BUT wrong LP is not a subset of FOL 3

path(x,y) <- edge(x,y). path(x,y) <- edge(x,z), path(z,y). edge(a,b). edge(c,d). edge(b,a). Expectations from programmer/engineer: edge(a; c), edge(d; a), path(c; a) are false and so is path(a; c) But FOL cannot conclude any of these SLD does not fail nitely on all 4

Practice engineers' (ab)use leads to Theory Denite programs SLD is a sound and complete procedure: p(: : : ) has SLD-proof i p(: : : ) is entailed in FOL-theory consisting of Horn clauses. But depth rst (Prolog) is not complete p(: : : ) is false in the mind of the engineer i : : : Close World Assumption (but one cannot compute) Completion (but does not correspond) 5

Normal programs SLDNF { Close World Assumption does not extend { Completion does but... { A pile of literature { Many research agendas { The right view? 6

II. Logic Programs Dene Relations The engineer's view/expectations A one-one correspondence between terms and objects in the engineers' universe (only Herbrand interpretations) CLP: some symbols have a dierent but xed interpretation Programs dene relations to be elaborated Answers sound wrt logic: If query execution terminates and if it succeeds then the relationship is true else (failure) the relationship is false Partial Correctness Total correctness: prove termination 7

Supported by line of work Closed World Assumption Stratication Well-founded semantics Correspondence two valued WFS and inductive denitions 8

Denite Programs as Positive Inductive Denitions path(x,y) <- edge(x,y). path(x,y) <- edge(x,z), path(z,y). % NOTHING ELSE IS A PATH Much stronger than FOL-implications Positive loops are inherent Semantics: least xpoint of T P least model of FOL-implications model in which each atom has a proof coincides with CWA Formalisation in classical logic requires: Free Equality Theory Domain Closure Axioms Minimisation axioms (beyond FOL) (\least model") Total denition splits the Herbrand base of the dened predicate in two parts: true atoms and false atoms. 9

NORMAL programs as inductive denitions Once a relation dened, its negation can be used: person(..).... % nothing else is a person male(..).... % nothing else is a male female(x) <- person(x), not male(x). corresponds to stratication More subtle even(0). % 0 is even even(s(x)) <- number(x), not even(x). % if X is a non-even number then X+1 is even % nothing else is even The grounding is stratied, each layer is a positive inductive denition Iterated Inductive Denition 10

even(0). even(y) <- succ(y,x), number(x), not even(x). succ(s(x),x). Is not stratied, but is a meaningful inductive denition Has a two valued well-founded model, i.e. every atom is true or false General non-monotonic inductive denition semantics: xpoint of a monotone operator mapping partial interpretations to partial interpretations. 11

The xpoint operator Replace facts p(: : : ) by rules p(: : : ) true false for undened p=n Add p(x1; : : : ; Xn) A proof tree for ground atom p(: : : ) p(: : : ) is the root for each non leaf q(: : : ) with descendents l1; : : : ; l n : there is a ground rule q l1; : : : l n : each leaf is either true, false or a negative literal no innite branches Partial interpretation I: Op(I) = I 0 I 0 (p(: : : )) = t i p(: : : ) has a proof with all leafs true in I I 0 (p(: : : )) = f i each proof tree of p(: : : ) has a leaf which is false in I. others: still undened Corresponds with three valued stable model operator Least xpoint equals well-founded model Denecker JELIA 1998 12

Some consequences Completeness is not achievable Price to pay for expressivity Prolog was not complete anyway Does YOUR program terminate? Is program a total denition? Undecidable One has to accept buggy programs Three valued well-founded semantics tells what is true, what is false and what is undened due to bugs in the denition Is paraconsistent logic shaves(b,x) :- citizen(x), not shaves(x,x). shaves(x,x) :- shaves_himself(x). citizen(a). citizen(b). citizen(c). shaves_himself(a). Bug for shaves(b; b) 13

III. Incomplete Knowledge The algorithmic/clp approach: embed/hide missing knowledge in data structure and search queens(q,n) :- generate(q,n,n), safe(q), instantiate(q). generate([],0,_). generate([x T],M,N) :- M > 0, X in 1..N, M1 is M - 1, generate(t,m1,n). safe([]). safe([x T]) :- noattack(x,1,t), safe(t). noattack(_,_,[]). noattack(x,n,[y Z]) :- X \= Y, Y \= X + N, X \= Y + N, S is N + 1, noattack(x,s,z). instantiate([]). instantiate([x T]) :- enum(x), instantiate(t). Not declarative 14

Distinguish the known from the unknown: Dened predicates vs open predicates open shaves_barber/1 shaves(b,x) :- citizen(x), X =/= b, not shaves(x,x shaves(x,x) :- shaves_himself(x). shaves(x,b) :- shaves_barber(x). barber_is_shaved :- shaves_barber(x). citizen(a). citizen(b). citizen(c). shaves_himself(a). barber_is_shaved <- true. citizen(x) <- shaves_barber(x). Program has three parts: Open predicates Denitions (Program) Integrity Constraint expressing partial knowledge about abducibles, a denition for the open predicates completes the program P [ is inductive denition Integrity constraints must be true in unique model 15

open position/2. % DEFINITIONS size(8). row(r) :- size(n), R in 1..N. column(c) :- size(n), C in 1..N. row_has_queen(r) :- position(r,c). % CONSTRAINTS % the arguments of position/2 have the % correct types row(r) <- position(r,c). column(c) <- position(r,c). % at least one queen on each row row_has_queen(r) <- row(r). % no more than one queen on each row C1=C2 <- position(r,c1), position(r,c2). % the configuration is illegal if % a queen attacks a queen on a higher row false <- position(r1,c1), position(r2,c2), R1<R2, (C1=C2 ; abs(r2-r1)=abs(c2-c1)). 16

The stable model (e.g. Smodels) approach row(1..8) <-. column(1..8) <-. position(r,c) <- row(r), column(c), not negposition(r,c). negposition(r,c) <- row(r), column(c), not position(r,c). % at least one queen on each row row_has_queen(r) <- row(r), column(c), position(r,c). <- row(r), not row_has_queen(r). % no more than one queen on each row <- row(r), column(c1), column(c2), position(r,c1), position(r,c2), C1\=C2. % no two queens on same column <- row(r1), row(r2), column(c), position(r1,c), position(r2,c), R1\=R2. % no two queens on same diagonal <- row(r1), row(r2), column(c1), column(c2), position(r1,c), position(r2,c), R1\=R2, C1\=C2, abs(r2-r1)=abs(c2-c1). Too low level as a description No smooth extension of LP 17

Distinguish the known from the unknown: Open functions: do not x the interpretation of all terms Program has three parts: Declarations of domains and open functions Denitions of predicates Integrity Constraint expressing partial knowledge about open functions An interpretation of the open functions completes the program Integrity constraints must be true in the least model of the program Far away from \all interpretations" as in FOL Formalised as extension of CLP in paper at PPDP 2000 18

% Declarations constant size == 8. domain row == 1..size. domain column == 1..size. open_function pos(row):column. % hence each row has exactly one queen % Program attack(r1,r2) :- pos(r1) = pos(r2). attack(r1,r2) :- R2-R1 = abs(pos(r2)-pos(r1)). % Integrity Constraints false <- R1 < R2, attack(r1,r2). 19

Conclusions Stop the folk belief LP F OL Logic programs as denitions: Simple Elegant Agrees with engineers/programmers intuitions Smooth extensions to cope with incomplete knowledge But work needed to build systems (exploit nite domain CLP technology) No completeness, worry about termination 20