Generalized CHR machines



Similar documents
Introduction to Logic in Computer Science: Autumn 2006

NP-complete? NP-hard? Some Foundations of Complexity. Prof. Sven Hartmann Clausthal University of Technology Department of Informatics

Complexity Classes P and NP

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

Quantum and Non-deterministic computers facing NP-completeness

Tutorial 8. NP-Complete Problems

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

Theoretical Computer Science (Bridging Course) Complexity

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

Lecture 7: NP-Complete Problems

Welcome to... Problem Analysis and Complexity Theory , 3 VU

CAD Algorithms. P and NP

Algebraic Computation Models. Algebraic Computation Models

Boulder Dash is NP hard

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

P versus NP, and More

Discuss the size of the instance for the minimum spanning tree problem.

On the Relationship between Classes P and NP

Computational complexity theory

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Chapter. NP-Completeness. Contents

A Working Knowledge of Computational Complexity for an Optimizer

Fixed-Point Logics and Computation

Lecture 1: Oracle Turing Machines

Constraint Programming. Master Parisien de Recherche en Informatique

Why? A central concept in Computer Science. Algorithms are ubiquitous.

The Classes P and NP. mohamed@elwakil.net

Updating Action Domain Descriptions

Introduction to computer science

Notes on NP Completeness

Lecture 2: Complexity Theory Review and Interactive Proofs

Theory of Computation Chapter 2: Turing Machines

CSC 373: Algorithm Design and Analysis Lecture 16

Introduction to Algorithms. Part 3: P, NP Hard Problems

The Classes P and NP

CoNP and Function Problems

OHJ-2306 Introduction to Theoretical Computer Science, Fall

Lecture 2: Universality

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

How To Solve A K Path In Time (K)

Instruction scheduling

Data Integration: A Theoretical Perspective

JUST-IN-TIME SCHEDULING WITH PERIODIC TIME SLOTS. Received December May 12, 2003; revised February 5, 2004

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

SPARQL: Un Lenguaje de Consulta para la Web

Algorithm Design and Analysis

Analysis of an Artificial Hormone System (Extended abstract)

Matching Midlet's Security Claims with a Platform Security Policy using Automata Modulo Theory

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Chapter 1. Computation theory

Quantum Monte Carlo and the negative sign problem

Course Manual Automata & Complexity 2015

Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Active database systems. Triggers. Triggers. Active database systems.

Complexity Classes. Chapter 27 of the forthcoming CRC Handbook on Algorithms and Theory of Computation. Eric Allender 1. Rutgers University

Complexity Theory. Jörg Kreiker. Summer term Chair for Theoretical Computer Science Prof. Esparza TU München

Chapter 7 Uncomputability

Tetris is Hard: An Introduction to P vs NP

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

SOLVING NARROW-INTERVAL LINEAR EQUATION SYSTEMS IS NP-HARD PATRICK THOR KAHL. Department of Computer Science

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

ATheoryofComplexity,Conditionand Roundoff

A logical approach to dynamic role-based access control

The P versus NP Solution

On the Decidability and Complexity of Query Answering over Inconsistent and Incomplete Databases

Quantum Computability and Complexity and the Limits of Quantum Computation

How to Prove a Theorem So No One Else Can Claim It

XML Data Integration

Dynamic Network Resources Allocation in Grids through a Grid Network Resource Broker

How To Solve A Minimum Set Covering Problem (Mcp)

Chapter 1. NP Completeness I Introduction. By Sariel Har-Peled, December 30, Version: 1.05

IMPROVING PERFORMANCE OF RANDOMIZED SIGNATURE SORT USING HASHING AND BITWISE OPERATORS

Load Balancing. Load Balancing 1 / 24

NP-Completeness and Cook s Theorem

The Complexity of DC-Switching Problems

Approximation Algorithms

Fabio Patrizi DIS Sapienza - University of Rome

A Fast Algorithm For Finding Hamilton Cycles

Universality in the theory of algorithms and computer science

Testing Decision Procedures for Security-by-Contract

Why Study NP- hardness. NP Hardness/Completeness Overview. P and NP. Scaling 9/3/13. Ron Parr CPS 570. NP hardness is not an AI topic

Turing Machines: An Introduction

Propagating Functional Dependencies with Conditions

P vs NP problem in the field anthropology

Automated Validation & Verification of Software Paper Presentation

ON THE COMPLEXITY OF THE GAME OF SET.

Plan-Space Search. Searching for a Solution Plan in a Graph of Partial Plans

KEYWORD SEARCH IN RELATIONAL DATABASES

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Consistent Query Answering in Databases Under Cardinality-Based Repair Semantics

! X is a set of strings. ! Instance: string s. ! Algorithm A solves problem X: A(s) = yes iff s! X.

Follow the Perturbed Leader

Single machine parallel batch scheduling with unbounded capacity

Algorithmic Software Verification

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1)

Transcription:

K.U.Leuven, Belgium Universität Ulm, Germany CHR 08 Workshop Hagenberg, Austria, July 2008

Complexity-wise completeness CHR machines 2/27 1 Introduction Complexity-wise completeness CHR machines 2 3 4 5

Complexity-wise completeness CHR machines Complexity-wise completeness of CHR 3/27 Complexity-wise completeness result for CHR (see [CHR 05] and [TOPLAS]) Every algorithm can be implemented in CHR with the optimal time and space complexity CHR machine: one ω t step = one machine step In [CHR 05] and [TOPLAS]: compare CHR machine with RAM machine

Complexity-wise completeness CHR machines (Deterministic abstract) CHR machine 4/27 A deterministic abstract CHR machine is a tuple M = (H, P, VG). The host language H defines a built-in constraint theory D H, P is a CHR program, and VG GP H is a set of valid goals, such that P is a H ω t -deterministic CHR program for input VG. The machine takes an input query G VG and executes a derivation d H ω t G.

Execution strategies Generalized confluence 5/27 1 Introduction 2 Execution strategies Generalized confluence 3 4 5

Execution strategies Generalized confluence Execution strategies 6/27 An execution strategy is a set of derivations such that there is exactly one derivation for every initial state A computable execution strategy is an execution strategy that can be implemented (i.e. for which an underlying state transition system exists whose transition function is computable)

Execution strategies Generalized confluence 7/27 set of all execution strategies for a program P: Ω H t (P) a strategy class Ω(P) Ω H t (P) is a set of execution strategies a computable strategy class is a strategy class which contains at least one computable execution strategy. clearly, the strategy class corresponding to the K.U.Leuven CHR system is computable so the refined semantics strategy class Ω H r is computable so the abstract semantics strategy class Ω H t is computable

Execution strategies Generalized confluence Generalized confluence 8/27 (Ω-confluence) A CHR program P is Ω(P)-confluent if, for every initial state G,, true, 1 = σ Σ init and execution strategies ξ 1, ξ 2 Ω(P), the following holds: σ ξ1 G 1, S 1, B 1, T 1 n1 σ ξ2 G 2, S 2, B 2, T 2 n2 D H = G (S 1 B 1 ) G (S 2 B 2 ) Note that a CHR program P is Ω H t (P)-confluent if and only if it is confluent (in the usual sense)

Execution strategies Generalized confluence Overview 9/27 Ω H t (P) K.U.Leuven SICStus toychr JCHR Ω H r (P) dpchr Ω H p (P) {K.U.Leuven}-confluent programs Ω H r -confluent Ω H p -confl. confl. Ω H p (P, p) Execution strategies CHR programs

Execution strategies Generalized confluence More instantiated strategy, weaker confluence 10/27 Theorem For all strategy classes Ω 1 and Ω 2 : if Ω 1 Ω 2, then every Ω 2 -confluent program is also Ω 1 -confluent. (follows directly from the definitions)

Execution strategies Generalized confluence 11/27 (general CHR machine) A CHR machine is a tuple M = (H, Ω, P, VG) where the host-language H defines a built-in constraint theory D H, P is a CHR program, VG GP H is a set of valid goals, and Ω ΩH t (P) is a strategy class. The machine takes an input query G VG, picks any execution strategy ξ Ω, and executes a derivation d ξ G. Note that we no longer require the program to be H ω t -deterministic for valid input, and we allow it to use any strategy class.

Execution strategies Generalized confluence Complexity 12/27 Do generalized CHR machines have more power than abstract deterministic CHR machines? yes, for exotic strategy classes not really for the usual (refined, priority): P Ωt = P Ωr = P Ωp = P

Example Complexity 13/27 1 Introduction 2 3 Example Complexity 4 5

Example Complexity 14/27 We define non-deterministic CHR machines similarly to the way non-deterministic Turing machines are defined. A non-deterministic CHR machine (NCHR machine) is a tuple M = (H, Ω, P, VG), where H, Ω, P, and VG are defined as before. The machine takes an input query G VG and considers all execution strategies ξ Ω. If there are strategies that result in a successful derivation d ξ G, any of those is returned. Otherwise, any failure derivation is returned. If all derivations are infinite, any infinite derivation is returned.

Example Complexity Example 15/27 Consider NCHR program P 3SAT : clause(a,_,_) <=> true(a). clause(_,b,_) <=> true(b). clause(_,_,c) <=> true(c). true(x), true(not(x)) <=> fail. Corresponding NCHR machine (, Ω H t, P 3SAT, 3SATCLAUSES) decides 3SAT in linear time 3SAT is NP-complete, so NP NP Ω H r

Example Complexity Complexity 16/27 P = P Ω H t P Ω H r P {K.U.Leuven} = NP {K.U.Leuven} NP Ω H r NP Ω H t = NP most of the inclusions collapse to equalities: PΩ H t = P {K.U.Leuven} because the RAM-simulator program of [CHR 05] is (Ω H t -)confluent

RASP machines Complexity 17/27 1 Introduction 2 3 4 RASP machines Complexity 5

RASP machines Complexity RASP machine 18/27 RASP machine = RAM machine with Stored Program much like real computers; von Neumann architecture data and program instructions in the same memory space so programs can be self-modifying in terms of complexity, RASP machine = RAM machine you can simulate a RASP on a RAM with constant factor overhead what about self-modifying CHR machines?

RASP machines Complexity Encoding a CHR program in CHR 19/27 encode CHR program using reserved keyword constraints rule/1, khead/2, rhead/2, guard/2, body/2 Example: foo @ bar ==> baz. qux @ blarg \ wibble <=> flob wobble. would be encoded as rule(foo), khead(foo,bar), guard(foo,true), body(foo,baz), rule(qux), khead(qux,blarg), rhead(qux,wibble), guard(qux,flob), body(qux,wobble)

RASP machines Complexity CHRSP machines 20/27 program in constraint store program is put in the query (or in the initial store) rule can only fire if there are no pending rule components to be Introduced

RASP machines Complexity Complexity 21/27 CHRSP machine decides co-np-complete languages in only linear time Example: Hamiltonian paths in directed graphs

RASP machines Complexity Hamiltonian paths in CHRSP 22/27 language of graphs without Hamiltonian path is co-np-complete consider this CHRSP program: size(n) <=> rule(find_path), size(n,a). size(n,a) <=> N>1 khead(find_path,node(a)), khead(find_path,edge(a,b)), size(n-1,b). size(1,a) <=> khead(find_path,node(a)), body(find_path,fail). input constraints: edge/2, node/1, size(n) (n = #nodes) program makes rule: find path @ node(a1),node(a2),...,node(a n), edge(a1,a2),edge(a2,a3),...,edge(a n 1,A n) ==> fail. this rule fires (rejecting the input graph) if and only if the graph has a Hamiltonian path

RASP machines Complexity Complexity 23/27 If a regular CHR machine exists that can simulate CHRSP machines with only polynomial overhead, then co-np P, and thus P = NP So if P NP, then CHRSP machines are strictly more powerful than regular CHR machines.

Summary Future work 24/27 1 Introduction 2 3 4 5 Summary Future work

Summary Future work Summary 25/27 In polynomial time, a regular CHR machine can do what a Turing machine (or a RAM machine) can do: P Ωt = P The same holds for non-deterministic CHR machines: NP Ωt = NP are more powerful than regular ones (even though P RASP = P), although exact bounds are still an open problem: conp P Ω sp t PSPACE

Summary Future work Future work 26/27 precise bounds on the complexity of CHRSP machines influence of strategy class on computational power non-deterministic self-modifying programs

Summary Future work Last slide... 27/27 Questions?