Defining Datalog in Rewriting Logic

Size: px
Start display at page:

Download "Defining Datalog in Rewriting Logic"

Transcription

1 M. A. Feliú Universidad Politécnica de Valencia, DSIC / ELP Joint work with María Alpuente, Christophe Joubert and A. Villanueva Coimbra, September 2009

2 Motivation Recent interest in defining complex interprocedural program analyses in Datalog Concise and intuitive analysis specifications Need of efficiently solving Datalog programs under a huge set of facts Existing approaches: bddbddb: based on Bdds Problem: Simplicity is lost when handling reflection properties Datalog solve: based on Bess Problem: Traceability for giving answers is difficult (low level) 2 / 40

3 Motivation Our proposal: from Datalog to Maude Remaining at a higher level Existing transformations from Logic Programming to Rewriting Interesting Maude features higher expressivity ACU efficient implementation reflection/metaprogramming Final goals: expressing analysis involving reflection concisely being efficient enough 3 / 40

4 Outline 1 Datalog 2 Maude 3 Our proposal: from Datalog to Maude 4 Conclusions 4 / 40

5 Datalog Relational language (similar to Prolog) using declarative clauses to both describe and query a deductive database Evaluation strategy: top-down (goal-directed) [Ullman 1985] bottom-up (inferred from base facts) [Ullman 1989] Datalog query: q = R, G where: R, a Datalog program defined over P, V and C, G, a goal. Additional restrictions Finite domains P, V (capital letters) and C (lower-case letters) No function symbols... 5 / 40

6 Datalog Example Facts supervise(mary, alice). supervise(alice, mark). 6 / 40

7 Datalog Example Facts supervise(mary, alice). supervise(alice, mark). Clauses superior(x, Y) :- supervise(x, Y). superior(x, Y) :- supervise(x, Z), superior(z, Y). 6 / 40

8 Datalog Example Facts supervise(mary, alice). supervise(alice, mark). Clauses superior(x, Y) :- supervise(x, Y). superior(x, Y) :- supervise(x, Z), superior(z, Y). Example of goal :- superior (X, mark). 6 / 40

9 Datalog Example Facts supervise(mary, alice). supervise(alice, mark). Clauses superior(x, Y) :- supervise(x, Y). superior(x, Y) :- supervise(x, Z), superior(z, Y). Example of goal :- superior (X, mark). Answer {X/mary,X/alice} 6 / 40

10 Maude Reflective language supporting both equational and rewriting logic sorts define data types and subsort relations among them sorts Constraint ConstraintSet subsort Constraint < ConstraintSet Deterministic behavior defined by (conditional) equations op, : Constraint Constraint -> Constraint [assoc comm id:t].. eq C1, C1 = C1 Non deterministic behavior defined by (conditional) rules op vp : Term Term -> Constraint. crl vp(t1,t2) => C if isconsistent(c) /\... 7 / 40

11 Maude For deterministic computations (equations) reduce t reduces the term t to its normal form For non-deterministic computations (rules) search t t explores all possible rewrites from t to t The order in which equations and rules appear does not matter Conditions in both equations and rules are evaluated from left to right 8 / 40

12 Our proposal JOEQ Source Java program Datalog facts Datalog analysis Maude specification The execution of the Maude specification recovers the computed answers of the original Datalog program Not moded transformation 9 / 40

13 The running example: Simple Pointer Analysis Java-like program o1 : p = new Object() o2 :. if.... q = p p = new Object(). 10 / 40

14 The running example: Simple Pointer Analysis Java-like program o1 : p = new Object() o2 :. if.... q = p p = new Object(). = Datalog representation vp0(p,o1). a(q,p). vp0(p,o2). 10 / 40

15 The running example: Simple Pointer Analysis Facts vp0(p,o1). vp0(p,o2). a(q,p). Clauses vp(v, O) :- vp0(v, O). vp(v, O) :- a(v, V ), vp(v, O). 11 / 40

16 The running example: Simple Pointer Analysis Facts vp0(p,o1). vp0(p,o2). a(q,p). Clauses vp(v, O) :- vp0(v, O). vp(v, O) :- a(v, V ), vp(v, O). Example of goal :- vp(q, H). Answer {H/o1, H/o2} 11 / 40

17 The running example: Simple Pointer Analysis Facts vp0(p,o1). vp0(p,o2). a(q,p). Clauses vp(v, O) :- vp0(v, O). vp(v, O) :- a(v, V ), vp(v, O). Example of goal :- vp(q, H). Answer {H/o1, H/o2} :- vp(v, o1). {V/p, V/q} 11 / 40

18 The running example: Simple Pointer Analysis Facts vp0(p,o1). vp0(p,o2). a(q,p). Clauses vp(v, O) :- vp0(v, O). vp(v, O) :- a(v, V ), vp(v, O). Example of goal :- vp(q, H). Answer {H/o1, H/o2} :- vp(v, o1). {V/p, V/q} :- vp(q, o1). {} True 11 / 40

19 The running example: Simple Pointer Analysis Facts Clauses vp0(p,o1). vp0(p,o2). a(q,p). vp(v, O) :- vp0(v, O). vp(v, O) :- a(v, V ), vp(v, O). Example of goal Answer :- vp(q, H). {H/o1, H/o2} N O T M O D E D :- vp(v, o1). {V/p, V/q} :- vp(q, o1). {} True 11 / 40

20 From Logic to Rewriting Different operational mechanisms: Logic programming based on resolution Functional programming based on term rewriting Transformations preserve the observational behavior: termination, success set, computed answers,... We don t want to impose a specific mode Traditional transformations impose an input/output relation among the parameters Giesl et al. provide a non-moded transformation preserves the termination behavior, not the computed answers 12 / 40

21 Intuition of the transformation What we want... Query Answer We want a query to progressively reduce to an answer What we must consider... Ground representation Non-determinism Unification Guided execution 13 / 40

22 Ground representation Constants We represent logic constants as Maude s Qid terms sort Constant. subsort Qid < Constant. Variables We represent logic variables with the constructor v sort Variable. op v : Qid -> Variable [ctor]. op v : Term Term -> Variable [ctor]. 14 / 40

23 Ground representation Predicates We represent predicates as defined symbols with the same arity op vp0 : Term Term -> Constraint. op vp : Term Term -> Constraint. op a : Term Term -> Constraint. Terms We represent terms as either Constants or Variables sorts Variable Constant Term. subsort Variable Constant < Term. 15 / 40

24 Ground representation Existential variables in the body of clauses In the Maude code... We create existential variables with the binary (polymorphic) constructor v(, ) The arguments of the existential variables ensure freshness 16 / 40

25 Ground representation What is an answer? An instantitation (or Constraint) of (on) the output variables that makes the query satisfiable in the logic program op = : Term Constant -> Constraint. op T : -> Constraint [ctor]. op, : Constraint Constraint -> Constraint [assoc comm id: T ]. = builds simple Constraints T is the solution when there are no output variables, builds conjunctions of Constraints 17 / 40

26 Ground representation How does a query reduction look like? vp(v, o1) V = p but also... vp(v, o1) V = q If a query has many solutions, how can we get them all? 18 / 40

27 Non-determinism Some ideas... Clauses and facts are non-deterministic Maude rules are non-deterministic Maude s search command makes a depth-first search on the rules rewriting space Decisions Each clause is translated into a conditional rule Each fact is translated into a rule The search command finds solutions by exploring the rewriting space representing correct applications of the logic program clauses 19 / 40

28 Non-determinism Datalog clauses vp(var,heap) :- vp0(var,heap). vp(var1,heap) :- a(var1,var2), vp(var2,heap). Maude code crl vp(t1,t2) => C if...condition involving vp0 crl vp(t1,t2) => C if...condition involving a and vp Each clause is translated into a corresponding conditional rule 20 / 40

29 Non-determinism Datalog facts a(q,p). vp0(p,o1). vp0(p,o2). Maude code rl a(t1,t2) => ( T1 = q ), T2 = p. rl vp0(t1,t2) => ( T1 = p ), T2 = o1. rl vp0(t1,t2) => ( T1 = p ), T2 = o2. Each fact is translated into a corresponding rule 21 / 40

30 Unification One idea... Unification guarantees correctness by succeding only when the constraints imposed on the variables in the terms to be unified are consistent Decision Explicitly check the consistency of the constraint each time a query or subgoal is reduced Pattern-matching also keeps the reduction consistent 22 / 40

31 Unification Consistency checking function op isconsistent : Constraint -> Bool. eq isconsistent( success ) = true. ceq isconsistent( ((X=Cte1), X=Cte2), C) = false if Cte1 =/= Cte2. ceq isconsistent( (Cte1=Cte2), C) = false if Cte1 =/= Cte2. ceq isconsistent( (Te=Cte), C) = true if isconsistent(c) [owise]. Detects If a variable is constrained by two different constants If a constant is constrained by something different than itself 23 / 40

32 Guided execution Datalog clauses vp(var,heap) :- vp0(var,heap). vp(var1,heap) :- a(var1,var2), vp(var2,heap). Maude code crl vp(t1,t2) => C if vp0(t1,t2) => C /\ isconsistent(c). crl vp(t1,t2) => (v(t1,t2) = Cte), C1, C2 if a(t1,v(t1,t2)) => ((v(t1,t2) = Cte), C1) /\ isconsistent((v(t1,t2) = Cte), C1) /\ vp(cte,t2) => C2 /\ isconsistent((v(t1,t2) = Cte), C1, C2). 24 / 40

33 Towards the final transformation Some problems of the previous transformation... Very inefficient Duplicated work Costs associated to the use of conditions and backtracking Difficult integration with other equational theories Maude MetaLevel needed due to the use of search Metalevel usually means more inefficiency Our transformation tries to overcome those problems Purely equational, thus deterministic It doesn t make use of backtracking It can use memoization capabilities Integration is easier It uses no conditional equation 25 / 40

34 Towards the final transformation Key Idea To deterministically reduce the query to the set of answers 26 / 40

35 The equational-based approach Rule-based Equational-based Rule non-determinism Equation determinism search reduce Conditions guide execution Unravelings guide execution Explicit consistency check Implicit consistency check The computed term encodes the whole set of (partial) computed answers 27 / 40

36 Set of Datalog computed (partial) answers Non-determinism What is a set of answers? A disjunction of anwers (or Constraints) for the given query sorts ConstraintSet EmptyConstraintSet NonEmptyConstraintSet. subsort EmptyConstraintSet NonEmptyConstraintSet < ConstraintSet. subsort NonEmptyConstraint TConstraint < NonEmptyConstraintSet. subsort FConstraint < EmptyConstraintSet. op ; : ConstraintSet ConstraintSet -> ConstraintSet [assoc comm id: F]. op ; : NonEmptyConstraintSet ConstraintSet -> NonEmptyConstraintSet [assoc comm id: F]. var NECS : NonEmptyConstraintSet. eq NECS ; NECS = NECS. --- Idempotence 28 / 40

37 Ground representation A refinement on the definition of Constraints is needed: F represents a failed computation sorts Constraint EmptyConstraint NonEmptyConstraint TConstraint FConstraint. subsort EmptyConstraint NonEmptyConstraint < Constraint. subsort TConstraint FConstraint < EmptyConstraint. op = : Term Constant -> NonEmptyConstraint. op T : -> TConstraint. op F : -> FConstraint. op, : Constraint Constraint -> Constraint [assoc comm id: T].. 29 / 40

38 Unification No consistency check function Conjunction, and substitution = are now a defined symbol Constraints are simplified as soon as possible and always kept consistent var NEC : NonEmptyConstraint. var V : Variable. var Cte Cte1 Cte2 : Constant. eq (Cte = Cte) = T. --- Simplification eq (Cte1 = Cte2) = F [owise]. --- Unsatisfiability eq NEC,NEC = NEC. --- Idempotence eq F,NEC = F. --- Zero element eq F,F = F. --- Simplification eq (V = Cte1),(V = Cte2) = F [owise].--- Unsatisfiability 30 / 40

39 Facts transformation Datalog facts a(q,p). vp0(p,o1). vp0(p,o2). Maude code eq a(t1,t2) = ((T1 = q), (T2 = p)). eq vp0(t1,t2) = ((T1 = p), (T2 = o1)) ; ((T1 = p), (T2 = o2)). Something new... op vp vp0 a : Term Term -> ConstraintSet. 31 / 40

40 Clauses transformation Datalog clauses C1: vp(var,heap) :- vp0(var,heap). C2: vp(var1,heap) :- a(var1,var2), vp(var2,heap). Maude code eq vp(t1,t2) = vpc1(t1,t2) ; vpc2(t1,t2). The answers of a predicate are the disjunction of the answers of its clauses 32 / 40

41 Clauses transformation The case when the body is composed of a single subgoal Datalog clauses C1: vp(var,heap) :- vp0(var,heap). Maude code eq vpc1(t1,t2) = vp0(t1,t2). 33 / 40

42 Clauses transformation Datalog clauses C2: vp(var1,heap) :- a(var1,var2), vp(var2,heap). Maude code eq vpc2(t1,t2) = vpc2s1(t1,t2). eq vpc2s1(t1,t2) = vpc2s2(a(t1,v(t1,t2)),t1 T2). eq vpc2s2(((v(t1,t2) = Cte), C) ; CS, T1 T2) = (vp(cte,t2) x ((v(t1,t2) = Cte), C)) ; vpc2s2(cs,t1 T2). eq vpc2s2(f,t1 T2) = F. vpc2s1 and vpc2s2 are unraveling functions which guide execution 34 / 40

43 Formalization of the transformation A formalization of the transformation has been defined (see pre-proceedings) The formalization allowed us to implement a prototype that, given a Datalog program, generates the Maude specification We have proved correctness and completeness of the transformation w.r.t. Datalog resolution (see the full version) 35 / 40

44 Experimental results One more thing... op vp : Term Term -> ConstraintSet [memo]. 36 / 40

45 Experimental results One more thing... op vp : Term Term -> ConstraintSet [memo]. a/2 vp0/2 vp/2 rule-based equational eq.+memo / 40

46 Experimental results Comparison w.r.t. other implementations 37 / 40

47 Conclusions and Future work Datalog for the analysis of OO programs A general transformation has been formalized and implemented equational-based not moded preserves computed answers correct and complete Future work Representing reflective features for the analysis (Maude capability) Using a more compact representation of the facts Considering other optimizations 38 / 40

48 Have a nice trip back home!!! Questions? For more information: mfeliu@dsic.upv.es

Implementing Datalog in Maude

Implementing Datalog in Maude M. A. Feliú Universidad Politécnica de Valencia, DSIC / ELP Joint work with María Alpuente, Christophe Joubert and A. Villanueva San Sebastián, September 2009 Motivation Recent interest in defining complex

More information

Defining Datalog in Rewriting Logic

Defining Datalog in Rewriting Logic Defining Datalog in Rewriting Logic M. Alpuente, M. A. Feliú, C. Joubert, and A. Villanueva Universidad Politécnica de Valencia, DSIC / ELP Camino de Vera s/n, 46022 Valencia, Spain {alpuente,mfeliu,joubert,villanue}@dsic.upv.es

More information

Using Datalog and Boolean Equation Systems for Program Analysis

Using Datalog and Boolean Equation Systems for Program Analysis Using Datalog and Boolean Equation Systems for Program Analysis Christophe Joubert Universidad Politécnica de Valencia, DSIC / ELP Joint work with María Alpuente, Marco A. Feliú and Alicia Villanueva FMICS

More information

Evaluation of Datalog queries and its application to the static analysis of Java code

Evaluation of Datalog queries and its application to the static analysis of Java code Universidad Politécnica de Valencia Departamento de Sistemas Informáticos y Computación Máster en Ingeniería del Software, Métodos Formales y Sistemas de Información Master Thesis Evaluation of Datalog

More information

Program analysis parameterized by the semantics in Maude

Program analysis parameterized by the semantics in Maude Program analysis parameterized by the semantics in Maude A. Riesco (joint work with I. M. Asăvoae and M. Asăvoae) Universidad Complutense de Madrid, Madrid, Spain Workshop on Logic, Algebra and Category

More information

CS422 - Programming Language Design

CS422 - Programming Language Design 1 CS422 - Programming Language Design From SOS to Rewriting Logic Definitions Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign In this chapter we show how SOS language

More information

DATALOG SOLVE: A Datalog-Based Demand-Driven Program Analyzer 1

DATALOG SOLVE: A Datalog-Based Demand-Driven Program Analyzer 1 Electronic Notes in Theoretical Computer Science 248 (2009) 57 66 www.elsevier.com/locate/entcs DATALOG SOLVE: A Datalog-Based Demand-Driven Program Analyzer 1 M. Alpuente M. A. Feliú C. Joubert A. Villanueva

More information

Using Datalog and Boolean Equation Systems for Program Analysis

Using Datalog and Boolean Equation Systems for Program Analysis Using Datalog and Boolean Equation Systems for Program Analysis María Alpuente, Marco A. Feliú, Christophe Joubert, and Alicia Villanueva Universidad Politécnica de Valencia, DSIC / ELP Camino de Vera

More information

Unification in Maude. Steven Eker

Unification in Maude. Steven Eker Unification in Maude Steven Eker 1 Unification Unification is essentially solving equations in an abstract setting. Given a signature Σ, variables X and terms t 1, t 2 T (Σ) we want to find substitutions

More information

Logic Languages. Hwansoo Han

Logic 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 information

Computing Fundamentals 2 Introduction to CafeOBJ

Computing Fundamentals 2 Introduction to CafeOBJ Computing Fundamentals 2 Introduction to CafeOBJ Lecturer: Patrick Browne Lecture Room: K408 Lab Room: A308 Based on work by: Nakamura Masaki, João Pascoal Faria, Prof. Heinrich Hußmann. See notes on slides

More information

The Maude 2.0 System. M. Clavel F. Durán S. Eker P. Lincoln. N. Martí-Oliet J. Meseguer C. Talcott

The Maude 2.0 System. M. Clavel F. Durán S. Eker P. Lincoln. N. Martí-Oliet J. Meseguer C. Talcott The Maude 2.0 System M. Clavel F. Durán S. Eker P. Lincoln N. Martí-Oliet J. Meseguer C. Talcott 1 Overview Maude is a language based on rewriting logic. Type system is based on membership equation logic.

More information

Operational Semantics

Operational Semantics 15-819K: Logic Programming Lecture 4 Operational Semantics Frank Pfenning September 7, 2006 In this lecture we begin in the quest to formally capture the operational semantics in order to prove properties

More information

On the BEAM Implementation

On the BEAM Implementation On the BEAM Implementation Ricardo Lopes 1,Vítor Santos Costa 2, and Fernando Silva 1 1 DCC-FC and LIACC, Universidade do Porto, Portugal {rslopes,fds}@ncc.up.pt 2 COPPE-Sistemas, Universidade Federal

More information

Logic Programming and Resolution Lecture notes for INF3170/4171

Logic 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 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

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic

3.4 Deduction and Evaluation: Tools Conditional-Equational Logic 3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax

More information

Foundations 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 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 information

The Maude LTL LBMC Tool Tutorial

The Maude LTL LBMC Tool Tutorial The Maude LTL LBMC Tool Tutorial Kyungmin Bae 1, Santiago Escobar 2, and José Meseguer 1 1 University of Illinois at Urbana-Champaign, IL, USA 2 Universidad Politécnica de Valencia, Spain Abstract. A concurrent

More information

Boolean Representations and Combinatorial Equivalence

Boolean Representations and Combinatorial Equivalence Chapter 2 Boolean Representations and Combinatorial Equivalence This chapter introduces different representations of Boolean functions. It then discusses the applications of these representations for proving

More information

Implementação de Linguagens 2016/2017

Implementaçã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 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

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Design

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Design CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS422 Programming Language Design Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and tools,

More information

CafeOBJ. CafeOBJ. Starting CafeOBJ. Wolfgang Schreiner 1. A Quick Overview. 2.

CafeOBJ. CafeOBJ. Starting CafeOBJ. Wolfgang Schreiner 1. A Quick Overview. 2. CafeOBJ Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at 1. A Quick Overview Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Built-in Module BOOL. Lecture Note 01a

Built-in Module BOOL. Lecture Note 01a Built-in Module BOOL Lecture Note 01a Topics! Built-in Boolean Algebra module BOOL and the equivalence of two boolean expressions (or SAT problems)! Study important concepts about CafeOBJ system through

More information

Where is ML type inference headed?

Where is ML type inference headed? 1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.

More information

Analyzing Java Programs Using JavaFAN

Analyzing Java Programs Using JavaFAN Analyzing Java Programs Using JavaFAN Feng Chen Joint work with Azadeh Farzan, Jose Meseguer and Grigore Rosu JavaFAN (Java Formal Analyzer) Inside Java Semantics JavaRL (Java Rewrite Logic) Semantics

More information

Functional Logic Programming. Kristjan Vedel

Functional 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 information

Maude-NPA, Version 2.0 (November 26th, 2011)

Maude-NPA, Version 2.0 (November 26th, 2011) Maude-NPA, Version 2.0 (November 26th, 2011) Santiago Escobar sescobar@dsic.upv.es DSIC-ELP, Universitat Politècnica de València Valencia, Spain Catherine Meadows meadows@itd.nrl.navy.mil Naval Research

More information

Term Algebras with Length Function and Bounded Quantifier Elimination

Term Algebras with Length Function and Bounded Quantifier Elimination with Length Function and Bounded Ting Zhang, Henny B Sipma, Zohar Manna Stanford University tingz,sipma,zm@csstanfordedu STeP Group, September 3, 2004 TPHOLs 2004 - p 1/37 Motivation: Program Verification

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

An Experimental CLP Platform for Integrity Constraints and Abduction

An Experimental CLP Platform for Integrity Constraints and Abduction An Experimental CLP Platform for Integrity Constraints and Abduction Slim Abdennadher and Henning Christiansen Computer Science Department, University of Munich Oettingenstr. 67, 80538 München, Germany

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

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages Michael Hanus (CAU Kiel) Multi-paradigm Declarative Languages ICLP 2007 1 Multi-paradigm Declarative Languages Michael Hanus Christian-Albrechts-University of Kiel Programming Languages and Compiler Construction

More information

Chapter 9: Constraint Logic Programming

Chapter 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 information

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

Lecture 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 information

A Rewriting Semantics for Maude Strategies

A Rewriting Semantics for Maude Strategies A Rewriting Semantics for Maude Strategies N. Martí-Oliet, J. Meseguer, and A. Verdejo Universidad Complutense de Madrid University of Illinois at Urbana-Champaign IFIP WG 1.3 Urbana, August 1, 2008 N.

More information

On-demand evaluation for Maude 1

On-demand evaluation for Maude 1 RULE 2004 Preliminary Version On-demand evaluation for Maude 1 Francisco Durán a Santiago Escobar b Salvador Lucas b a LCC, Universidad de Málaga, Campus de Teatinos, Málaga, Spain. duran@lcc.uma.es b

More information

Maude 2.0 Manual. Version 1.0. Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott

Maude 2.0 Manual. Version 1.0. Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott Maude 2.0 Manual Version 1.0 Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott June 2003 ii iii Maude 2 is copyright 1997-2003 SRI International,

More information

Basic Foundations of Isabelle/HOL

Basic Foundations of Isabelle/HOL Basic Foundations of Isabelle/HOL Peter Wullinger May 16th 2007 1 / 29 1 Introduction into Isabelle s HOL Why Type Theory Basic Type Syntax 2 More HOL Typed λ Calculus HOL Rules 3 Example proof 2 / 29

More information

Maude-NPA, Version 3.0

Maude-NPA, Version 3.0 Maude-NPA, Version 3.0 Santiago Escobar sescobar@dsic.upv.es DSIC-ELP, Universitat Politècnica de València Valencia, Spain Catherine Meadows meadows@itd.nrl.navy.mil Naval Research Laboratory Washington,

More information

Towards a Semantic Web Modeling Language

Towards a Semantic Web Modeling Language Towards a Semantic Web Modeling Language Draft Christoph Wernhard Persist AG Rheinstr. 7c 14513 Teltow Tel: 03328/3477-0 wernhard@persistag.com May 25, 2000 1 Introduction The Semantic Web [2] requires

More information

Part I Logic programming paradigm

Part I Logic programming paradigm Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two

More information

Type Processing by Constraint Reasoning

Type Processing by Constraint Reasoning , Martin Sulzmann, Jeremy Wazny 8th November 2006 Chameleon Chameleon is Haskell-style language treats type problems using constraints gives expressive error messages has a programmable type system Developers:

More information

Unification Algorithms

Unification Algorithms King s College London December 2007 Motivations Unification algorithms have become popular in recent years, due to their key role in the fields of logic programming and theorem proving. Logic Programming

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC 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 information

Towards Coq Formalisation of {log} Set Constraints Resolution

Towards Coq Formalisation of {log} Set Constraints Resolution Towards Coq Formalisation of {log} Set Constraints Resolution Catherine Dubois 1, Sulyvan Weppe 2, 1. ENSIIE, lab. Samovar, CNRS, Évry, France 2. ENSIIE, Évry, France Abstract. The language {log} is a

More information

Prolog Interpreter in Rewriting Logic

Prolog Interpreter in Rewriting Logic Interpreter in Rewriting Logic Based upon: The Art of by Leon Sterling and Ehud Shapiro Introductory Class CS422 Outline 1 Motivation Details 2 Motivation Motivation Details Logic as a formal way of thinking:

More information

On Formal Analysis of OO Languages using. OO Languages and Rewriting Logic: Designing for Performance

On Formal Analysis of OO Languages using. OO Languages and Rewriting Logic: Designing for Performance On Formal Analysis of OO Languages using Rewriting Logic: Designing for Performance {mhills, grosu}@cs.uiuc.edu Department of Computer Science University of Illinois at Urbana-Champaign 6 June 2007 1 2

More information

Lecture #23: Conversion and Type Inference

Lecture #23: Conversion and Type Inference Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). Last modified: Fri Oct 20 10:46:40 2006 CS164:

More information

Maude Manual (Version 2.5) Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott

Maude Manual (Version 2.5) Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott Maude Manual (Version 2.5) Manuel Clavel Francisco Durán Steven Eker Patrick Lincoln Narciso Martí-Oliet José Meseguer Carolyn Talcott June 2010 ii iii Maude 2 is copyright 1997-2010 SRI International,

More information

INTRODUCTION TO PROLOG

INTRODUCTION 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 information

1. 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. 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 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

CS422 - Programming Language Design

CS422 - Programming Language Design 1 CS422 - Programming Language Design Two Rewrite Logic Based Programming Language Definitional Styles Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 We next show

More information

Conversion vs. Subtyping. Lecture #23: Conversion and Type Inference. Integer Conversions. Conversions: Implicit vs. Explicit. Object x = "Hello";

Conversion vs. Subtyping. Lecture #23: Conversion and Type Inference. Integer Conversions. Conversions: Implicit vs. Explicit. Object x = Hello; Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). In Java, this is legal: Object x = "Hello";

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

This article appeared in a journal published by Elsevier. The attached copy is furnished to the author for internal non-commercial research and

This article appeared in a journal published by Elsevier. The attached copy is furnished to the author for internal non-commercial research and This article appeared in a journal published by Elsevier. The attached copy is furnished to the author for internal non-commercial research and education use, including for instruction at the authors institution

More information

Towards a Module System for K

Towards a Module System for K Towards a Module System for Mark Hills and Grigore Roşu {mhills, grosu}@cs.uiuc.edu Department of Computer Science University of Illinois at Urbana-Champaign WADT 08, 14 June 2008 Hills and Roşu WADT 08:

More information

A second life for Prolog

A second life for Prolog A second life for Prolog Algorithm = Logic + Control Jan Wielemaker J.Wielemaker@cwi.nl 1 Overview Algorithm = Logic + Control Limitations of SLD Beyond SLD 2 Algorithm = Logic + Control In Logic programming

More information

Prolog. Artificial Intelligence. Lecture 2 Karim Bouzoubaa

Prolog. Artificial Intelligence. Lecture 2 Karim Bouzoubaa Prolog Artificial Intelligence Lecture 2 Karim Bouzoubaa Content Introduction Declarative and logic programming Example Computational model Prolog reasoning Structure of prolog programs Prolog concepts

More information

Using big-step and small-step semantics in Maude to perform declarative debugging

Using big-step and small-step semantics in Maude to perform declarative debugging Using big-step and small-step semantics in Maude to perform declarative debugging Adrián Riesco Universidad Complutense de Madrid, Madrid, Spain FLOPS 2014, Kanazawa June 4, 2014 A. Riesco (UCM) Using

More information

Simple Unification-based Type Inference for GADTs

Simple Unification-based Type Inference for GADTs Simple Unification-based Type Inference for GADTs Stephanie Weirich University of Pennsylvania joint work with Dimitrios Vytiniotis, Simon Peyton Jones and Geoffrey Washburn Overview Goal: Add GADTs to

More information

The ITP Tool s Manual

The ITP Tool s Manual The ITP Tool s Manual Manuel Clavel and Miguel Palomino Departamento de Sistemas Informáticos y Programación Universidad Complutense de Madrid clavel@sip.ucm.es miguelpt@sip.ucm.es April 12, 2005 Abstract

More information

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

Chapter 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 information

Declarative Programming with Function Patterns

Declarative Programming with Function Patterns LOPSTR 2005 Declarative Programming with Function Patterns Michael Hanus Christian-Albrechts-Universität Kiel (joint work with Sergio Antoy, Portland State University) FUNCTIONAL LOGIC LANGUAGES Approach

More information

The Maude LTL Model Checker and Its Implementation

The Maude LTL Model Checker and Its Implementation The Maude LTL Model Checker and Its Implementation Steven Eker 1,José Meseguer 2, and Ambarish Sridharanarayanan 2 1 Computer Science Laboratory, SRI International Menlo Park, CA 94025 eker@csl.sri.com

More information

Functional Logic Programming Language Curry

Functional Logic Programming Language Curry Functional Logic Programming Language Curry Xiang Yin Department of Computer Science McMaster University November 9, 2010 Outline Functional Logic Programming Language 1 Functional Logic Programming Language

More information

CS 456 (Fall 2018) Scribe Notes: 2

CS 456 (Fall 2018) Scribe Notes: 2 CS 456 (Fall 2018) Scribe Notes: 2 Albert Yu, Adam Johnston Lists Bags Maps Inductive data type that has an infinite collection of elements Not through enumeration but inductive type definition allowing

More information

Two Problems. Programming Languages and Compilers (CS 421) Type Inference - Example. Type Inference - Outline. Type Inference - Example

Two Problems. Programming Languages and Compilers (CS 421) Type Inference - Example. Type Inference - Outline. Type Inference - Example Two Problems Programming Languages and Compilers (CS 421) Sasa Misailovic 4110 SC, UIUC https://courses.engr.illinois.edu/cs421/fa2017/cs421a Based in part on slides by Mattox Beckman, as updated by Vikram

More information

Data types for mcrl2

Data types for mcrl2 Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation

More information

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

Lee Pike. June 3, 2005

Lee Pike. June 3, 2005 Proof NASA Langley Formal Methods Group lee.s.pike@nasa.gov June 3, 2005 Proof Proof Quantification Quantified formulas are declared by quantifying free variables in the formula. For example, lem1: LEMMA

More information

Mechanical Approach to Linking Operational Semantics and Algebraic Semantics for Verilog using Maude

Mechanical Approach to Linking Operational Semantics and Algebraic Semantics for Verilog using Maude Mechanical Approach to Linking Operational Semantics and Algebraic Semantics for Verilog using Maude Huibiao Zhu 1, Peng Liu 1, Jifeng He 1, and Shengchao Qin 2 1 Shanghai Key Laboratory of Trustworthy

More information

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F 1 Logical Operations 1.1 And The and operator is a binary operator, denoted as, &,, or sometimes by just concatenating symbols, is true only if both parameters are true. A B A B F T F F F F The expression

More information

CS 360: Programming Languages Lecture 12: More Haskell

CS 360: Programming Languages Lecture 12: More Haskell CS 360: Programming Languages Lecture 12: More Haskell Geoffrey Mainland Drexel University Adapted from Brent Yorgey s course Introduction to Haskell. Section 1 Administrivia Administrivia Homework 5 due

More information

4.1 Review - the DPLL procedure

4.1 Review - the DPLL procedure Applied Logic Lecture 4: Efficient SAT solving CS 4860 Spring 2009 Thursday, January 29, 2009 The main purpose of these notes is to help me organize the material that I used to teach today s lecture. They

More information

Prolog. Intro to Logic Programming

Prolog. Intro to Logic Programming Prolog Logic programming (declarative) Goals and subgoals Prolog Syntax Database example rule order, subgoal order, argument invertibility, backtracking model of execution, negation by failure, variables

More information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

Programming with Math and Logic

Programming with Math and Logic .. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing

More information

K-Maude. K-Maude. A Rewriting Based Tool for Semantics of Programming Languages. University of Illinois at Urbana-Champaign WRLA / 66

K-Maude. K-Maude. A Rewriting Based Tool for Semantics of Programming Languages. University of Illinois at Urbana-Champaign WRLA / 66 K-Maude A Rewriting Based Tool for Semantics of Programming Languages Traian Florin Șerbănuță and Grigore Roșu University of Illinois at Urbana-Champaign WRLA 2010 1 / 66 Overview &'(")*#"*%!"#$% (+ K

More information

CSCC24 Functional Programming Scheme Part 2

CSCC24 Functional Programming Scheme Part 2 CSCC24 Functional Programming Scheme Part 2 Carolyn MacLeod 1 winter 2012 1 Based on slides from Anya Tafliovich, and with many thanks to Gerald Penn and Prabhakar Ragde. 1 The Spirit of Lisp-like Languages

More information

Posets, graphs and algebras: a case study for the fine-grained complexity of CSP s

Posets, graphs and algebras: a case study for the fine-grained complexity of CSP s Posets, graphs and algebras: a case study for the fine-grained complexity of CSP s Part 1: Preliminaries on Complexity and CSP s Benoit Larose 1 2 1 Department of Mathematics and Statistics Concordia University,

More information

Z Notation. June 21, 2018

Z Notation. June 21, 2018 Z Notation June 21, 2018 1 Definitions There are many different ways to introduce an object in a Z specification: declarations, abbreviations, axiomatic definitions, and free types. Keep in mind that the

More information

Behavior models and verification Lecture 6

Behavior models and verification Lecture 6 Behavior models and verification Lecture 6 http://d3s.mff.cuni.cz Jan Kofroň, František Plášil Model checking For a Kripke structure M = (S, I, R, L) over AP and a (state based) temporal logic formula

More information

Scalable Web Service Composition with Partial Matches

Scalable Web Service Composition with Partial Matches Scalable Web Service Composition with Partial Matches Adina Sirbu and Jörg Hoffmann Digital Enterprise Research Institute (DERI) University of Innsbruck, Austria firstname.lastname@deri.org Abstract. We

More information

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

Resolution (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 information

Notes 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 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 information

Adding GADTs to OCaml the direct approach

Adding GADTs to OCaml the direct approach Adding GADTs to OCaml the direct approach Jacques Garrigue & Jacques Le Normand Nagoya University / LexiFi (Paris) https://sites.google.com/site/ocamlgadt/ Garrigue & Le Normand Adding GADTs to OCaml 1

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2018 Lecture 7b Andrew Tolmach Portland State University 1994-2018 Dynamic Type Checking Static type checking offers the great advantage of catching errors early And

More information

Infinite Derivations as Failures

Infinite 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 information

Principles of Programming Languages Lecture 13: Paradigms: Logic Programming.

Principles of Programming Languages Lecture 13: Paradigms: Logic Programming. Principles of Programming Languages Lecture 13: Paradigms: Logic Programming. Andrei Arusoaie 1 1 Department of Computer Science January 16, 2018 Outline Paradigms Outline Paradigms Logic Programming Paradigms

More information

QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING

QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING QUTE: A PROLOG/LISP TYPE LANGUAGE FOR LOGIC PROGRAMMING Masahiko Sato Takafumi Sakurai Department of Information Science, Faculty of Science University of Tokyo 7-3-1 Hongo, Bunkyo-ku, Tokyo 113, JAPAN

More information

User s Guide for BDDs in Jython

User s Guide for BDDs in Jython User s Guide for BDDs in Jython Mark Greenstreet, January 29, 2013 1 Overview I ll add something here about downloading the package, running it on UBC CS department machines, etc. 2 Class SymBool Class

More information

Fundamentals of Prolog

Fundamentals 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 information

Towards Integrated Specification and Analysis of Machine-Readable Policies Using Maude 1

Towards Integrated Specification and Analysis of Machine-Readable Policies Using Maude 1 Towards Integrated Specification and Analysis of Machine-Readable Policies Using Maude 1 Rukman Senanayake, Grit Denker, and *Jon Pearce SRI International, Menlo Park, CA 94025, *San Jose State University,

More information

Relating the MSR Crypto-Protocol Specification Language to Rewriting Logic with Dependent Types

Relating the MSR Crypto-Protocol Specification Language to Rewriting Logic with Dependent Types WRLA 2004 - Barcelona, Spain March 27, 2004 Relating the MSR Crypto-Protocol Specification Language to Rewriting Logic with Dependent Types Iliano Cervesato iliano@itd.nrl.navy.mil ITT Industries, inc

More information

Induction and Semantics in Dafny

Induction and Semantics in Dafny 15-414 Lecture 11 1 Instructor: Matt Fredrikson Induction and Semantics in Dafny TA: Ryan Wagner Encoding the syntax of Imp Recall the abstract syntax of Imp: a AExp ::= n Z x Var a 1 + a 2 b BExp ::=

More information

CS153: Compilers Lecture 15: Local Optimization

CS153: Compilers Lecture 15: Local Optimization CS153: Compilers Lecture 15: Local Optimization Stephen Chong https://www.seas.harvard.edu/courses/cs153 Announcements Project 4 out Due Thursday Oct 25 (2 days) Project 5 out Due Tuesday Nov 13 (21 days)

More information

CRC 3: A Church-Rosser Checker Tool for Conditional Order-Sorted Equational Maude Specifications

CRC 3: A Church-Rosser Checker Tool for Conditional Order-Sorted Equational Maude Specifications CRC 3: A Church-Rosser Checker Tool for Conditional Order-Sorted Equational Maude Specifications Francisco Durán E.T.S.I. Informática Universidad de Málaga, Spain duran@lcc.uma.es José Meseguer Computer

More information