1 An Event-Condition- Action Logic Programming Language J. J. Alferes F. Banti A. Brogi.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Semantics Static semantics Dynamic semantics attribute grammars
Updates plus Preferences Luís Moniz Pereira José Júlio Alferes Centro de Inteligência Artificial Universidade Nova de Lisboa Portugal JELIA’00, Málaga,
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Agents That Reason Logically Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 7 Spring 2004.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Topics in Programming Reactive Systems Prof. Ronen Brafman and Dr. Gera Weiss.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
Rule Updates These languages and methodologies are basically concerned with facts that change –There is a set of fluents (fact) –There are static rules.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
A Preliminary Study on Reasoning About Causes Pedro Cabalar AI Lab., Dept. of Computer Science University of Corunna, SPAIN.
Luís Moniz Pereira CENTRIA, Departamento de Informática Universidade Nova de Lisboa Pierangelo Dell’Acqua Dept. of Science and Technology.
Auto-Epistemic Logic Proposed by Moore (1985) Contemplates reflection on self knowledge (auto-epistemic) Allows for representing knowledge not just about.
Logic Programming for Evolving Agents J.J. Alferes J.A. Leite L.M. Pereira.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Knowledge Representation & Reasoning (Part 1) Propositional Logic chapter 6 Dr Souham Meshoul CAP492.
Logical Agents Chapter 7. Why Do We Need Logic? Problem-solving agents were very inflexible: hard code every possible state. Search is almost always exponential.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
Knowledge Evolution Up to now we have not considered evolution of the knowledge In real situations knowledge evolves by: –completing it with new information.
Let remember from the previous lesson what is Knowledge representation
Luís Moniz Pereira Centro de Inteligência Artificial - CENTRIA Universidade Nova de Lisboa, Portugal Pierangelo Dell’Acqua Dept. of Science and Technology.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
Describing Syntax and Semantics
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
ASP vs. Prolog like programming ASP is adequate for: –NP-complete problems –situation where the whole program is relevant for the problem at hands èIf.
Introduction to ASMs Dumitru Roman Digital Enterprise Research Institute
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
A Language for Updates with Multiple Dimensions João Alexandre Leite 1 José Júlio Alferes 1 Luís Moniz Pereira 1 Halina Przymusinska 2 Teodor Przymusinski.
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
Logical Agents Logic Propositional Logic Summary
Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
EVOlving L ogic P rograms J.J. Alferes, J.A. Leite, L.M. Pereira (UNL) A. Brogi (U.Pisa)
MINERVA A Dynamic Logic Programming Agent Architecture João Alexandre Leite José Júlio Alferes Luís Moniz Pereira ATAL’01 CENTRIA – New University of Lisbon.
Languages of Updates João Alexandre Leite New University of Lisbon Dagstuhl, 25 November, 2002Dagstuhl Seminar
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
1 Logical Agents CS 171/271 (Chapter 7) Some text and images in these slides were drawn from Russel & Norvig’s published material.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
Automating DAML-S Web Services Composition Using SHOP2 Based on an article by Dan Wu, Bijan Parsia, Evren Sirin, James Hendler and Dana Nau in Proceedings.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
1 Temporal logic. 2 Prop. logic: model and reason about static situations. Example: Are there truth values that can be assigned to x,y simultaneously.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Artificial Intelligence 2004 Planning: Situation Calculus Review STRIPS POP Hierarchical Planning Situation Calculus (John McCarthy) situations.
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Knowledge and reasoning – second part
Computability and Complexity
EA C461 – Artificial Intelligence Logical Agent
Knowledge Representation
Relational Algebra Chapter 4, Part A
Logical Agents Chapter 7 Selected and slightly modified slides from
Complexity 6-1 The Class P Complexity Andrei Bulatov.
Logical Agents Chapter 7.
Relational Algebra Chapter 4, Sections 4.1 – 4.2
NP-Complete Problems.
Knowledge and reasoning – second part
Knowledge Representation I (Propositional Logic)
This Lecture Substitution model
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

1 An Event-Condition- Action Logic Programming Language J. J. Alferes F. Banti A. Brogi

2 Overview Event Condition Action (ECA) languages. Event Condition Action (ECA) languages. Updates of (ECA) rules. Updates of (ECA) rules. Dynamic Logic Programs (DyLPs). Dynamic Logic Programs (DyLPs). Evolving Reactive Algebraic (ERA) Programs. Evolving Reactive Algebraic (ERA) Programs. Syntax Syntax Semantics Semantics Example of usage. Example of usage. Parallel with DALI. Parallel with DALI. Future works. Future works.

3 Event Condition Action languages Event Condition Action languages Fundamental construct: ECA rules Fundamental construct: ECA rules On Event if Condition do Action When an Event occurs, under some Conditions, execute a given Action. When an Event occurs, under some Conditions, execute a given Action. Example Example On callE(Call,Emp) if office(Emp, N) do forw(Call,N). On callE(Call,Emp) if office(Emp, N) do forw(Call,N). Events and Actions can be simple or complex, Events and Actions can be simple or complex, resulting from the combination of basic ones. resulting from the combination of basic ones.

4 Updates of ECA rules. Updates of ECA rules. Problem: Problem: How to update the behaviour of an ECA System? How to update the behaviour of an ECA System? Example: Example: Suppose that, whenever an employer is in a working meeting, the phone call must not be forwarded to him. Suppose that, whenever an employer is in a working meeting, the phone call must not be forwarded to him. Solution: Solution: To allow the system to assert new rules and to encode exceptions to existing ECA rules. To allow the system to assert new rules and to encode exceptions to existing ECA rules. Inhibition rules: Rules that specifies when actions are not executed. Inhibition rules: Rules that specifies when actions are not executed. Example: Example: When callE(Call,Emp), meeting(Emp,) do not forw(Call,N). When callE(Call,Emp), meeting(Emp,) do not forw(Call,N).

5 Logic Programs Updates We consider sequences P1,..., Pn () of LPs called Dynamic Logic Programs (DLPs) We consider sequences P1,..., Pn (  P i ) of LPs called Dynamic Logic Programs (DLPs) is the initial program, while the others s are updates P 1 is the initial program, while the others P i s are updates Basic language: generalized logic programs Basic language: generalized logic programs The head of a rule can be either a positive or negative literal. The head of a rule can be either a positive or negative literal. Common ideas: Common ideas: Stable model approach Stable model approach Causal rejection principle: (i.e. the two rules has complementary heads). Causal rejection principle: A rule is rejected iff there is a more recent rule whose body is satisfied and is in conflict with the old one. (i.e. the two rules has complementary heads).

6 Syntax of ERA ECA rules: On Event if Condition do Action ECA rules: On Event if Condition do Action Data and inference rules: L. L 0 Data and inference rules: L. L 0 ← L 1, …L n. Every Li is an atom or the negation of an atom. Every Li is an atom or the negation of an atom. Inhibition rules: When B do not Action. Inhibition rules: When B do not Action. B is a conjunction of literals and events. B is a conjunction of literals and events. Event is a literal representing a simple or complex event. Event is a literal representing a simple or complex event. Complex event are obtained by an algebra of operators. Complex event are obtained by an algebra of operators. Condition is a conjunction of literals. Condition is a conjunction of literals. Action is an atom representing a simple or complex action. Action is an atom representing a simple or complex action. Complex actions are obtained by an algebra of operators. Complex actions are obtained by an algebra of operators.

7 Syntax of ERA Syntax of events: e::= e b |e 1 ٧ e 2 | e 1 ٨ e 2 | A(e 1, e 2,e 3 )| e def. e::= e b |e 1 ٧ e 2 | e 1 ٨ e 2 | A(e 1, e 2,e 3 )| e def. Syntax of basic and complex actions: Syntax of basic and complex actions: a b ::= a x | raise(e b )| assert(r)| retract(r)| define(d). a::= a b | a 1 ► a 2 | a 1 ||a 2 | IF(C, a 1, a 2 ) | a def. a::= a b | a 1 ► a 2 | a 1 ||a 2 | IF(C, a 1, a 2 ) | a def. Event and action definitions: Event and action definitions: e def is e. a def is a.

8 Semantics of ERA Events are atoms occurring in LP Ei called input programs and represent external inputs and internal events. Events are atoms occurring in LP Ei called input programs and represent external inputs and internal events. Inference system based on the refined semantics of DyLPs. Inference system based on the refined semantics of DyLPs. If an atom “Action” corresponding to an action is inferred, the corresponding action is executed. If an atom “Action” corresponding to an action is inferred, the corresponding action is executed. Replace On Event if Condition do Action with: Replace On Event if Condition do Action with: Action Action ← Condition, Event. Replace When B do not Action with: not Action Replace When B do not Action with: not Action ← B. Replace e def is e and a def is a with: Replace e def is e and a def is a with: a def e def. a def ← e and e def ← e.

9 Semantics of ERA(cont.) Add inference rules for deriving literals: Add inference rules for deriving literals: e 1 ٧ e 2 e 1. e 1 ٧ e 2 e 2. e 1 ٨ e 2 e 1,e 2. e 1 ٧ e 2 ← e 1. e 1 ٧ e 2 ← e 2. e 1 ٨ e 2 ← e 1,e 2. The semantics of actions is given by a transition system describing step by step how the execution of an action affects a program. The semantics of actions is given by a transition system describing step by step how the execution of an action affects a program. The execution of a complex action may require several steps formed by basic actions. The execution of a complex action may require several steps formed by basic actions. → G → G

10 Example On callE(Call,Emp) if office(Emp, N) do forw(Call,N). assert(r) assert(r) r : When callE(Call,emp), meeting(emp) do not forw(Call,N). New behaviour: every call to emp is forwarded to his mobile phone. New behaviour: every call to emp is forwarded to his mobile phone. assert(r1) ► assert(r2). r1: When callE(Call, emp) do not forw(Call, N). r2 : On callE(Call,emp), mobile(emp,m) do forw(Call,m). Return to previous behaviour: retract(r1) ► retract(r2).

11 Related work: DALI E:> Cond, A1, A2,…,An. Dali is a LP-like language for programming agents. Dali is a LP-like language for programming agents. A1:> Cond, A3, A4,... A1:> A5, A6,…. It is possible to define complex actions. It is possible to define complex actions. E is always a basic event, no event algebra. E is always a basic event, no event algebra. It is not possible to update rules. It is not possible to update rules. Unlike ERA, DALI is implemented. Unlike ERA, DALI is implemented.

12 Future works Transaction ERA. Transaction ERA. To provide the possibility to execute actions as transactions. To provide the possibility to execute actions as transactions. Local transactions are ACID. Local transactions are ACID. Transactions involving external iterations relays on compensation. Transactions involving external iterations relays on compensation. Possibility to use ACID sub-transactions and compensation in the same transaction. Possibility to use ACID sub-transactions and compensation in the same transaction.

13 Thanks!

14 Future works A dynamic rule is of the form effect(F Body) Cond. A dynamic rule is of the form effect(F ← Body) ← Cond. It means: if Cond is true in this state, then F Body is a rule in the next state (and only in that one). It means: if Cond is true in this state, then F ← Body is a rule in the next state (and only in that one). Cond are conjunctions of fluent or action literals. Cond are conjunctions of fluent or action literals. effect(F Body) Cond is a macro for: effect(F ← Body) ← Cond is a macro for: F ← Body, event(F ← Body). assert(event(F ← Cond). ) ← Cond. assert( not event(F ← Cond). ) ← event(F ← Cond), not assert(event(F ← Cond)). An inertial declaration is of the form inertial(I),where I is a set of fluents which means: all the fluents in I are inertial, i.e. their truth value is preserved from one state to the next one unless changed by the effect of an action. An inertial declaration is of the form inertial(I),where I is a set of fluents which means: all the fluents in I are inertial, i.e. their truth value is preserved from one state to the next one unless changed by the effect of an action. Inertial(I) is a macro for: Inertial(I) is a macro for: assert(prev(F)) F. assert(not prev(F)) not F. assert(prev(F)) ← F. assert(not prev(F)) ← not F.

15 Example: The Yale shooting problem There is a single-shot gun which is initially unloaded, and some turkeys. There is a single-shot gun which is initially unloaded, and some turkeys. We can load the gun and shoot to one of the turkeys. If we shoot, there is a bang, the gun becomes unloaded, we can hit the turkey or miss it, if we hit a turkey it dies. We can load the gun and shoot to one of the turkeys. If we shoot, there is a bang, the gun becomes unloaded, we can hit the turkey or miss it, if we hit a turkey it dies. A turkey moves iff it is alive. A turkey moves iff it is alive. I: initialize{loaded, moving(X),dead(X) missed(X), hit(X)} D: effect(loaded.) ← load. inertial (loaded) effect(not loaded.) ← shoot(X). inertial (dead(X)) effect (bang.)← shoot(X). moving(X) ← not dead(X). effect(hit(X) ← not missed(X) ) ← shoot(X). dead(X)←hit(X). effect (missed(X) ← not hit(X) ) ← shoot(X).

16 Comparisons with other works We compared EAPs with the existing action description languages A, B and the (definite fragment of) C. We compared EAPs with the existing action description languages A, B and the (definite fragment of) C. For every language we find a linear and modular translation into EAPs: For every language we find a linear and modular translation into EAPs: Hence EAPs are at least as expressive as the considered languages. Hence EAPs are at least as expressive as the considered languages.

17 Describing changes In practical situations, it may happen that the very rules of the domain change with time In practical situations, it may happen that the very rules of the domain change with time EAPs are of Evolp programs. So, they can be updated by external events. EAPs are of Evolp programs. So, they can be updated by external events. It is possible to update static rules and the descriptions of the effects of an action. It is possible to update static rules and the descriptions of the effects of an action. We consider again the Yale shooting problem. We consider again the Yale shooting problem. Let us now consider that after some shots, we acquire rubber bullets. We can now either load the gun with normal bullets or with a rubber bullet, if we shoot with a rubber loaded gun, we never kill a turkey. Let us now consider that after some shots, we acquire rubber bullets. We can now either load the gun with normal bullets or with a rubber bullet, if we shoot with a rubber loaded gun, we never kill a turkey. E 1 :assert(initialize (rubber_loaded)) D 1 : effect (not dead(X) ← hit(X)) ← rubber _loaded. effect (not rubber _loaded) ← shoot(X). E 2 : assert(D 1 ) Inertial(rubber_loaded)

18 Describing changes (cont.) We use a new macro construct not effect(r) to prevent the effects of an actions under some conditions We use a new macro construct not effect(r) to prevent the effects of an actions under some conditions Suppose the cylinder of the gun becomes dirty and, whenever one shoots, the gun may either work properly or fail. Suppose the cylinder of the gun becomes dirty and, whenever one shoots, the gun may either work properly or fail. If it fails the shoot action has no real effect. If it fails the shoot action has no real effect. E 1 : assert(initialize{ fails, work}) D 2 : effect (fails ← not work.) ← shoot(X). effect (work ← not fails.) ← shoot(X). effect (loaded ← fails.) ← loaded. effect(rubber_loaded ← fails) ← rubber_ loaded. effect(loaded←fails)← loaded. E 2 : assert(D 2 ) not bang ← fails. not missed(X) ← fails. not hit(X) ← fails.

19 Conclusions Starting for the language for LP updates Evolp, we have defined the new action description language EAPs. Starting for the language for LP updates Evolp, we have defined the new action description language EAPs. We have shown how to use EAPs by an example. We have shown how to use EAPs by an example. We have compared EAPs with existing work by showing translations of action languages A, B and C into EAPs. We have compared EAPs with existing work by showing translations of action languages A, B and C into EAPs. We have shown peculiar capabilities of EAPs to handle changes in the rules of the considered domain and provided an example of such usage. We have shown peculiar capabilities of EAPs to handle changes in the rules of the considered domain and provided an example of such usage.