Brief Introduction to Computational Logic

Slides:



Advertisements
Similar presentations
Relational Calculus and Datalog
Advertisements

Query Answering for OWL-DL with Rules Boris Motik Ulrike Sattler Rudi Studer.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
Default and Cooperative Reasoning in Multi-Agent Systems Chiaki Sakama Wakayama University, Japan Programming Multi-Agent Systems based on Logic Dagstuhl.
Winter 2002Arthur Keller – CS 18014–1 Schedule Today: Feb. 26 (T) u Datalog. u Read Sections Assignment 6 due. Feb. 28 (TH) u Datalog and SQL.
CSE 636 Data Integration Datalog Rules / Programs / Negation Slides by Jeffrey D. Ullman.
Winter 2004/5Pls – inductive – Catriel Beeri1 Inductive Definitions (our meta-language for specifications)  Examples  Syntax  Semantics  Proof Trees.
Deductive Databases Chapter 25
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
DEDUCTIVE DATABASE.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Steffen Staab Advanced Data Modeling 1 of 32 WeST Häufungspunkte Bifurkation: x n+1 = r x n (1-x n ) Startwert x 0 = 0,25.
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.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman Fall 2006.
Chapter 5 Notes. P. 189: Sets, Bags, and Lists To understand the distinction between sets, bags, and lists, remember that a set has unordered elements,
0 Propositional logic versus first-order (predicate) logic The universe of discourse Constants, variables, terms and valuations Predicates as generalized.
LDK R Logics for Data and Knowledge Representation First Order Logics (FOL) Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Lu Chaojun, SJTU 1 Extended Relational Algebra. Bag Semantics A relation (in SQL, at least) is really a bag (or multiset). –It may contain the same tuple.
Database Management Systems Course Faculty of Computer Science Technion – Israel Institute of Technology Lecture 5: Queries in Logic.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models in First Order Logics.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models in First Order Logics.
1 Finite Model Theory Lecture 5 Turing Machines and Finite Models.
Extensions of Datalog Wednesday, February 13, 2001.
1 Datalog with negation Adapted from slides by Jeff Ullman.
Predicate Calculus CS 270 Math Foundations of Computer Science Jeremy Johnson Presentation uses material from Huth and Ryan, Logic in Computer Science:
1 Finite Model Theory Lecture 9 Logics and Complexity Classes (cont’d)
CS589 Principles of DB Systems Fall 2008 Lecture 4c: Query Language Equivalence Lois Delcambre
CS589 Principles of DB Systems Spring 2014 Unit 2: Recursive Query Processing Lecture 2-1 – Naïve algorithm for recursive queries Lois Delcambre (slides.
Datalog Rules / Programs / Negation Slides by Jeffrey D. Ullman
Conceptual Graphs(1) A CG is a finite, connected, bipartite graph.
Knowledge Representation and Reasoning
Horn Clauses and Unification
Containment Mappings Canonical Databases Sariaya’s Algorithm
Semantics of Datalog With Negation
Semantics In propositional logic, we associate atoms with propositions about the world. We specify the semantics of our logic, giving it a “meaning”. Such.
CSE 344: Section 5 Datalog February 1st, 2018.
Steven Lindell Scott Weinstein
Prolog syntax + Unification
Cse 344 January 29th – Datalog.
CSPs and Relational DBs
Game Description General Game Playing Lecture 2
Problem Solving with Constraints
Horn Clauses and Unification
Horn Clauses and Unification
SYNTAX DIRECTED DEFINITION
Logical Entailment Computational Logic Lecture 3
Logic Based Query Languages
Herbrand Logic Semantics
Datalog Inspired by the impedance mismatch in relational databases.
Game Description General Game Playing Lecture 2
Logics for Data and Knowledge Representation
Problem Solving with Constraints
Problem Solving with Constraints
Properties of Relational Logic
Properties of Relational Logic
Model Minimization Computational Logic Lecture 16
Herbrand Semantics Computational Logic Lecture 15
Advanced Data Modeling Minimal Models
Resolution Preliminaries
Herbrand Logic Semantics
Rules Programs Negation
Presentation transcript:

Brief Introduction to Computational Logic

Vocabulary Components: Object Variables: X, Y, Z Object Constants: a, b, c Function Constants: f, g, h Relation Constants: p, q, r Logical Operators: ~, &, :- Punctuation: (, ,, ) The arity of a function or relation is the number of arguments that can be supplied to the function or relation. NB: Variadic functions and relations are possible, but in our work here we fix the arity for each function and relation in advance.

Syntax Terms: Variables: X, Y, Z Object Constants: a, b, c Functional Terms: f(a), g(X,b), h(X,f(Y),c) Sentences: Atoms: p(a,b), p(a,f(a)), p(g(f(a),b),c) Negations: ~p(a,b) Rules: r(X,Y) :- p(X,Y,c) & ~q(Y)

ra(X,Y) :- a(X,Y) & ~p(X,Y) Logic Programs A logic program is a finite set of atoms and rules. Example: p(X,Y) :- f(X,Y) p(X,Y) :- m(X,Y) g(X,Z) :- p(X,Y) & p(Y,Z) a(X,Z) :- p(X,Z) a(X,Z) :- p(X,Y) & a(Y,Z) ra(X,Y) :- a(X,Y) & ~p(X,Y)

Terminology A literal is either an atom or a negation of an atom. p(a,b), ~p(a,b) Rules: subgoal … subgoal head body An expression is ground if and only if it contains no variables.

r(X,Z) :- p(X,Y) & q(Y,Z) & ~r(X,Y) Safety A rule is safe if and only if every variable in the head appears in some positive subgoal in the body. Safe Rule: r(X,Z) :- p(X,Y) & q(Y,Z) & ~r(X,Y) Unsafe Rule: r(X,Z) :- p(X,Y) & q(Y,X) r(X,Z) :- p(X,Y) & ~q(Y,Z) In GDL, we require all rules to be safe.

Dependency Graph The dependency graph for a set of rules is a directed graph in which (1) the nodes are the relations mentioned in the head and bodies of the rules and (2) there is an arc from a node p to a node q whenever p occurs with the body of a rule in which q is in the head. r(X,Y) :- p(X,Y) & q(X,Y) S(X,Y) :- r(X,Y) S(X,Z) :- r(X,Y) & t(Y,Z) t(X,Z) :- s(X,Y) & s(Y,X) A set of rules is recursive if it contains a cycle. Otherwise, it is non-recursive. t s r p q

Stratified Negation The negation in a set of rules is said to be stratified if and only if there is no recursive cycle in the dependency graph involving a negation. Negation that is not stratified: r(X,Z) :- p(X,Y) r(X,Z) :- p(X,Y) & ~r(Y,Z) Stratified Negation: t(X,Y) :- q(X,Y) & ~r(X,Y) r(X,Z) :- r(X,Y) & r(Y,Z) In GDL, we require that all negations be stratified.

r(X,Z) :- p(X,Y) & q(Z) & r(Y,Z) Stratified Recursion The recursion in a set of rules is said to be stratified if and only if every variable in a subgoal relation occurs in a subgoal with a relation at a lower stratum. Stratified Recursion: r(X,Z) :- p(X,Y) & q(Z) & r(Y,Z) Recursion that is not stratified: r(X,Z) :- r(X,Y) & r(Y,Z) In GDL, we require that all recursions be stratified.

Herbrand Universe The Herbrand universe for a logic program is the set of all ground terms in the language. Example 1: Object Constants: a, b Herbrand Universe: a, b Example 2: Object Constants: a Unary Function Constants: f Herbrand Universe: a, f(a), f(f(a)), …

{p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)} Herbrand Base The Herbrand base for a logic program is the set of all ground atoms in the language. Object Constants: a, b Unary Relation Constant: p Binary Relation Constant: q Herbrand Universe: a, b Herbrand Base: {p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)}

Herbrand Interpretations An interpretation for a logic program is an arbitrary subset of the Herbrand base for the program. Herbrand Base: {p(a), p(b), q(a,a), q(a,b), q(b,a), q(b,b)} Interpretation 1: {p(a), q(a,b), q(b,a)} Interpretation 2: Interpretation 3: {}

Herbrand Models A n interpretation  satisfies a ground sentence (i.e. it is a model) under the following conditions:  satisfies (1,…, n) iff (1,…, n).  satisfies ~ iff  does not satisfy .  satisfies 1& …& n iff  satisfies every i. satisfies 2 :- 1 iff  satisfies 2 whenever it satisfies 1. An interpretation satisfies a non-ground sentence if and only if it satisfies every ground instance of that sentence.

Multiple Models In general, a logic program can have more than one model. Logic Program: {p(a,b), q(X,Y):-p(X,Y)} Model 1: {p(a,b), q(a,b)} Model 2: {p(a,b), q(a,b), q(b,a)}

Minimality To eliminate ambiguity, we adopt a minimal model semantics. A model D is a minimal model of a program O iff no proper subset of D is a model of O. Logic Program: {p(a,b), q(X,Y):-p(X,Y)} Good Model 1: {p(a,b), q(a,b)} Bad Model 2: {p(a,b), q(a,b), q(b,a)} Theorem: Given our various restrictions, every logic program has a unique minimal model. Therefore, unambiguous answers. Also, all models are finite!

Open versus Closed Logic Programs Logic programs as just defined are closed in that they fix the meaning of all relations. In open logic programs, some of the relations are given as inputs (rather than being defined) and other relations are produced as outputs (defined in terms of the inputs). In other words, open logic programs can be used with different input datasets to produce different output datasets.

Open Logic Programs An open logic program is a logic program together with a partition of the relations into two types - base relations (the inputs) and view relations (the defined relations). View relations can appear anywhere in the program, while base relations can appear only in the bodies of rules (never in the heads of rules).

Inputs and Outputs An overall model of an open logic program O with an input model D is is the minimal model of OD. The output of an open logic program for input D is the subset of the overall model of O and D that mentions only output relations.

Example Base Relations: p, q View Relations: r Rules: {r(X,Y) :- p(X,Y) & ~q(Y)} Input 1: {p(a,b), p(b,b), q(b)} Output 1: {r(a,b)} Input 2: {p(a,b), p(b,b)} Output 2: {r(a,b), r(b,b)}