External Transaction Logic (ET R) is an extension of logic programming useful to reason about the behaviour of agents that have to operate in a transactional way, in a two-fold environment: an internal knowledge base defining the agent's internal knowledge and rules of behaviour, and an external world where it executes actions and interacts with other entities. Actions performed by the agent in the external world may fail, e.g. because their preconditions are not met, or because they violate some norm of the external environment. The failure to execute some action should lead, in the internal knowledge base, to its complete rollback, following the standard ACID transaction model used e.g. in databases. Since it is impossible to rollback external actions performed in the outside world, external consistency must be achieved by executing compensating operations (or repairs) that revert the effects of the initial executed actions. In ET R, repairs are stated explicitly in the program. With it, every performed external action is explicitly associated with its corresponding compensation or repair. Such user-defined repairs provide no guarantee to revert the effects of the original action. In this article, we define how ET R can be extended to automatically calculate compensations in case of failure. For this, we start by explaining how the semantics of Action Languages can be used to model the external domain of ET R, and how we can use it to reason about the reversals of actions.http://logcom.oxfordjournals.org/ Downloaded from 1. formalize how the external oracle in ET R can be instantiated using action languages in general, and specifically, with action language C (Section 3); 2. generalize ET R to deal with repair plans, rather than simply with compensating actions (Section 5); 3. formalize how to automatically infer repair plans when the external environment is expressed as an action language (Section 5); and 4. elaborate on the properties of these repair plans (Section 5.3) and compare our solution with the related work (Section 6).This article is a revised extended version of the work in [20] for the Special Issue of the Journal of Logic and Computation on Computational Logic in Multi-Agent Systems, with additional discussion, proof of the results and further comparison of the related work. ET R [19] is an extension of Transaction Logic [3] to deal with actions performed in an external environment of which an agent has no control. With it, one can specify and reason about changes in by guest on May 8, 2015 http://logcom.oxfordjournals.org/ Downloaded from to be true (and say that φ succeeds in P from the state S 1 ), if there is a path S 1 , A 1 ..., A n−1 S n that makes (1) true.
External transaction logic
Example 7Recall our Example 5. In the program P defined there, it is the case that P,({},E 1 )-|= t, i.e. that transaction t can successfully execute in a path starting in state ({},E 1 ) Particularly, that statement is true because the execution of transaction t holds in the following paths:This means that,...