Implementation Techniques
|
|
- Kristian Greene
- 5 years ago
- Views:
Transcription
1 Web Science & Technologies University of Koblenz Landau, Germany Implementation Techniques Acknowledgements to Angele, Gehrke, STI
2 Word of Caution There is not the one silver bullet In actual systems, different techniques are combined 2 of 63
3 Many further techniques Truth maintenance Tabling Tail elimination Compilation into SAT solvers (especially for EDLP) Optimization of information passing (comparable to join ordering). Plus extensions for External predicates, connection to relational databases Combinations with first order logics Arithmetics. What may help in one case may cause harm in another one! 3 of 63
4 Forward Chaining w Naive Evaluation w Semi-naive evaluation Backward Chaining w SLDNF / Prolog w Dynamic Filtering Magic Sets Alternating Fixpoint 4 of 63
5 Example knowledge base The law says that it is a crime for an American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American. Prove that Col. West is a criminal 5 of 63
6 Example knowledge base contd.... it is a crime for an American to sell weapons to hostile nations: American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x) Nono has some missiles, i.e., x Owns(Nono,x) Missile(x): Owns(Nono,M 1 ) Missile(M 1 ) all of its missiles were sold to it by Colonel West Missile(x) Owns(Nono,x) Sells(West,x,Nono) Missiles are weapons: Missile(x) Weapon(x) An enemy of America counts as "hostile : Enemy(x,America) Hostile(x) West, who is American American(West) The country Nono, an enemy of America Enemy(Nono,America) 6 of 63
7 Forward chaining algorithm / Naïve evaluation T ω 7 of 63
8 Forward chaining proof 8 of 63
9 Forward chaining proof 9 of 63
10 Forward chaining proof 10 of 63
11 Properties of forward chaining Sound and complete for first-order definite Horn clauses, which means that it computes all entailed facts correctly. Datalog = first-order definite clauses + no functions FC terminates for Datalog in finite number of iterations May not terminate in general if α is not entailed w This is unavoidable: entailment with definite clauses is semi-decidable 11 of 63
12 Efficiency of forward chaining Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't added on iteration k-1 w match each rule whose premise contains a newly added positive literal Magic Sets: rewriting the rule set, using information from the goal, so that only relevant bindings are considered during forward chaining Magic_Criminal(x) American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x) add Magic_Criminal(West) to the KB Matching itself can be expensive w Database indexing allows O(1) retrieval of known facts: for a given fact it is possible to construct indices on all possible queries that unify with it w Subsumption lattice can get very large; the costs of storing and maintaining the indices must not outweigh the cost for facts retrieval. Forward chaining is widely used in deductive databases 12 of 63
13 Backward chaining algorithm 13 of 63
14 Backward chaining example 14 of 63
15 Backward chaining example 15 of 63
16 Backward chaining example 16 of 63
17 Backward chaining example 17 of 63
18 Backward chaining example 18 of 63
19 Backward chaining example 19 of 63
20 Backward chaining example 20 of 63
21 Properties of backward chaining Depth-first recursive proof search: space is linear in size of proof Incomplete due to infinite loops w can be fixed by applying breadth-first search Inefficient due to repeated sub-goals (both success and failure) w can be fixed using caching of previous results (extra space) Widely used for logic programming 21 of 63
22 Resolution strategies Unit preference w clauses with just one literal are preferred w Unit resolution incomplete in general, complete for Horn KB Set of support w at least one of the clauses makes part from the set of support w complete if the remainder of the sentences are jointly satisfiable w Using the negated query as set-of-support Input resolution w at least one of the clauses makes part from the initial KB or the query w Complete for Horn, incomplete in the general case w Linear resolution: P and Q can be resolved if P is in the original KB or P is an ancestor of Q in the proof tree; complete Subsumption: all sentences subsumed by others in the KB are eliminated 22 of 63
23 SLDNF / Prolog - In each resolution step unification is applied! - green: goal - red: KB rules 23 of 63
24 Comparison Forward/Backward Chaining Advantage Forward Chaining: w Computing join is more efficient than nested-loop implicit in backward chaining Advantage Backward Chaining: w Avoiding the computation of the whole fixpoint 24 of 63
25 Summary Proof algorithms, are only semi-decidable i.e., might not terminate for non-entailed queries Propositionalization instantiating quantifiers: slow Unification makes the instantiation step unnecessary Complete for definite clauses; semi-decidable w Forward-chaining w Backward-chaining w decidable for Datalog Strategies for reducing the search space of a resolution system required 25 of 63
26 OPTIMIZATIONS 26 of 63
27 Example wheel 3 1 frame spoke tire seat pedal 1 1 rim tube Find components of! Are we running low on any parts needed to build a? What is total component and assembly cost to build at today's part prices? wheel 3 frame 1 frame seat 1 frame pedal 1 wheel spoke 2 wheel tire 1 tire rim 1 tire tube 1 Assembly instance of 63 part subpart number
28 Datalog Query that Does the Job Comp(Part, Subpt) :- Assembly(Part, Subpt, Qty). Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), Comp(Part2, Subpt) of 63
29 Example Comp(Part, Subpt) :- Assembly(Part, Subpt, Qty). Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), Comp(Part2, Subpt). For any instance of Assembly, we compute all Comp tuples by repeatedly applying two rules. Actually: we can apply Rule 1 just once, then apply Rule 2 repeatedly. Rule1 ~ projection Rule2 ~ cross-product with equality join of 63
30 wheel 3 frame 1 frame seat 1 frame pedal 1 wheel spoke 2 wheel tire 1 tire rim 1 tire tube 1 Assembly instance wheel wheel spoke tire seat pedal rim tube Comp tuples by applying Rule 2 once wheel wheel of 63 spoke tire seat pedal rim tube rim tube Comp tuples by applying Rule 2 twice Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), Comp(Part2, Subpt).
31 Example For any instance of Assembly, we can compute all Comp tuples by repeatedly applying the two rules. (Actually, we can apply Rule 1 just once, then apply Rule 2 repeatedly.) wheel wheel spoke tire seat pedal rim tube Comp tuples got by applying Rule 2 once wheel wheel spoke tire seat pedal rim tube rim tube Comp tuples got by applying Rule 2 twice of 63
32 Evaluation of Datalog Programs Avoid Repeated inferences: Avoid Unnecessary inferences: of 63
33 Query Optimization # of 63
34 Evaluation of Datalog Programs Avoid Repeated inferences: When recursive rules are repeatedly applied in naïve way, we make same inferences in several iterations of 63
35 wheel 3 frame 1 frame seat 1 frame pedal 1 wheel spoke 2 wheel tire 1 tire rim 1 tire tube 1 Assembly instance wheel wheel spoke tire seat pedal rim tube Comp tuples by applying Rule 2 once wheel wheel of 63 spoke tire seat pedal rim tube rim tube Comp tuples by applying Rule 2 twice Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), Comp(Part2, Subpt).
36 Avoiding Repeated Inferences Semi-naive Fixpoint Evaluation: Ensure that when rule is applied, at least one of body facts used was generated in most recent iteration. Such new inference could not have been carried out in earlier iterations of 63
37 Avoiding Repeated Inferences Idea: For each recursive table P, use table delta_p to store P tuples generated in previous iteration. w 1. Rewrite program to use delta tables w 2. Update delta tables between iterations. Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), Comp(Part2, Subpt). Comp(Part, Subpt) :- Assembly(Part, Part2, Qty), delta_comp(part2, Subpt) of 63
38 Query Optimization # of 63
39 Evaluation of Datalog Programs Unnecessary inferences: w If we just want to find components of a particular part, say wheel, then first computing general fixpoint of Comp program and then at end selecting tuples with wheel in the first column is wasteful. This would compute many irrelevant facts of 63
40 Avoiding Unnecessary Inferences SameLev(S1,S2) :- Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev(S1,S2) :- Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2). 3 1 wheel frame spoke tire seat pedal 1 1 rim tube 40 of 63
41 Avoiding Unnecessary Inferences SameLev(S1,S2) :- Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev(S1,S2) :- Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2). Tuple (S1,S2) in SameLev if there is path up from S1 to some node and down to S2 with same number of up and down edges. wheel of 63 frame spoke tire seat pedal 1 1 rim tube
42 Avoiding Unnecessary Inferences Want all SameLev tuples with spoke in first column. Intuition: Push this selection into fixpoint computation. How do that? SameLev(S1,S2) :- Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2). SameLev(spoke,S2) :- Assembly(P1,spoke,Q1), SameLev(P1?=spoke?,P2), Assembly(P2,S2,Q2) of 63
43 Avoiding Unnecessary Inferences Intuition: Push this selection with spoke into fixpoint computation. SameLev(S1,S2) :- Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2). SameLev(spoke,S2) :- Assembly(P1,spoke,Q1), SameLev(P1,P2 Assembly(P2,S2,Q2). SameLev(spoke,seat) :- Assembly(wheel,spoke,2), SameLev(wheel,frame), Assembly(frame,seat,1). n Other SameLev tuples are needed to compute all such tuples with spoke, e.g. wheel of 63
44 Magic Sets Idea 1. Define filter table that computes all relevant values 2. Restrict computation of SameLev to infer only tuples with relevant value in first column of 63
45 Intuition Relevant values: contains all tuples m for which we have to compute all same-level tuples with m in first column to answer query. Put differently, relevant values are all Same-Level tuples whose first field contains value on path from spoke up to root. We call it Magic-SameLevel (Magic-SL) of 63
46 Magic Sets in Example Idea: Define filter table that computes all relevant values : Collect all parents of spoke. Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1). Magic_SL(spoke) :-. Make Magic table as Magic-SameLevel of 63
47 Magic Sets Idea Idea: Use filter table to restrict the computation of SameLev. Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1). Magic(spoke). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2) of 63
48 Magic Sets Idea Idea: Define filter table that computes all relevant values, and restrict the computation of SameLev correspondingly. Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1). Magic(spoke). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2) of 63
49 The Magic Sets Algorithm 1. Generate an adorned program Program is rewritten to make pattern of bound and free arguments in query explicit 2. Add magic filters of form Magic_P for each rule in adorned program add a Magic condition to body that acts as filter on set of tuples generated (predicate P to restrict these rules) 3. Define new rules to define filter tables Define new rules to define filter tables of form Magic_P of 63
50 Step 1:Generating Adorned Rules Adorned program for query pattern SameLev bf, assuming left-to-right order of rule evaluation : SameLev bf (S1,S2) :- Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev bf (S1,S2) :- Assembly(P1,S1,Q1), SameLev bf (P1,P2), Assembly(P2,S2,Q2). v v Argument of (a given body occurrence of) SameLev is: v b if it appears to the left in body, v or if it is a b argument of head of rule, v Otherwise it is free. Assembly not adorned because explicitly stored table. 50 of 63
51 Step 2: Add Magic Filters For every rule in adorned program add a magic filter predicate SameLev bf (S1,S2) :- Magic_SL (S1), Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev bf (S1,S2) :- Magic_SL (S1), Assembly(P1,S1,Q1), SameLev bf (P1,P2), Assembly(P2,S2,Q2). Filter predicate: copy of head of rule, Magic prefix, and delete free variable of 63
52 Step 3:Defining Magic Tables Rule for Magic_P is generated from each occurrence of recursive P in body of rule: w Delete everything to right of P w Add prefix Magic and delete free columns of P w Move P, with these changes, into head of rule of 63
53 Step 3:Defining Magic Table Rule for Magic_P is generated from each occurrence O of recursive P in body of rule: w Delete everything to right of P SameLev bf (S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), SameLev bf (P1,P2), Assembly(P2,S2,Q2). w Add prefix Magic and delete free columns of P Magic-SameLev bf (S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), Magic-SameLev bf (P1 ). w Move P, with these changes, into head of rule Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1) of 63
54 Step 3:Defining Magic Tables Rule for Magic_P is generated from each occurrence of P in body of such rule: SameLev bf (S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), SameLev bf (P1,P2), Assembly(P2,S2,Q2). Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1). 54 of 63
55 Magic Sets Idea Define filter table that computes all relevant values: Restrict computation of SameLev Magic_SL(P1) :- Magic_SL(S1), Assembly(P1,S1,Q1). Magic(spoke). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), Assembly(P1,S2,Q2). SameLev(S1,S2) :- Magic_SL(S1), Assembly(P1,S1,Q1), SameLev(P1,P2), Assembly(P2,S2,Q2) of 63
56 DYNAMIC FILTERING 56 of 63
57 Dynamic Filtering (Kifer) q(f(a), a), q(a,c), q(f(c),c), r(a, c), r(c, d), r(e,c) p(x, Y) q(f(x), X) r(x, Y) p(x, c) p(x, c) X, c a a, c a, a a, c e, c p(x, Y) q(f(x), X) r(x, Y) f(a), a f(e), e f(a), a q(f(a), a) q(a,c) q(f(c),c) X, c a, c e, c r(a, c) r(c, d) r(e, c) 57 of 63
58 Dynamic Filtering: Problem Negation a f(c) a f(c) q(x, c) not p(x, c) X, c a, c a, a a, c p(x, Y) q(f(x), X) r(x, Y) X, c a, c f(c),c f(a), a f(a), a q(f(a), a) q(a,c) q(f(c),c) X, c r(a, c) r(c,d) r(e,f) 58 of 63
59 Dynamic Filtering: Stratification a f(c) a f(c) q(x, c) not p(x, c) Level 2 X, c a, c a, a a, c p(x, Y) q(f(x), X) r(x, Y) Level 1 X, c a, c f(c), c f(a), a f(a), a q(f(a), a) q(a,c) q(f(c),c) X, c r(a, c) r(c,d) r(e,f) Level 0 59 of 63
60 ALTERNATING FIXPOINT 60 of 63
61 What about the following? person(somebody). woman(x) <- person(x) and not man(x). man(x) <- person(x) and not woman(x). 61 of 63
62 Alternating Fixed Point (Well-Founded Semantics) Van Gelder et al., JACM 1991, If there exists some n: T n+1 (I) = T n-1 (I) and T n+2 (I) = T n (I) Then the true facts are defined by the smaller sets of T n-1 (I) and T n (I) Unknown facts are given by set difference. 62 of 63
63 Alternating Fixed Point: Example person(sb). woman(x) <- person(x) and not man(x). man(x) <- person(x) and not woman(x). T(I={person{sb}}) = {woman(sb), man(sb), person(sb)} T(T(I)) = {person(sb)} T(T(T(I))) = {woman(sb), man(sb), person(sb)} T(T(T(T(I)))) = {person(sb)} True Facts = {person(sb)} Unknown Facts = {woman(sb), man(sb)} Very expensive L 63 of 63
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 informationOutline. Forward chaining Backward chaining Resolution. West Knowledge Base. Forward chaining algorithm. Resolution-Based Inference.
Resolution-Based Inference Outline R&N: 9.3-9.6 Michael Rovatsos University of Edinburgh Forward chaining Backward chaining Resolution 10 th February 2015 Forward chaining algorithm West Knowledge Base
More informationFirst Order Logic. Introduction to AI Bert Huang
First Order Logic Introduction to AI Bert Huang Review Propositional logic syntax and semantics Inference in propositional logic: table, inference rules, resolution Horn clauses, forward/backward chaining
More informationInf2D 12: Resolution-Based Inference
School of Informatics, University of Edinburgh 09/02/18 Slide Credits: Jacques Fleuriot, Michael Rovatsos, Michael Herrmann Last time Unification: Given α and β, find θ such that αθ = βθ Most general unifier
More informationResolution in FOPC. Deepak Kumar November Knowledge Engineering in FOPC
Resolution in FOPC Deepak Kumar November 2017 Knowledge Engineering in FOPC Identify the task Assemble relevant knowledge Decide on a vocabulary of predicates, functions, and constants Encode general knowledge
More informationFoundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation
More informationCS 8520: Artificial Intelligence
CS 8520: Artificial Intelligence Logical Agents and First Order Logic Paula Matuszek Spring 2013 1 References These slides draw from a number of sources, including: Hwee Tou Ng, http://aima.eecs.berkeley.edu/
More informationDatalog 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 informationINF5390 Kunstig intelligens. First-Order Logic. Roar Fjellheim
INF5390 Kunstig intelligens First-Order Logic Roar Fjellheim Outline Logical commitments First-order logic First-order inference Resolution rule Reasoning systems Summary Extracts from AIMA Chapter 8:
More informationCPSC 304 Introduction to Database Systems
CPSC 304 Introduction to Database Systems Datalog & Deductive Databases Textbook Reference Database Management Systems: Sections 24.1 24.4 Hassan Khosravi Borrowing many slides from Rachel Pottinger Databases:
More informationAdvances in Data Management Beyond records and objects A.Poulovassilis
1 Advances in Data Management Beyond records and objects A.Poulovassilis 1 Stored procedures and triggers So far, we have been concerned with the storage of data in databases. However, modern DBMSs also
More information}Optimization Formalisms for recursive queries. Module 11: Optimization of Recursive Queries. Module Outline Datalog
Module 11: Optimization of Recursive Queries 11.1 Formalisms for recursive queries Examples for problems requiring recursion: Module Outline 11.1 Formalisms for recursive queries 11.2 Computing recursive
More information}Optimization. Module 11: Optimization of Recursive Queries. Module Outline
Module 11: Optimization of Recursive Queries Module Outline 11.1 Formalisms for recursive queries 11.2 Computing recursive queries 11.3 Partial transitive closures User Query Transformation & Optimization
More informationCS S-10 First Order Logic 1
CS662-2013S-10 First Order Logic 1 10-0: Representation Propositional Logic has several nice features Lets us easily express disjunction and negation There is a pit in (1,1) or in (2,2) There is not a
More informationLecture 17 of 41. Clausal (Conjunctive Normal) Form and Resolution Techniques
Lecture 17 of 41 Clausal (Conjunctive Normal) Form and Resolution Techniques Wednesday, 29 September 2004 William H. Hsu, KSU http://www.kddresearch.org http://www.cis.ksu.edu/~bhsu Reading: Chapter 9,
More informationKnowledge 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 informationLogical reasoning systems
Logical reasoning systems Theorem provers and logic programming languages Production systems Frame systems and semantic networks Description logic systems CS 561, Session 19 1 Logical reasoning systems
More informationCSL105: Discrete Mathematical Structures. Ragesh Jaiswal, CSE, IIT Delhi
is another way of showing that an argument is correct. Definitions: Literal: A variable or a negation of a variable is called a literal. Sum and Product: A disjunction of literals is called a sum and a
More informationRange 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 informationDATABASE 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 informationConjunctive 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 informationLogic Languages. Hwansoo Han
Logic Languages Hwansoo Han Logic Programming Based on first-order predicate calculus Operators Conjunction, disjunction, negation, implication Universal and existential quantifiers E A x for all x...
More informationDATABASE 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 informationResolution (14A) Young W. Lim 6/14/14
Copyright (c) 2013-2014. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free
More informationNotes for Chapter 12 Logic Programming. The AI War Basic Concepts of Logic Programming Prolog Review questions
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions The AI War How machines should learn: inductive or deductive? Deductive: Expert => rules =>
More informationFOUNDATIONS 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 informationKnowledge Representation and Reasoning Logics for Artificial Intelligence
Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State
More informationCOMP2411 Lecture 20: Logic Programming Examples. (This material not in the book)
COMP2411 Lecture 20: Logic Programming Examples (This material not in the book) There are several distinct but often equivalent ways to think about logic programs 1. As computing logical consequences of
More informationConstraint 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 informationAutomated Reasoning PROLOG and Automated Reasoning 13.4 Further Issues in Automated Reasoning 13.5 Epilogue and References 13.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution Theorem Proving 13.3 PROLOG and Automated Reasoning 13.4
More informationProgram 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 informationCOMP4418 Knowledge Representation and Reasoning
COMP4418 Knowledge Representation and Reasoning Week 3 Practical Reasoning David Rajaratnam Click to edit Present s Name Practical Reasoning - My Interests Cognitive Robotics. Connect high level cognition
More informationWeb 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 informationArtificial Intelligence. Chapters Reviews. Readings: Chapters 3-8 of Russell & Norvig.
Artificial Intelligence Chapters Reviews Readings: Chapters 3-8 of Russell & Norvig. Topics covered in the midterm Solving problems by searching (Chap. 3) How to formulate a search problem? How to measure
More informationEncyclopedia of Database Systems, Editors-in-chief: Özsu, M. Tamer; Liu, Ling, Springer, MAINTENANCE OF RECURSIVE VIEWS. Suzanne W.
Encyclopedia of Database Systems, Editors-in-chief: Özsu, M. Tamer; Liu, Ling, Springer, 2009. MAINTENANCE OF RECURSIVE VIEWS Suzanne W. Dietrich Arizona State University http://www.public.asu.edu/~dietrich
More informationHANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING
HANDBOOK OF LOGIC IN ARTIFICIAL INTELLIGENCE AND LOGIC PROGRAMMING Volume 5 Logic Programming Edited by DOV M. GABBAY and C. J. HOGGER Imperial College of Science, Technology and Medicine London and J.
More informationUniversity of Innsbruck
STI INNSBRUCK SEMANTIC TECHNOLOGY INSTITUTE University of Innsbruck Semantic Technology Institute Extension of a Datalog Reasoner with Top-Down Evaluation Bachelor Thesis Christoph Fuchs Ing.-Sigl-Strae
More informationLogic Programming and Resolution Lecture notes for INF3170/4171
Logic Programming and Resolution Lecture notes for INF3170/4171 Leif Harald Karlsen Autumn 2015 1 Introduction This note will explain the connection between logic and computer programming using Horn Clauses
More informationTabled Resolution. CSE 595 Semantic Web Instructor: Dr. Paul Fodor Stony Brook University
Tabled Resolution CSE 595 Semantic Web Instructor: Dr. Paul Fodor Stony Brook University http://www3.cs.stonybrook.edu/~pfodor/courses/cse595.html 1 Recap: OLD Resolution Prolog follows OLD resolution
More informationFoundations 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 informationResolution in FO logic (Ch. 9)
Resolution in FO logic (Ch. 9) Review: CNF form Conjunctive normal form is a number of clauses stuck together with ANDs Each clause can only contain ORs, and logical negation must appears right next to
More informationLecture 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 informationINFERENCE IN FIRST-ORDER LOGIC
A-PDF Split DEMO : Purchase from www.a-pdf.com to remove the watermark 9 INFERENCE IN FIRST-ORDER LOGIC In which we dejine eflective procedures for answering questions posed in jirstorder logic. Chapter
More informationData 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 informationLogic 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 information6.034 Notes: Section 11.1
6.034 Notes: Section 11.1 Slide 11.1.1 We've now spent a fair bit of time learning about the language of first-order logic and the mechanisms of automatic inference. And, we've also found that (a) it is
More informationChapter 16. Logic Programming. Topics. Unification. Resolution. Prolog s Search Strategy. Prolog s Search Strategy
Topics Chapter 16 Logic Programming Summary (resolution, unification, Prolog search strategy ) Disjoint goals The cut operator Negative goals Predicate fail Debugger / tracer Lists 2 Resolution Resolution
More information8. 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 informationDATABASE 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 informationsimplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion procedural and declarative semantics and & or
simplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion simple and/or composition of goals hides complex control patterns not easily represented by traditional
More informationData 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 informationINTRODUCTION TO PROLOG
INTRODUCTION TO PROLOG PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/44 STRUCTURE OF A PROLOG PROGRAM Where, declaratively, Haskell expresses a computation as a system
More informationDatabase 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 informationDescription Logics Reasoning Algorithms Concluding Remarks References. DL Reasoning. Stasinos Konstantopoulos. IIT, NCSR Demokritos
Stasinos Konstantopoulos 10-3-2006 Overview Description Logics Definitions Some Family Members Reasoning Algorithms Introduction Resolution Calculus Tableau Calculus Concluding Remarks Definitions The
More informationevaluation using Magic Sets optimization has time complexity less than or equal to a particular
Top-Down vs. Bottom-Up Revisited Raghu Ramakrishnan and S. Sudarshan University of Wisconsin-Madison Madison, WI 53706, USA fraghu,sudarshag@cs.wisc.edu Abstract Ullman ([Ull89a, Ull89b]) has shown that
More informationDPLL(Γ+T): a new style of reasoning for program checking
DPLL(Γ+T ): a new style of reasoning for program checking Dipartimento di Informatica Università degli Studi di Verona Verona, Italy June, 2011 Motivation: reasoning for program checking Program checking
More informationFundamentals of Prolog
Fundamentals of Prolog Prof. Geraint A. Wiggins Centre for Cognition, Computation and Culture Goldsmiths College, University of London Contents Summary of Lecture 1 What makes a good Prolog program? What
More informationChapter 9: Constraint Logic Programming
9. Constraint Logic Programming 9-1 Deductive Databases and Logic Programming (Winter 2007/2008) Chapter 9: Constraint Logic Programming Introduction, Examples Basic Query Evaluation Finite Domain Constraint
More informationFull Clausal Logic - Syntax: clauses
Full Clausal Logic - Syntax: clauses compound terms aggregate objects Add function symbols (functors), with an arity; constants are 0-ary functors. object proposition functor : single word starting with
More informationCS221 / Autumn 2017 / Liang & Ermon. Lecture 17: Logic II
CS221 / Autumn 2017 / Liang & Ermon Lecture 17: Logic II Review: ingredients of a logic Syntax: defines a set of valid formulas (Formulas) Example: Rain Wet Semantics: for each formula, specify a set of
More informationFirst-Order Predicate Logic. CSCI 5582, Fall 2007
First-Order Predicate Logic CSCI 5582, Fall 2007 What Can t We Do in FOPL? We can t take anything back once we ve asserted it. We can t make statements about relations themselves (e.g., Brother is a commutative
More informationCS 321 Programming Languages and Compilers. Prolog
CS 321 Programming Languages and Compilers Prolog Prolog PROgramming LOGic Algorithm = Logic + Control Logic programming deals with computing relations rather than functions. To understand Prolog one must
More informationConstraint Propagation for Efficient Inference in Markov Logic
Constraint Propagation for Efficient Inference in Tivadar Papai 1 Parag Singla 2 Henry Kautz 1 1 University of Rochester, Rochester NY 14627, USA 2 University of Texas, Austin TX 78701, USA September 13,
More informationRelational Databases
Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4
More informationDeduction Rule System vs Production Rule System. Prof. Bob Berwick. Rules Rule
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.034 Artificial Intelligence, Fall 2003 Recitation 2, September 11/12 Rules Rule Prof. Bob Berwick Agenda
More informationµz An Efficient Engine for Fixed Points with Constraints
µz An Efficient Engine for Fixed Points with Constraints Kryštof Hoder, Nikolaj Bjørner, and Leonardo de Moura Manchester University and Microsoft Research Abstract. The µz tool is a scalable, efficient
More informationIntegrity Constraints (Chapter 7.3) Overview. Bottom-Up. Top-Down. Integrity Constraint. Disjunctive & Negative Knowledge. Proof by Refutation
CSE560 Class 10: 1 c P. Heeman, 2010 Integrity Constraints Overview Disjunctive & Negative Knowledge Resolution Rule Bottom-Up Proof by Refutation Top-Down CSE560 Class 10: 2 c P. Heeman, 2010 Integrity
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More informationIntroduction to predicate calculus
Logic Programming Languages Logic programming systems allow the programmer to state a collection of axioms from which theorems can be proven. Express programs in a form of symbolic logic Use a logical
More informationFix- point engine in Z3. Krystof Hoder Nikolaj Bjorner Leonardo de Moura
μz Fix- point engine in Z3 Krystof Hoder Nikolaj Bjorner Leonardo de Moura Fixed Points Fixed point of funcaon f is an a such that f(a)=a Minimal fixed point a wrt. (paraal) ordering < for each fixed point
More informationFor Wednesday. No reading Chapter 9, exercise 9. Must be proper Horn clauses
For Wednesday No reading Chapter 9, exercise 9 Must be proper Horn clauses Same Variable Exact variable names used in sentences in the KB should not matter. But if Likes(x,FOPC) is a formula in the KB,
More informationsimplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion procedural and declarative semantics and & or
simplicity hides complexity flow of control, negation, cut, 2 nd order programming, tail recursion simple and/or composition of goals hides complex control patterns not easily represented by traditional
More informationSmall Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis
Small Formulas for Large Programs: On-line Constraint Simplification In Scalable Static Analysis Isil Dillig, Thomas Dillig, Alex Aiken Stanford University Scalability and Formula Size Many program analysis
More informationLOGIC AND DISCRETE MATHEMATICS
LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University
More informationDepartment of Computing Imperial College of Science and Technology 180 Queen s Gate London SW7 2BZ
INTEGRITY CHECKING IN DEDUCTIVE DATABASES Robert Kowalski Fariba Sadri Paul Soper Department of Computing Imperial College of Science and Technology 180 Queen s Gate London SW7 2BZ We describe the theory
More informationInfinite Derivations as Failures
Infinite Derivations as Failures Andrea Corradi and Federico Frassetto DIBRIS, Università di Genova, Italy name.surname@dibris.unige.it Abstract. When operating on cyclic data, programmers have to take
More informationDipartimento di Elettronica Informazione e Bioingegneria. Cognitive Robotics. SATplan. Act1. Pre1. Fact. G. Gini Act2
Dipartimento di Elettronica Informazione e Bioingegneria Cognitive Robotics SATplan Pre1 Pre2 @ 2015 Act1 Act2 Fact why SAT (satisfability)? 2 Classical planning has been observed as a form of logical
More informationSection 2.4: Arguments with Quantified Statements
Section 2.4: Arguments with Quantified Statements In this section, we shall generalize the ideas we developed in Section 1.3 to arguments which involve quantified statements. Most of the concepts we shall
More informationImplementação de Linguagens 2016/2017
Implementação de Linguagens Ricardo Rocha DCC-FCUP, Universidade do Porto ricroc @ dcc.fc.up.pt Ricardo Rocha DCC-FCUP 1 Logic Programming Logic programming languages, together with functional programming
More informationDiagnosis through constrain propagation and dependency recording. 2 ATMS for dependency recording
Diagnosis through constrain propagation and dependency recording 2 ATMS for dependency recording Fundamentals of Truth Maintenance Systems, TMS Motivation (de Kleer): for most search tasks, there is a
More informationCS 561: Artificial Intelligence
CS 561: Artificial Intelligence Instructor: TAs: Sofus A. Macskassy, macskass@usc.edu Nadeesha Ranashinghe (nadeeshr@usc.edu) William Yeoh (wyeoh@usc.edu) Harris Chiu (chiciu@usc.edu) Lectures: MW 5:00-6:20pm,
More informationLecture 5: Suffix Trees
Longest Common Substring Problem Lecture 5: Suffix Trees Given a text T = GGAGCTTAGAACT and a string P = ATTCGCTTAGCCTA, how do we find the longest common substring between them? Here the longest common
More informationA Logic Database System with Extended Functionality 1
A Logic Database System with Extended Functionality 1 Sang-goo Lee Dong-Hoon Choi Sang-Ho Lee Dept. of Computer Science Dept. of Computer Science School of Computing Seoul National University Dongduk Women
More informationProlog Programming. Lecture Module 8
Prolog Programming Lecture Module 8 Prolog Language Prolog is unique in its ability to infer facts from the given facts and rules. In Prolog, an order of clauses in the program and goals in the body of
More informationLogic: TD as search, Datalog (variables)
Logic: TD as search, Datalog (variables) Computer Science cpsc322, Lecture 23 (Textbook Chpt 5.2 & some basic concepts from Chpt 12) June, 8, 2017 CPSC 322, Lecture 23 Slide 1 Lecture Overview Recap Top
More informationUniversity of Cape Town
/o,! )' LNEAR LBRARY 0068 1611 ll! 1111111 1 l f Department of Computer Science University of Cape Town Semantic Optimisation in Datalog Programs by Mark P.Wassell A Thesis Prepared Under the Supervision
More informationKnowledge-Based Systems and Deductive Databases
Knowledge-Based Systems and Deductive Databases Wolf-Tilo Balke Christoph Lofi Institut für Informationssysteme Technische Universität Braunschweig http://www.ifis.cs.tu-bs.de Next Lecture 7.1 Implementation
More informationKnowledge Representation and Reasoning Logics for Artificial Intelligence
Knowledge Representation and Reasoning Logics for Artificial Intelligence Stuart C. Shapiro Department of Computer Science and Engineering and Center for Cognitive Science University at Buffalo, The State
More informationAnswers. The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 3 MODULE, AUTUMN SEMESTER KNOWLEDGE REPRESENTATION AND REASONING
Answers The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 3 MODULE, AUTUMN SEMESTER 2016-2017 KNOWLEDGE REPRESENTATION AND REASONING Time allowed TWO hours Candidates may complete the front
More informationc constructor P, Q terms used as propositions G, H hypotheses scope identifier for a notation scope M, module identifiers t, u arbitrary terms
Coq quick reference Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope identifier for a notation scope
More informationCoq quick reference. Category Example Description. Inductive type with instances defined by constructors, including y of type Y. Inductive X : Univ :=
Coq quick reference Category Example Description Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope
More informationFunctional Logic Programming. Kristjan Vedel
Functional Logic Programming Kristjan Vedel Imperative vs Declarative Algorithm = Logic + Control Imperative How? Explicit Control Sequences of commands for the computer to execute Declarative What? Implicit
More informationDatalog Evaluation. Serge Abiteboul. 5 mai 2009 INRIA. Serge Abiteboul (INRIA) Datalog Evaluation 5 mai / 1
Datalog Evaluation Serge Abiteboul INRIA 5 mai 2009 Serge Abiteboul (INRIA) Datalog Evaluation 5 mai 2009 1 / 1 Datalog READ CHAPTER 13 lots of research in the late 80 th top-down or bottom-up evaluation
More informationCONSIDERATIONS CONCERNING PARALLEL AND DISTRIBUTED ARCHITECTURE FOR INTELLIGENT SYSTEMS
CONSIDERATIONS CONCERNING PARALLEL AND DISTRIBUTED ARCHITECTURE FOR INTELLIGENT SYSTEMS 1 Delia Ungureanu, 2 Dominic Mircea Kristaly, 3 Adrian Virgil Craciun 1, 2 Automatics Department, Transilvania University
More informationDatabase 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 informationTowards 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 informationcontribution of this paper is to demonstrate that rule orderings can also improve eciency by reducing the number of rule applications. In eect, since
Rule Ordering in Bottom-Up Fixpoint Evaluation of Logic Programs Raghu Ramakrishnan Divesh Srivastava S. Sudarshan y Computer Sciences Department, University of Wisconsin-Madison, WI 53706, U.S.A. Abstract
More informationCSE 530A. B+ Trees. Washington University Fall 2013
CSE 530A B+ Trees Washington University Fall 2013 B Trees A B tree is an ordered (non-binary) tree where the internal nodes can have a varying number of child nodes (within some range) B Trees When a key
More informationLinear Time Unit Propagation, Horn-SAT and 2-SAT
Notes on Satisfiability-Based Problem Solving Linear Time Unit Propagation, Horn-SAT and 2-SAT David Mitchell mitchell@cs.sfu.ca September 25, 2013 This is a preliminary draft of these notes. Please do
More informationLogic Programming Languages
Logic Programming Languages Introduction Logic programming languages, sometimes called declarative programming languages Express programs in a form of symbolic logic Use a logical inferencing process to
More information