Giter Site home page Giter Site logo

lorenzb / bellog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ptsankov/bellog

0.0 3.0 0.0 231 KB

Tools for the four-valued logic programming language BelLog

License: GNU General Public License v2.0

Python 94.04% Shell 0.16% PHP 2.99% CSS 2.81%

bellog's Introduction

BelLog

Tools for the four-valued logic programming language BelLog.

For details of the language see: http://dx.doi.org/10.3929/ethz-a-010045530

A policy interpreter is available at www.bellog.org

INSTALL

To use the BelLog interpreter you need to install:

Configure the BelLog interpreter with the correct path to your XSB binary. Edit the file src/config and edit the line

'XSB_PATH' : 'path to xsb'

where you change path to xsb with the path to XSB.

BELLOG SYNTAX

A BelLog policy file is a file that contains one rule per line. The syntax of policy rules is given below:

<rule>      := <atom> :- <query>
<query>     := <value> | <atom> | !<query> | ~<query> | (<query> ^ ... ^ <query>) 
               | (<query> <binary op> <query>) | (<query> < <query> > <query>)
<binary-op> := -plus- | -times- | -<value>-> 
<atom>      := <pred>[(<arg>, ... , <arg>)][@arg]
<pred>      := [a-z][a-z|A-Z|0-9|_]*
<arg>       := <const> | <var>
<const>     := [a-z][a-z|A-Z|0-9|_|']*
<var>       := [A-Z][a-z|A-Z|0-9|_|']*
<value>     := true | false | bot | top

The ternary operator p < q > r is the standard if-then-else. The result of p < q > r is p if q evaluates to true, and otherwise it is r.

An example of a BelLog policy file is:

p(X) :- ( (q(X) -plus- r(X)) -top-> s(X) )
q(a) :- true
r(a) :- false
s(a) :- bot

USAGE

To run the BelLog interpreter type:

$ ./src/run.py -i bellog_file -q query

where bellog_file is a BelLog policy file and query is written using the syntax of query elements; see syntax above.

EXAMPLE
$ ./src/run.py -i examples/simple.blg -q "p(a)"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.