Lecture 9: Datalog with Negation

Size: px
Start display at page:

Download "Lecture 9: Datalog with Negation"

Transcription

1 CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 9: Datalog with Negation In this lecture we will study the addition of negation to Datalog. We start with an example. Example 9.1. Suppose that we want to compute the complement of graph transitive closure (i.e. output all edges (a, b) such that there is no directed path from a to b). We can compute this using the following Datalog program: V(x) :- R(x,y). V(y) :- R(x,y). T(x,y) :- R(x,y). T(x,y) :- T(x,z), R(z,y). TC(x,y):- V(x), V(y), not T(x,y). Notice that we now allow negation in the body of the rules. Similar to the case of Conjunctive Queries with negation, we have to be careful that the negation is safe: this means that every variable that appears in a negated atom must also appear in a positive atom. We also do not allow negation to appear in the head of a rule. We call the new language Datalog. The semantics of (positive) Datalog are intuitive and well-defined; there exists a unique minimum model, and we can apply the fixpoint algorithm to iteratively find this model. However, when we add negation, finding the right semantics becomes a harder task. We investigate this next. The first attempt to define the semantics would be by extending the fixpoint semantics. The immediate consequence operator can still be defined as with positive Datalog (it will be an RA expression with negation). However, the fixpoint is not well-defined in the case of Datalog with negation! Consider the following examples: Example 9.2. Consider the following program in Datalog : R(x) : S(x), R(x), and suppose that the EDB S has input {S(1)}. In this case, neither {R(1)} nor { R(1)} are fixpoints! In fact, the above program does not have any fixpoint if we follow the standard definition. Example 9.3. Consider the following program in Datalog : R(x) : S(x), T(x) and T(x) : S(x), R(x), with input {S(1)}. In this case, we have two fixpoints: {R(1), T(1)} and { R(1), T(1)}. None of the two fixpoints is contained in the other, so they are both minimal fixpoints! So how can we define the semantics of Datalog with negation? We will see next several different ways that we can define the semantics for Datalog. 9-1

2 Lecture 9: Datalog with Negation Semi-positive Datalog In semi-positive Datalog, we are allowed to have negation only in front of EDB relations. To define the semantics for semi-positive Datalog, we interpret R( x) as follows: R( x) is true if and only if x is in the active domain and x is not in R. The standard iterative computation works for semipositive Datalog, since the negated EDB relations can essentially be replaced by a positive relation (which is the complement). Example 9.4. Consider the following Datalog program: RC(x,y) :- V(x), V(y), not R(x,y). T(x,y) :- RC(x,y). T(x,y) :- T(x,z), RC(z,y). where the EDB R is: {R(1, 2), R(2, 3), R(1, 1), R(1, 3)}. We can now compute the complement of R as: {R(2, 1), R(2, 2), R(3, 3), R(3, 2), R(3, 1)}. We can now replace R with R in the Datalog program with the complementary input, and run it simply as a positive Datalog program. 9.2 Stratified Datalog A stratified Datalog program with negation is a generalization of the idea behind semi-positive Datalog. In semi-positive Datalog, the negation is only in front of EDB relations. We can now try to add negation in front of an IDB predicate that is the output of a semi-positive program (when there is no mutual recursion), and so on. Definition 9.5 (Stratification). A stratification of a Datalog program P is a partition of P into Datalog sub-programs P 1,..., P m such that: All the rules defining the same IDB relation are in the same partition. If an IDB R appears positive in the body of a rule with head R, R should be defined in a partition before or where R is defined. If an IDB R appears negated in the body of a rule with head R, R should be defined in partition strictly before where R is defined. Example 9.6. Consider the Datalog program from Example 9.1. This program can be stratified in 3 Datalog subprograms as follows: (P1) V(x) :- R(x,y). (P1) V(y) :- R(x,y). (P2) T(x,y) :- R(x,y). (P2) T(x,y) :- T(x,z), R(z,y). (P3) TC(x,y):- V(x), V(y), not T(x,y).

3 Lecture 9: Datalog with Negation 9-3 Notice that (P2) defines the IDB R, and (P3) defines TC; TC has a negated IDB in the body of a rule that defines it, but this IDB appears in the previous stratum (P2). A Datalog program can have many possible stratifications. For instance, in the above example we could switch the order of (P1), (P2) and still get a stratification. Also, not every Datalog program can be stratified! For instance, the program R(x) : S(x), R(x) is not stratifiable! If a Datalog program can the stratified, we can use the stratification to provide well-defined semantics. The idea is simple: we start from the first stratum (partition), which will be a semipositive program, and compute the fixpoint of this stratum. We can now "freeze" the IDB predicates defined in the first stratum, and use them as EDB relations in the second stratum. We continue this process until we traverse all strata. How do we determine if a Datalog program is stratifiable? We construct the precedence graph: whenever an IDB predicate R appears positive in a rule with head S, we add a directed edge (R, S) with label +. Whenever an IDB predicate R appears negative in a rule with head S, we add an edge (R, S) with label. We can now use the precedence graph to look for a stratification Lemma 9.7. A Datalog program is stratifiable if and only if the precedence graph has no directed cycles with a negative edge. If the precedence graph indeed has no directed cycles with a negative edge, any topological ordering of the graph will give a stratification of the program. What happens in the case a Datalog program admits many possible stratifications? Theorem 9.8. Let P be a stratifiable program in Datalog. Then: The result of the stratified semantics is the same, independent of which stratification of P we choose. If P is positive, the stratified semantics output the unique minimum model. 9.3 Well-Founded Semantics As we discussed before, there are Datalog programs that cannot be stratified. We now discuss how to define semantics for these types of programs, which we call well-founded semantics. As a running example, we will consider the Datalog program that describes the win-move game. In this game, we have a directed graph given by the relation moves(x, y). Two players make alternatively moves in the graph according to the relation moves. A player loses if she has no moves to make. We want to compute the predicate win(x), which means that the player has a winning strategy if she moves from vertex x. The following Datalog program defines the relation: win(x) :- moves(x,y), not win(y).

4 Lecture 9: Datalog with Negation 9-4 We will consider the following instance of the relation moves: {moves(1, 2), moves(2, 1), moves(1, 3), moves(3, 4)} We start by defining the stable model of a Datalog program. Intuitively, a set I of IDB facts is a stable model if, by applying the rules of P we get exactly I; however, we can only use non-membership of a fact to I when we apply the rules. To formally define a stable model, we need to define the reduct of a program w.r.t. a set of facts I. Definition 9.9 (Reduct). The reduct P of a Datalog program P w.r.t. a set of facts I is obtained as follows: 1. Create all possible instantiations (groundings) of the rules in P. 2. Delete all instantiations that contain R( a), where R( a) I. 3. Delete all remaining negative literals in the bodies of the remaining rules. The reduct of a Datalog program w.r.t. I is always a positive Datalog program. Thus, we can always define the fixpoint of the reduct. Definition 9.10 (Stable Model). We say that I is a stable model of a Datalog program P if the fixpoint of its reduct w.r.t. to I is exactly I. Example Let I = {win(3), win(1)}. To compute the reduct, we first write the instantiations of the rules: win(1) :- moves(1,2), not win(2). win(2) :- moves(2,1), not win(1). win(1) :- moves(1,3), not win(3). win(3) :- moves(3,4), not win(4). Since win(1), win(3) are in I, we remove rules 2 and 3; and we remove the negated literals from the remaining rules. The result is the reduct: win(1) :- moves(1,2). win(3) :- moves(3,4). If we run the fixpoint for this program, we obtain that the output is {win(1), win(3)}, which is exactly I. Thus, I = {win(3), win(1)} is a stable model! A Datalog program can have several (exponentially many) stable models. For our running example, there are two stable models: {win(3), win(1)}, {win(3), win(2)}

5 Lecture 9: Datalog with Negation 9-5 It can also be the case that there are no stable models! To overcome these problem, the wellfounded semantics classify each possible answer to facts that are true, false, and facts that are unknown. In other words, we want to find a 3-valued model to describe the answer to the program. Formally, each possible fact in the active domain will be mapped to one of three values: 0, 1, 1/2 (0 means certainly not in the output, 1 means certainly in the output, and 1/2 means unknown/uncertain). Definition Given a Datalog program P, the well-founded model of P is the minimal 3-valued model such that: (i) the true facts belong to all stable models of P, and (ii) the false facts belong in no stable model of P. In other words, if a fact appears in some stable models (and not all), then we classify it as unknown. For our running example, the well-founded model has one true fact (win(3)), and one false fact (win(4)); the remaining facts (win(1), win(2)) are unknown (intuitively, they are the ones that lead to a draw). To compute the well-founded model, we start by assuming that the facts are all false, hence I 0 =. In the first iteration, we compute the reduct of P w.r.t to I 0, and compute the fixpoint, which will be I 1. In the second iteration, we compute the reduct of P w.r.t. to I 1 and then find the fixpoint I 2, and so on. We call this procedure alternating fixpoint. The above process does not have a fixpoint, but it has two fixpoints! The results of even iterations I 2k are monotonically increasing, and the results of the odd iterations I 2k+1 are monotonically decreasing. What happens is that I 2k is an underestimation of the true facts, and an overestimation of the false facts; I 2k+1 is an overestimation of the false facts and an underestimation of the true facts. The fixpoint of the even iterations will give us the set of all true facts, and the fixpoint of the odd iterations the set of all false facts. The remaining facts will be labeled as unknown! Example Consider our running example. Then we have: I 0 = I 1 = {win(1), win(2), win(3)} I 2 = {win(3)} I 3 = {win(1), win(2), win(3)} I 4 = {win(3)} At this point we have reached the fixpoint. The true fact is win(3), the false fact is win(4), and the remaining are unknown. References [Alice] S. ABITEBOUL, R. HULL and V. VIANU, Foundations of Databases.

Lecture 1: Conjunctive Queries

Lecture 1: Conjunctive Queries CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 1: Conjunctive Queries A database schema R is a set of relations: we will typically use the symbols R, S, T,... to denote

More information

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 14. Example. Datalog syntax: rules. Datalog query. Meaning of Datalog rules

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 14. Example. Datalog syntax: rules. Datalog query. Meaning of Datalog rules Plan of the lecture G53RDB: Theory of Relational Databases Lecture 14 Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk More Datalog: Safe queries Datalog and relational algebra Recursive

More information

Datalog. Susan B. Davidson. CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309

Datalog. Susan B. Davidson.   CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309 Datalog Susan B. Davidson CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309 http://www.cis.upenn.edu/~susan/cis700/homepage.html 2017 A. Alawini, S. Davidson Homework for this week Sign up to present

More information

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #11

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #11 CMPS 277 Principles of Database Systems https://courses.soe.ucsc.edu/courses/cmps277/fall11/01 Lecture #11 1 Limitations of Relational Algebra & Relational Calculus Outline: Relational Algebra and Relational

More information

Data Integration: Logic Query Languages

Data Integration: Logic Query Languages Data Integration: Logic Query Languages Jan Chomicki University at Buffalo Datalog Datalog A logic language Datalog programs consist of logical facts and rules Datalog is a subset of Prolog (no data structures)

More information

Database Theory: Beyond FO

Database Theory: Beyond FO Database Theory: Beyond FO CS 645 Feb 11, 2010 Some slide content based on materials of Dan Suciu, Ullman/Widom 1 TODAY: Coming lectures Limited expressiveness of FO Adding recursion (Datalog) Expressiveness

More information

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

8. Negation 8-1. Deductive Databases and Logic Programming. (Sommer 2017) Chapter 8: Negation 8. Negation 8-1 Deductive Databases and Logic Programming (Sommer 2017) Chapter 8: Negation Motivation, Differences to Logical Negation Syntax, Supported Models, Clark s Completion Stratification, Perfect

More information

Logical Aspects of Massively Parallel and Distributed Systems

Logical Aspects of Massively Parallel and Distributed Systems Logical Aspects of Massively Parallel and Distributed Systems Frank Neven Hasselt University PODS Tutorial June 29, 2016 PODS June 29, 2016 1 / 62 Logical aspects of massively parallel and distributed

More information

Logic As a Query Language. Datalog. A Logical Rule. Anatomy of a Rule. sub-goals Are Atoms. Anatomy of a Rule

Logic As a Query Language. Datalog. A Logical Rule. Anatomy of a Rule. sub-goals Are Atoms. Anatomy of a Rule Logic As a Query Language Datalog Logical Rules Recursion SQL-99 Recursion 1 If-then logical rules have been used in many systems. Most important today: EII (Enterprise Information Integration). Nonrecursive

More information

Recap and Schedule. Till Now: Today: Ø Query Languages: Relational Algebra; SQL. Ø Datalog A logical query language. Ø SQL Recursion.

Recap and Schedule. Till Now: Today: Ø Query Languages: Relational Algebra; SQL. Ø Datalog A logical query language. Ø SQL Recursion. Recap and Schedule Till Now: Ø Query Languages: Relational Algebra; SQL Today: Ø Datalog A logical query language. Ø SQL Recursion. CSE 532 DLog 1 Logical Query Languages Motivation: 1. Logical rules extend

More information

Logical Query Languages. Motivation: 1. Logical rules extend more naturally to. recursive queries than does relational algebra. Used in SQL recursion.

Logical Query Languages. Motivation: 1. Logical rules extend more naturally to. recursive queries than does relational algebra. Used in SQL recursion. Logical Query Languages Motivation: 1. Logical rules extend more naturally to recursive queries than does relational algebra. Used in SQL recursion. 2. Logical rules form the basis for many information-integration

More information

Datalog. Rules Programs Negation

Datalog. Rules Programs Negation Datalog Rules Programs Negation 1 Review of Logical If-Then Rules body h(x, ) :- a(y, ) & b(z, ) & head subgoals The head is true if all the subgoals are true. 2 Terminology Head and subgoals are atoms.

More information

Local Stratiæcation. Instantiate rules; i.e., substitute all. possible constants for variables, but reject. instantiations that cause some EDB subgoal

Local Stratiæcation. Instantiate rules; i.e., substitute all. possible constants for variables, but reject. instantiations that cause some EDB subgoal Local Stratication Instantiate rules; i.e. substitute all possible constants for variables but reject instantiations that cause some EDB subgoal to be false. Ground atom = atom with no variables. Build

More information

Constructive negation with the well-founded semantics for CLP

Constructive negation with the well-founded semantics for CLP Constructive negation with the well-founded semantics for CLP Włodek Drabent Institute of Computer Science Polish Academy of Sciences, Warszawa, and IDA, Linköping University Jan Maluszynski, Jakob Henriksson

More information

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting

CS2 Algorithms and Data Structures Note 10. Depth-First Search and Topological Sorting CS2 Algorithms and Data Structures Note 10 Depth-First Search and Topological Sorting In this lecture, we will analyse the running time of DFS and discuss a few applications. 10.1 A recursive implementation

More information

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems DATABASE THEORY Lecture 11: Introduction to Datalog Markus Krötzsch Knowledge-Based Systems TU Dresden, 12th June 2018 Announcement All lectures and the exercise on 19 June 2018 will be in room APB 1004

More information

CSE 344 JANUARY 29 TH DATALOG

CSE 344 JANUARY 29 TH DATALOG CSE 344 JANUARY 29 TH DATALOG ADMINISTRATIVE MINUTIAE HW3 due Friday OQ due Wednesday HW4 out Wednesday Exam next Friday 3:30-5:00 WHAT IS DATALOG? Another query language for relational model Designed

More information

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES

FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES FOUNDATIONS OF SEMANTIC WEB TECHNOLOGIES RDFS Rule-based Reasoning Sebastian Rudolph Dresden, 16 April 2013 Content Overview & XML 9 APR DS2 Hypertableau II 7 JUN DS5 Introduction into RDF 9 APR DS3 Tutorial

More information

Range Restriction for General Formulas

Range Restriction for General Formulas Range Restriction for General Formulas 1 Range Restriction for General Formulas Stefan Brass Martin-Luther-Universität Halle-Wittenberg Germany Range Restriction for General Formulas 2 Motivation Deductive

More information

Database Theory VU , SS Introduction to Datalog. Reinhard Pichler. Institute of Logic and Computation DBAI Group TU Wien

Database Theory VU , SS Introduction to Datalog. Reinhard Pichler. Institute of Logic and Computation DBAI Group TU Wien Database Theory Database Theory VU 181.140, SS 2018 2. Introduction to Datalog Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 13 March, 2018 Pichler 13 March, 2018 Page 1 Database

More information

Data Integration: Datalog

Data Integration: Datalog Data Integration: Datalog Jan Chomicki University at Buffalo and Warsaw University Feb. 22, 2007 Jan Chomicki (UB/UW) Data Integration: Datalog Feb. 22, 2007 1 / 12 Plan of the course 1 Datalog 2 Negation

More information

Annoucements. Where are we now? Today. A motivating example. Recursion! Lecture 21 Recursive Query Evaluation and Datalog Instructor: Sudeepa Roy

Annoucements. Where are we now? Today. A motivating example. Recursion! Lecture 21 Recursive Query Evaluation and Datalog Instructor: Sudeepa Roy Annoucements CompSci 516 Database Systems Lecture 21 Recursive Query Evaluation and Datalog Instructor: Sudeepa Roy HW3 due Monday 11/26 Next week practice pop-up quiz on transactions (all lectures) 1

More information

Semantic Forcing in Disjunctive Logic Programs

Semantic Forcing in Disjunctive Logic Programs Semantic Forcing in Disjunctive Logic Programs Marina De Vos and Dirk Vermeir Dept of Computer Science Free University of Brussels, VUB Pleinlaan 2, Brussels 1050, Belgium Abstract We propose a semantics

More information

Constraint Solving. Systems and Internet Infrastructure Security

Constraint Solving. Systems and Internet Infrastructure Security Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Constraint Solving Systems

More information

Aggregates in Recursion: Issues and Solutions

Aggregates in Recursion: Issues and Solutions Aggregates in Recursion: Issues and Solutions Alpen-Adria-Universität Klagenfurt RuleML Webinar, 2018-05-25 Outline 1 2 3 4 Coincidence Results Complexity Results : Aggregates Aggregates facilitate problem

More information

Choice Logic Programs and Nash Equilibria in Strategic Games

Choice Logic Programs and Nash Equilibria in Strategic Games Choice Logic Programs and Nash Equilibria in Strategic Games Marina De Vos and Dirk Vermeir Dept. of Computer Science Free University of Brussels, VUB Pleinlaan 2, Brussels 1050, Belgium Tel: +32 2 6293308

More information

Introduction to Finite Model Theory. Jan Van den Bussche Universiteit Hasselt

Introduction to Finite Model Theory. Jan Van den Bussche Universiteit Hasselt Introduction to Finite Model Theory Jan Van den Bussche Universiteit Hasselt 1 Books Finite Model Theory by Ebbinghaus & Flum 1999 Finite Model Theory and Its Applications by Grädel et al. 2007 Elements

More information

A Retrospective on Datalog 1.0

A Retrospective on Datalog 1.0 A Retrospective on Datalog 1.0 Phokion G. Kolaitis UC Santa Cruz and IBM Research - Almaden Datalog 2.0 Vienna, September 2012 2 / 79 A Brief History of Datalog In the beginning of time, there was E.F.

More information

Datalog Recursive SQL LogicBlox

Datalog Recursive SQL LogicBlox CS 500: Fundamentals of Databases Datalog Recursive SQL LogicBlox supplementary material: Foundations of Databases by Abiteboul, Hull, Vianu, Ch. 12 class notes slides are based on teaching materials by

More information

Chapter 5: Other Relational Languages.! Query-by-Example (QBE)! Datalog

Chapter 5: Other Relational Languages.! Query-by-Example (QBE)! Datalog Chapter 5: Other Relational Languages! Query-by-Example (QBE)! Datalog 5.1 Query-by by-example (QBE)! Basic Structure! Queries on One Relation! Queries on Several Relations! The Condition Box! The Result

More information

Datalog. Susan B. Davidson. CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309

Datalog. Susan B. Davidson.  CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309 Datalog Susan B. Davidson CIS 700: Advanced Topics in Databases MW 1:30-3 Towne 309 http://www.cis.upenn.edu/~susan/cis700/homepage.html 2017 A. Alawini, S. Davidson References Textbooks Ramakrishnan and

More information

Forcing in disjunctive logic programs

Forcing in disjunctive logic programs Forcing in disjunctive logic programs Marina De Vos Free University of Brussels, VUB marinadv@tinf1vubacbe Dirk Vermeir Free University of Brussels, VUB dvermeir@vubacbe Abstract We propose a semantics

More information

Complexity of Answering Queries Using Materialized Views

Complexity of Answering Queries Using Materialized Views Complexity of Answering Queries Using Materialized Views Serge Abiteboul, Olivier Duschka To cite this version: Serge Abiteboul, Olivier Duschka. Complexity of Answering Queries Using Materialized Views.

More information

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries.

Conjunctive queries. Many computational problems are much easier for conjunctive queries than for general first-order queries. Conjunctive queries Relational calculus queries without negation and disjunction. Conjunctive queries have a normal form: ( y 1 ) ( y n )(p 1 (x 1,..., x m, y 1,..., y n ) p k (x 1,..., x m, y 1,..., y

More information

Chapter 5: Other Relational Languages

Chapter 5: Other Relational Languages Chapter 5: Other Relational Languages Database System Concepts, 5th Ed. See www.db-book.com for conditions on re-use Chapter 5: Other Relational Languages Tuple Relational Calculus Domain Relational Calculus

More information

6. Lecture notes on matroid intersection

6. Lecture notes on matroid intersection Massachusetts Institute of Technology 18.453: Combinatorial Optimization Michel X. Goemans May 2, 2017 6. Lecture notes on matroid intersection One nice feature about matroids is that a simple greedy algorithm

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Other NP-Complete Problems Haniel Barbosa Readings for this lecture Chapter 7 of [Sipser 1996], 3rd edition. Sections 7.4 and 7.5. The 3SAT

More information

Deductive Databases. Motivation. Datalog. Chapter 25

Deductive Databases. Motivation. Datalog. Chapter 25 Deductive Databases Chapter 25 1 Motivation SQL-92 cannot express some queries: Are we running low on any parts needed to build a ZX600 sports car? What is the total component and assembly cost to build

More information

Program Analysis in Datalog

Program Analysis in Datalog CS 510/08 Program Analysis in Datalog Majority of the slides compiled from John Whaley s Outline Challenges Essential Background Using the Tools Developing Advanced Analyses Challenges Most DF analyses

More information

DATABASE THEORY. Lecture 12: Evaluation of Datalog (2) TU Dresden, 30 June Markus Krötzsch

DATABASE THEORY. Lecture 12: Evaluation of Datalog (2) TU Dresden, 30 June Markus Krötzsch DATABASE THEORY Lecture 12: Evaluation of Datalog (2) Markus Krötzsch TU Dresden, 30 June 2016 Overview 1. Introduction Relational data model 2. First-order queries 3. Complexity of query answering 4.

More information

A Simple SQL Injection Pattern

A Simple SQL Injection Pattern Lecture 12 Pointer Analysis 1. Motivation: security analysis 2. Datalog 3. Context-insensitive, flow-insensitive pointer analysis 4. Context sensitivity Readings: Chapter 12 A Simple SQL Injection Pattern

More information

arxiv: v1 [cs.db] 23 May 2016

arxiv: v1 [cs.db] 23 May 2016 Complexity of Consistent Query Answering in Databases under Cardinality-Based and Incremental Repair Semantics (extended version) arxiv:1605.07159v1 [cs.db] 23 May 2016 Andrei Lopatenko Free University

More information

1 Variations of the Traveling Salesman Problem

1 Variations of the Traveling Salesman Problem Stanford University CS26: Optimization Handout 3 Luca Trevisan January, 20 Lecture 3 In which we prove the equivalence of three versions of the Traveling Salesman Problem, we provide a 2-approximate algorithm,

More information

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

Answer Sets and the Language of Answer Set Programming. Vladimir Lifschitz Answer Sets and the Language of Answer Set Programming Vladimir Lifschitz Answer set programming is a declarative programming paradigm based on the answer set semantics of logic programs. This introductory

More information

CSE 544: Principles of Database Systems

CSE 544: Principles of Database Systems CSE 544: Principles of Database Systems Semijoin Reductions Theory Wrap-up CSE544 - Spring, 2012 1 Announcements Makeup lectures: Friday, May 18, 10:30-11:50, CSE 405 Friday, May 25, 10:30-11:50, CSE 405

More information

DATABASE THEORY. Lecture 15: Datalog Evaluation (2) TU Dresden, 26th June Markus Krötzsch Knowledge-Based Systems

DATABASE THEORY. Lecture 15: Datalog Evaluation (2) TU Dresden, 26th June Markus Krötzsch Knowledge-Based Systems DATABASE THEORY Lecture 15: Datalog Evaluation (2) Markus Krötzsch Knowledge-Based Systems TU Dresden, 26th June 2018 Review: Datalog Evaluation A rule-based recursive query language father(alice, bob)

More information

A reasoning model based on the production of acceptable. arguments

A reasoning model based on the production of acceptable. arguments A reasoning model based on the production of acceptable arguments Leila AMGOUD 1 Claudette CAYROL 2 1 Department of Electronic Engineering, Queen Mary and Westfield College University of London, London

More information

DATALOG AS A PARALLEL GENERAL PURPOSE PROGRAMMING LANGUAGE

DATALOG AS A PARALLEL GENERAL PURPOSE PROGRAMMING LANGUAGE Working Paper Series ISSN 1177-777X DATALOG AS A PARALLEL GENERAL PURPOSE PROGRAMMING LANGUAGE John G. Cleary, Mark Utting and Roger Clayton Working Paper: 06/2010 August 27, 2010 c John G. Cleary, Mark

More information

CSE-6490B Final Exam

CSE-6490B Final Exam February 2009 CSE-6490B Final Exam Fall 2008 p 1 CSE-6490B Final Exam In your submitted work for this final exam, please include and sign the following statement: I understand that this final take-home

More information

Database Theory VU , SS Codd s Theorem. Reinhard Pichler

Database Theory VU , SS Codd s Theorem. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2011 3. Codd s Theorem Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 29 March, 2011 Pichler 29 March,

More information

Chapter 3. Set Theory. 3.1 What is a Set?

Chapter 3. Set Theory. 3.1 What is a Set? Chapter 3 Set Theory 3.1 What is a Set? A set is a well-defined collection of objects called elements or members of the set. Here, well-defined means accurately and unambiguously stated or described. Any

More information

CS40-S13: Functional Completeness

CS40-S13: Functional Completeness CS40-S13: Functional Completeness Victor Amelkin victor@cs.ucsb.edu April 12, 2013 In class, we have briefly discussed what functional completeness means and how to prove that a certain system (a set)

More information

Datalog Evaluation. Linh Anh Nguyen. Institute of Informatics University of Warsaw

Datalog Evaluation. Linh Anh Nguyen. Institute of Informatics University of Warsaw Datalog Evaluation Linh Anh Nguyen Institute of Informatics University of Warsaw Outline Simple Evaluation Methods Query-Subquery Recursive Magic-Set Technique Query-Subquery Nets [2/64] Linh Anh Nguyen

More information

Foundations of Databases

Foundations of Databases Foundations of Databases Free University of Bozen Bolzano, 2004 2005 Thomas Eiter Institut für Informationssysteme Arbeitsbereich Wissensbasierte Systeme (184/3) Technische Universität Wien http://www.kr.tuwien.ac.at/staff/eiter

More information

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

Knowledge Representation. CS 486/686: Introduction to Artificial Intelligence Knowledge Representation CS 486/686: Introduction to Artificial Intelligence 1 Outline Knowledge-based agents Logics in general Propositional Logic& Reasoning First Order Logic 2 Introduction So far we

More information

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions.

THREE LECTURES ON BASIC TOPOLOGY. 1. Basic notions. THREE LECTURES ON BASIC TOPOLOGY PHILIP FOTH 1. Basic notions. Let X be a set. To make a topological space out of X, one must specify a collection T of subsets of X, which are said to be open subsets of

More information

Exercises Computational Complexity

Exercises Computational Complexity Exercises Computational Complexity March 22, 2017 Exercises marked with a are more difficult. 1 Chapter 7, P and NP Exercise 1. Suppose some pancakes are stacked on a surface such that no two pancakes

More information

Complexity Classes and Polynomial-time Reductions

Complexity Classes and Polynomial-time Reductions COMPSCI 330: Design and Analysis of Algorithms April 19, 2016 Complexity Classes and Polynomial-time Reductions Lecturer: Debmalya Panigrahi Scribe: Tianqi Song 1 Overview In this lecture, we introduce

More information

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

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 Principles of AI Planning June 8th, 2010 7. Planning as search: relaxed planning tasks Principles of AI Planning 7. Planning as search: relaxed planning tasks Malte Helmert and Bernhard Nebel 7.1 How to

More information

Theorem 2.9: nearest addition algorithm

Theorem 2.9: nearest addition algorithm There are severe limits on our ability to compute near-optimal tours It is NP-complete to decide whether a given undirected =(,)has a Hamiltonian cycle An approximation algorithm for the TSP can be used

More information

Finding a winning strategy in variations of Kayles

Finding a winning strategy in variations of Kayles Finding a winning strategy in variations of Kayles Simon Prins ICA-3582809 Utrecht University, The Netherlands July 15, 2015 Abstract Kayles is a two player game played on a graph. The game can be dened

More information

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture

Homework 1. Due Date: Wednesday 11/26/07 - at the beginning of the lecture Homework 1 Due Date: Wednesday 11/26/07 - at the beginning of the lecture Problems marked with a [*] are a littlebit harder and count as extra credit. Note 1. For any of the given problems make sure that

More information

Answer Set Programming

Answer Set Programming V. Answer Set Programming 1 Answer Set Programming Answer Set Programs Answer Set Semantics Implementation Techniques Using Answer Set Programming V. Answer Set Programming 2 Example ASP: 3-Coloring Problem:

More information

Computer Science Technical Report

Computer Science Technical Report Computer Science Technical Report Feasibility of Stepwise Addition of Multitolerance to High Atomicity Programs Ali Ebnenasir and Sandeep S. Kulkarni Michigan Technological University Computer Science

More information

CSCI-6421 Final Exam York University Fall Term 2004

CSCI-6421 Final Exam York University Fall Term 2004 6 December 2004 CS-6421 Final Exam p. 1 of 7 CSCI-6421 Final Exam York University Fall Term 2004 Due: 6pm Wednesday 15 December 2004 Last Name: First Name: Instructor: Parke Godfrey Exam Duration: take

More information

Outline. Implementing a basic general game player. Foundations of logic programming. Metagaming: rule optimisation. Logic Programming.

Outline. Implementing a basic general game player. Foundations of logic programming. Metagaming: rule optimisation. Logic Programming. Outline 1 Implementing a basic general game player Foundations of logic programming Metagaming: rule optimisation 2 Uses of Logic Use logical reasoning for game play Computing the legality of moves Computing

More information

10.3 Recursive Programming in Datalog. While relational algebra can express many useful operations on relations, there

10.3 Recursive Programming in Datalog. While relational algebra can express many useful operations on relations, there 1 10.3 Recursive Programming in Datalog While relational algebra can express many useful operations on relations, there are some computations that cannot be written as an expression of relational algebra.

More information

Safe Stratified Datalog With Integer Order Does not Have Syntax

Safe Stratified Datalog With Integer Order Does not Have Syntax Safe Stratified Datalog With Integer Order Does not Have Syntax Alexei P. Stolboushkin Department of Mathematics UCLA Los Angeles, CA 90024-1555 aps@math.ucla.edu Michael A. Taitslin Department of Computer

More information

arxiv: v1 [cs.db] 10 Dec 2018

arxiv: v1 [cs.db] 10 Dec 2018 Scaling-Up In-Memory Datalog Processing: Observations and Techniques Zhiwei Fan, Jianqiao Zhu, Zuyu Zhang, Aws Albarghouthi, Paraschos Koutris, Jignesh Patel University of Wisconsin-Madison Madison, WI,

More information

Negation wrapped inside a recursion makes no. separated, there can be ambiguity about what. the rules mean, and some one meaning must

Negation wrapped inside a recursion makes no. separated, there can be ambiguity about what. the rules mean, and some one meaning must Stratied Negation Negation wrapped inside a recursion makes no sense. Even when negation and recursion are separated, there can be ambiguity about what the rules mean, and some one meaning must be selected.

More information

Lecture 22 Acyclic Joins and Worst Case Join Results Instructor: Sudeepa Roy

Lecture 22 Acyclic Joins and Worst Case Join Results Instructor: Sudeepa Roy CompSci 516 ata Intensive Computing Systems Lecture 22 Acyclic Joins and Worst Case Join Results Instructor: Sudeepa Roy uke CS, Fall 2016 CompSci 516: ata Intensive Computing Systems Announcements Final

More information

Shannon Switching Game

Shannon Switching Game EECS 495: Combinatorial Optimization Lecture 1 Shannon s Switching Game Shannon Switching Game In the Shannon switching game, two players, Join and Cut, alternate choosing edges on a graph G. Join s objective

More information

Chapter 3: Propositional Languages

Chapter 3: Propositional Languages Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical

More information

CS781 Lecture 2 January 13, Graph Traversals, Search, and Ordering

CS781 Lecture 2 January 13, Graph Traversals, Search, and Ordering CS781 Lecture 2 January 13, 2010 Graph Traversals, Search, and Ordering Review of Lecture 1 Notions of Algorithm Scalability Worst-Case and Average-Case Analysis Asymptotic Growth Rates: Big-Oh Prototypical

More information

Inverting Schema Mappings: Bridging the Gap between Theory and Practice

Inverting Schema Mappings: Bridging the Gap between Theory and Practice Inverting Schema Mappings: Bridging the Gap between Theory and Practice Marcelo Arenas Jorge Pérez Juan Reutter Cristian Riveros PUC Chile PUC Chile PUC Chile R&M Tech marenas@ing.puc.cl jperez@ing.puc.cl

More information

SQL, DLs, Datalog, and ASP: comparison

SQL, DLs, Datalog, and ASP: comparison SQL, DLs, Datalog, and ASP: comparison Riccardo Rosati Knowledge Representation and Semantic Technologies Corso di Laurea in Ingegneria informatica Sapienza Università di Roma 2014/2015 CWA vs. OWA DLs

More information

Binary Decision Diagrams

Binary Decision Diagrams Logic and roof Hilary 2016 James Worrell Binary Decision Diagrams A propositional formula is determined up to logical equivalence by its truth table. If the formula has n variables then its truth table

More information

CS 512, Spring 2017: Take-Home End-of-Term Examination

CS 512, Spring 2017: Take-Home End-of-Term Examination CS 512, Spring 2017: Take-Home End-of-Term Examination Out: Tuesday, 9 May 2017, 12:00 noon Due: Wednesday, 10 May 2017, by 11:59 am Turn in your solutions electronically, as a single PDF file, by placing

More information

Lecture 4: January 12, 2015

Lecture 4: January 12, 2015 32002: AI (First Order Predicate Logic, Interpretation and Inferences) Spring 2015 Lecturer: K.R. Chowdhary Lecture 4: January 12, 2015 : Professor of CS (VF) Disclaimer: These notes have not been subjected

More information

Intermediate Math Circles Wednesday, February 22, 2017 Graph Theory III

Intermediate Math Circles Wednesday, February 22, 2017 Graph Theory III 1 Eulerian Graphs Intermediate Math Circles Wednesday, February 22, 2017 Graph Theory III Let s begin this section with a problem that you may remember from lecture 1. Consider the layout of land and water

More information

Computing Full Disjunctions

Computing Full Disjunctions Computing Full Disjunctions (Extended Abstract) Yaron Kanza School of Computer Science and Engineering The Hebrew University of Jerusalem yarok@cs.huji.ac.il Yehoshua Sagiv School of Computer Science and

More information

A SHARKOVSKY THEOREM FOR VERTEX MAPS ON TREES

A SHARKOVSKY THEOREM FOR VERTEX MAPS ON TREES A SHARKOVSKY THEOREM FOR VERTEX MAPS ON TREES CHRIS BERNHARDT Abstract. Let T be a tree with n vertices. Let f : T T be continuous and suppose that the n vertices form a periodic orbit under f. We show:

More information

PROBABILISTIC GRAPHICAL MODELS SPECIFIED BY PROBABILISTIC LOGIC PROGRAMS: SEMANTICS AND COMPLEXITY

PROBABILISTIC GRAPHICAL MODELS SPECIFIED BY PROBABILISTIC LOGIC PROGRAMS: SEMANTICS AND COMPLEXITY PROBABILISTIC GRAPHICAL MODELS SPECIFIED BY PROBABILISTIC LOGIC PROGRAMS: SEMANTICS AND COMPLEXITY Fabio G. Cozman and Denis D. Mauá Universidade de São Paulo, Brazil September 8, 2016 1 / 23 Many languages

More information

Advanced Combinatorial Optimization September 17, Lecture 3. Sketch some results regarding ear-decompositions and factor-critical graphs.

Advanced Combinatorial Optimization September 17, Lecture 3. Sketch some results regarding ear-decompositions and factor-critical graphs. 18.438 Advanced Combinatorial Optimization September 17, 2009 Lecturer: Michel X. Goemans Lecture 3 Scribe: Aleksander Madry ( Based on notes by Robert Kleinberg and Dan Stratila.) In this lecture, we

More information

5. Lecture notes on matroid intersection

5. Lecture notes on matroid intersection Massachusetts Institute of Technology Handout 14 18.433: Combinatorial Optimization April 1st, 2009 Michel X. Goemans 5. Lecture notes on matroid intersection One nice feature about matroids is that a

More information

Datalog. S. Costantini

Datalog. S. Costantini Datalog S. Costantini stefcost@di.univaq.it Engineering IgTechnology Maggioli Informatica Micron Technology Neta Nous Informatica Nikesoft SED Siemens CNX Taiprora Telespazio 2 A Logical Rule» The next

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam

More information

Finite Model Theory and Its Applications

Finite Model Theory and Its Applications Erich Grädel Phokion G. Kolaitis Leonid Libkin Maarten Marx Joel Spencer Moshe Y. Vardi Yde Venema Scott Weinstein Finite Model Theory and Its Applications With 35 Figures and 2 Tables Springer Contents

More information

NP versus PSPACE. Frank Vega. To cite this version: HAL Id: hal https://hal.archives-ouvertes.fr/hal

NP versus PSPACE. Frank Vega. To cite this version: HAL Id: hal https://hal.archives-ouvertes.fr/hal NP versus PSPACE Frank Vega To cite this version: Frank Vega. NP versus PSPACE. Preprint submitted to Theoretical Computer Science 2015. 2015. HAL Id: hal-01196489 https://hal.archives-ouvertes.fr/hal-01196489

More information

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics 400 lecture note #4 [Ch 6] Set Theory 1. Basic Concepts and Definitions 1) Basics Element: ; A is a set consisting of elements x which is in a/another set S such that P(x) is true. Empty set: notated {

More information

Towards a Logical Reconstruction of Relational Database Theory

Towards a Logical Reconstruction of Relational Database Theory Towards a Logical Reconstruction of Relational Database Theory On Conceptual Modelling, Lecture Notes in Computer Science. 1984 Raymond Reiter Summary by C. Rey November 27, 2008-1 / 63 Foreword DB: 2

More information

Knowledge-Based Systems and Deductive Databases

Knowledge-Based Systems and Deductive Databases Knowledge-Based Systems and Deductive Databases Wolf-Tilo Balke Jan-Christoph Kalo Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de 4.0 Last Lecture Given

More information

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch] NP Completeness Andreas Klappenecker [partially based on slides by Jennifer Welch] Overview We already know the following examples of NPC problems: SAT 3SAT We are going to show that the following are

More information

Condition Using Constraints. Stratication conditions for logic programs aim to ensure a two-valued semantics

Condition Using Constraints. Stratication conditions for logic programs aim to ensure a two-valued semantics A Syntactic Stratication Condition Using Constraints Kenneth A. Ross Department of Computer Science Columbia University New York, NY 10027 kar@cs.columbia.edu Abstract Stratication conditions for logic

More information

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL: Notes slides from before lecture CSE 21, Winter 2017, Section A00 Lecture 9 Notes Class URL: http://vlsicad.ucsd.edu/courses/cse21-w17/ Notes slides from before lecture Notes February 8 (1) HW4 is due

More information

Finding Strongly Connected Components

Finding Strongly Connected Components Yufei Tao ITEE University of Queensland We just can t get enough of the beautiful algorithm of DFS! In this lecture, we will use it to solve a problem finding strongly connected components that seems to

More information

SAT-CNF Is N P-complete

SAT-CNF Is N P-complete SAT-CNF Is N P-complete Rod Howell Kansas State University November 9, 2000 The purpose of this paper is to give a detailed presentation of an N P- completeness proof using the definition of N P given

More information

Web Science & Technologies University of Koblenz Landau, Germany. Stratified Programs

Web Science & Technologies University of Koblenz Landau, Germany. Stratified Programs Web Science & Technologies University of Koblenz Landau, Germany Stratified Programs Consistency Observation: Every normal program is consistent (has a model), but this is not necessarily true for comp(p).

More information

Translation of Aggregate Programs to Normal Logic Programs

Translation of Aggregate Programs to Normal Logic Programs Translation of Aggregate rograms to Normal Logic rograms Nikolay elov arc Denecker and aurice Bruynooghe Dept. of Computer Science.U.Leuven Celestijnenlaan 00A B-3001 Heverlee Belgium E-mail: pelovmarcdmaurice

More information

Lecture 11: Feb. 10, 2016

Lecture 11: Feb. 10, 2016 CS323: AI (Hands on with Prolog) Spring 2016 Lecturer: K.R. Chowdhary Lecture 11: Feb. 10, 2016 : Professor of CS (VF) Disclaimer: These notes have not been subjected to the usual scrutiny reserved for

More information