Skip to content

jorgefandinno/eclingo

 
 

Repository files navigation

eclingo

A solver for Epistemic Logic Programs.

GitHub GitHub release (latest by date) CI badge


Description

eclingo is a solver for epistemic logic programs [1] built upon the ASP system clingo.
Currently, eclingo can compute world views under the following semantics:

  • Gelfond 1991; Gelfond and Przymusinska 1993; Gelfond 1994 (G94) [2, 3, 4]

Dependencies

  • python 3.9
  • clingo 5.5 Python module.

Installation

Install clingo

Install the correct version of python and clingo:

conda create --name eclingo python=3.9
conda activate eclingo
conda install -c potassco clingo=5.5

For installation in development mode go to the contributing section below.

Clone

Clone this repo:

git clone https://github.com/potassco/eclingo.git &&
cd eclingo/ &&
git checkout develop

Setup

Change your directory and install eclingo:

pip install .

Usage

Input language

eclingo's syntax considers three types of statements:

Rules

eclingo accepts rules with the same structure as clingo does. Additionally, eclingo allows these rules to include subjective literals in their body. These subjective literals are represented using the modal operator K, which is represented as &k{}. The expression inside the curly braces can be an explicit literal (that is, an atom A or its explicit negation -A) possibly preceded by default negation, that is represented not (alternatively default negation can be represented as ~ for backward compatibility).

Modal operator M is not directly supported but M q can be replaced by the construction not &k{ not q }.

For example, the epistemic logic program:

p <- M q.

is written under eclingo's syntax as:

p :- not &k{ not q }.

Show statements

Show statements follow clingo's syntax but, in eclingo, they refer to subjective atoms.

For example, the show statement:

#show p/1.

refers to the subjective atom &k{p/1}.

Contributing

Install clingo using conda as explained above.

Clone this repo (or make your own fork of https://github.com/potassco/eclingo.git):

git clone git@github.com:jorgefandinno/eclingo.git &&
cd eclingo &&
git checkout develop

Unistall eclingo if you have already installed it

pip uninstall eclingo

Install eclingo in development model and reactivate conda

pip install -e .[dev] &&
conda deactivate &&
conda activate eclingo

Test your installation

python -m pip install nox
nox

Note that nox -r can be used to speed up subsequent runs. It avoids recreating virtual environments.

To contribute create a new branch

git checkout -b <your_name>/<branch>

where <your_name> is to be replaced by your name and <branch> should be the name of the branch you are creating.

Once you have made the contributions, test that everythink works correctly. We auto format code using black. We provide a pre-commit config to automate this process. It can be set up using the following commands:

python -m pip install pre-commit
pre-commit install

This blackens the source code whenever git commit is used.

There is also a format session for nox. It can be run as follows:

nox -rs format
nox -rs format -- --check --diff clingox

The latter command can be used to inspect changes before applying them.

Finally, test, commit and push the changes to your branch in the repository.

nox -r
git commit -am"<comment>"
git push

where <comment> should state the changes made. If comments are too long to state in one line, you can use git commit and write them in the editor.

Create a pull request in github.

License


References

[1] Cabalar P., Fandinno J., Garea J., Romero J. and Schaub T. 2020. eclingo: A solver for Epistemic Logic Programs. In Theory and Practice of Logic Programming.

[2] Gelfond, M. 1991. Strong introspection. In Proceedings of the Ninth National Conference on Artificial Intelligence (AAAI’91), T. Dean and K. McKeown, Eds. AAAI Press / The MIT Press, 386–391.

[3] Gelfond, M. and Przymusinska, H. 1993. Reasoning on open domains. In Logic Programming and Non-monotonic Reasoning, Proceedings of the Second International Workshop, Lisbon, Portugal, June 1993, L. Moniz Pereira and A. Nerode, Eds. MIT Press, 397–413.

[4] Gelfond, M. 1994. Logic programming and reasoning with incomplete information. Annals of Mathematics and Artificial Intelligence 12, 1-2, 89–116.

About

A solver for epistemic logic programs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%