View source with raw comments or as raw
    1# README
    2
    3In this repository you will find the benchmark and instruction to
    4reproduce the evaluation and example presented in the paper
    5__"Modelling and Reasoning in Event Calculus using Goal-Directed Constraint Answer Set Programming"__.
    6
    7### The BEC theory
    8
    9The file [bec_theory.pl](event-calculus/bec_theory.pl) contains the translation of the Basic Event Calculus theory.
   10
   11### The light.pl example
   12
   13This example is based on the example 14 in [Mueller, 2014b] and reason about turning on and off a light.
   14
   15There are four files implementing different features:
   16
   17* [bec\_light\_01\_....pl](event-calculus/example-light/bec_light_01.pl) is the simplest version of the problem.
   18* [bec\_light\_02\_....pl](event-calculus/example-light/bec_light_02.pl) add the global constraint to ensure that light\_red and light\_green.
   19* [bec\_light\_03\_...pl](event-calculus/example-light/bec_light_03_inconsistent.pl) change the trajectory of light\_red generating an overlap w.r.t. light\_green.
   20* [bec\_light\_04\_...pl](event-calculus/example-light/bec_light_04_theinconsistencedonothappens.pl) similar to the previous but the overlap does not occur.
   21
   22To check the behaviour of the first file with several queries execute the script:
   23
   24```
   25go_bec_light_01
   26```
   27
   28to check the behaviour of the rest of files execute the script:
   29
   30```
   31go_bec_light_02_03_04
   32```
   33
   34The scripts are located [here](event-calculus/scripts/). Note that there are the queries that success returning a valid partial model while others do not. For each of the queries there is a comment which explain the expected result.
   35
   36Additionally you can execute the example invoking s(CASP) directly from the terminal. As an example let us execute s(CASP) asking for the justification tree with (note that it will execute the last uncommented query that appear in the file):
   37
   38```
   39scasp -j bec_light_01.pl
   40```
   41
   42### The tap.pl example
   43
   44This example is based on an example from [Shanahan, 1999] where a vessel is filled with water.
   45
   46There are four files implementing different features:
   47
   48* [bec\_tap\_01\_...pl](event-calculus/example-tap/bec_tap_01_overflow.pl) is the simplest version of the problem.
   49* [bec\_tap\_02\_...pl](event-calculus/example-tap/bec_tap_02_no_overflow.pl) similar to the previous but in this example the water is not spilled.
   50* [bec\_tap\_03\_...pl](event-calculus/example-tap/bec_tap_03_two_models.pl) in this example we have two possible worlds/models.
   51* [bec\_tap\_04\_...pl](event-calculus/example-tap/bec_tap_04_abducible_infer_event_time.pl) the most complex example (the one described in the paper).
   52
   53To check the behaviour of each file with several queries execute the scripts (located [here](event-calculus/scripts/)):
   54
   55```
   56go_bec_tap_01_overflow
   57go_bec_tap_02_no_overflow
   58go_bec_tap_03_two_models
   59go_bec_tap_04_abducible_infer_event_time
   60
   61```
   62
   63Note that there are the queries that success returning a valid partial model while others do not. For each of the queries there is a comment which explain the expected result.
   64
   65
   66# Installation
   67
   68## CIAO
   69
   70`Ciao` is a programming language that builds up from a logic-based simple kernel, and is designed to be extensible and modular. It is available at [http://ciao-lang.org](http://ciao-lang.org). Its supports:
   71
   72* constraint logic programming (and, in particular, Prolog)
   73* different levels of modularity (from small to large scale):
   74  * modules as (analysis-friendly) compilation units
   75  * bundles as collections of modules
   76* packages as modules implementing language extensions (syntactic definitions, compilation options, compiler plugins)
   77* assertions (as an homogeneous framework that allows static and dynamic verification to work cooperatively in a unified way)
   78* multiparadigm constructs (meta-programming, higher-order, mutables, concurrency, functions, etc.) and interfacing with foreign code
   79
   80The system implements some advanced features such as separate and incremental compilation, global program analysis and static debugging and optimization (via source to source program transformation, `CiaoPP preprocessor`), a build automation system, documentation generator, debugger, and (Emacs-based) development environment.
   81
   82To begin the interactive installation type the following one-liner in a sh-compatible terminal:
   83
   84```
   85curl https://ciao-lang.org/boot -sSfL | sh
   86```
   87
   88Do not forget to rerun the bashrc file `source ~/.bashrc`. If you have any problem go [here](http://ciao-lang.org/install.html) for details.
   89
   90## s(CASP)
   91
   92`s(CASP)` is an implementation of the stable model semantics of
   93constraint logic programming. Unlike similar systems, it does not
   94employ any form of grounding. This allows `s(CASP)` to execute programs
   95that are not finitely groundable, including those which make use of
   96lists and terms. It is available  [here](https://gitlab.software.imdea.org/ciao-lang/sCASP).
   97
   98Once you have Ciao working in your computer to install `s(CASP)` type the following one-liner in a sh-compatible terminal:
   99
  100```
  101ciao get gitlab.software.imdea.org/ciao-lang/sCASP
  102```
  103
  104If you have any problem go [here](https://gitlab.software.imdea.org/ciao-lang/sCASP/blob/master/README.md) for details.
  105
  106# Evaluation of s(CASP) against s(ASP)
  107
  108In order to compare the run time of s(CASP) versus s(ASP) in the folder `aux-sasp` there are four files:
  109
  110* [bec\_theory\_discrete.pl](aux-sasp/bec_theory_discrete.pl) with the Basic Event Calculus theory implemented without constraint.
  111* [bec\_light\_sasp\_discrete\_0.5.pl](aux-sasp/bec_light_sasp_discrete_0.5.pl) the light simpler example adapted to be use using s(ASP) with a step-wise of 0.5 to discretize the time domain from 0 to 5.
  112* [bec\_light\_sasp\_discrete\_0.25.pl](aux-sasp/bec_light_sasp_discrete_0.25.pl) the light simpler example adapted to be use using s(ASP) with a step-wise of 0.25 to discretize the time domain from 0 to 5.
  113* [go\_time\_bec\_light\_sasp\_discrete](aux-sasp/go_time_bec_light_sasp_discrete) to run the benchmark using s(ASP).
  114
  115s(ASP) is available [here](https://sourceforge.net/projects/sasp-system/). We used the version 1.0.7.
  116
  117In the scripts folder  for s(CASP) (located [here](event-calculus/scripts/)) there is the script to run the benchmarks in the paper computing the time for s(CAPS):
  118
  119* [go\_time\_bec\_light\_01](event-calculus/scripts/go_time_bec_light_01) to run the benchmark using s(CASP).
  120
  121
  122# Evaluation of s(CASP) against clingo
  123
  124In order to compare the run time of s(CASP) versus clingo in the
  125folder `sCASP-clingo` there are several programs and scripts. We use
  126extension `.pl` for s(CASP), the extension `.clingo` for clingo 5.2.0
  127and `.e` for the encoding using F2LP.
  128
  129In the folder [scripts](sCASP-clingo/scripts/) you can find the files
  130used to run the benchmarks:
  131
  132* [go\_light](sCASP-clingo/scripts/go_light) run the evaluation using the light scenario in folder [light](sCASP-clingo/light).
  133*