[SLP-Homepage]    [Source Modules]    [Manual]    [Run]    [Examples]
 


Super Logic Programs Interpreter: User's Manual

Stefan Brass


This page is currently being written. Please look again at it in a few weeks/months.

Introduction

...

Example

The following is a legal input program:

% Note that all atoms must start with a lower case letter (as in Prolog).
 
visit(australia) v visit(europe).
happy <- visit(australia) v visit(europe).
bankrupt <- visit(australia) & visit(europe).
prudent <- not(visit(australia) & visit(europe)).
disappointed <- not visit(australia) & not visit(europe).

Lexical Syntax

Syntax of Formulas

Atomic Formulas

An atomic formula (positive literal) consists of a predicate and an optional argument list. If no argument list is used, the predicate is called a proposition. For instance, visit(X,europe) or the_sun_shines would be atomic formulas. The second one is a proposition.

A predicate or proposition is an atom, i.e. a word beginning with a lowercase letter.

An argument consists of a left parenthesis '(', a list of terms separated by commas, and a right parenthesis ')'.

A term can be a constant or a variable. There are currently two kinds of constants:

Variables are words beginning with an uppercase letter. The underscore counts as an uppercase letter. However, the variable consisting only of a single underscore and nothing else is special: Every occurrence of it denotes a new variable, distinct of all other occurrences of _. Therefore it is called the anonymous variable.

Logical Operators

The following logical operators can be used in formulas:

NameNotationAlternativesPriorityAssociativity
Classical Negation~ 1right associative
Default Negationnot 1nesting is forbidden
Conjunction (and)&, (comma)2right associative
Disjunction (or)|; (semicolon)   v3 right associative
Implication from left to right (then)-> 4 not associative
Implication from right to left (if)<-:-4 not associative
Equivalence (if and only if)<-> 4 not associative

The priorities mean that e.g.  p & q | r  is parsed as  (p & q) | r.  I.e. conjunction binds stronger than disjunction, or conjunction has precedence over disjunction. The two negations bind strongest, and the three implications bind weakest. If the priorities do not give the right structure or if one wants to be very clear, one can always use parentheses.

The associativity means that e.g.  p & q & r  is parsed as  p & (q & r).  If if were left associative, it would be parsed as e.g.  (p & q) & r.  But this distinction is logically not important (is conjunction is associative after all). The implications are declared as not associative, so e.g.  p -> q -> r  would be a syntax error. The reason is that here it would make a difference whether one writes  (p -> q) -> r  or  p -> (q -> r).  One has to decide for one of the two alternatives and use parentheses.

Restrictions for Default Negation

In super logic programs, there are three restrictions for the use of default negation:

The first condition has not to be taken quite literally: The transformation into clauses is done automatically, one can use arbitrary propositional formulas. However, default negation can only appear in negated context. Negated context means under ~, on the left side of ->, or on the right side of <-. Note however that two negations cancel out.

Range Restriction

It is important for the deduction algorithm that derived conditional facts are ground. Therefore all variables must be bound in a positive body literal. Again, this condition has to be satisfied only after the transformation into clauses.

For anonymous variables, the rules are very simple (since every occurrence must be binding): Anonymous variables cannot be used in head literals (i.e. atomic formulas in positive context) and they cannot be used in default negation literals.

Command-Line Arguments

There are four possible sources for input:

Note that the distinction between CGI-Mode and normal mode must be done at compile time. Using a runtime option would make all security checks useless. Note also that the output syntax in both modes differs. In CGI-Mode, HTML output (plus a header according to the CGI-specification) is produced, whereas in normal mode, output is in ASCII form.


Stefan Brass (sbrass@sis.pitt.edu), March 30, 2001.    [HTML 3.2 Checked]