Stefan Brass

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

...

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).

- The input file may not contain null characters or very long lines (current limit is 4K).
- Comments start with a percent character "
`%`

" and reach to the end of the line. - Atoms are sequences of letters and digits
starting with a lowercase letter.
Some national characters are recognized
(e.g. "äöü" qualify as lowercase letters).
Furthermore,
the underscore letter "
`_`

" is acceptable within the atom (but not as the first letter). There are two exceptions: "`not`

" and "`v`

" are reserved words and cannot be used as an atoms. Atoms can also be written as`'xxx'`

where`xxx`

is a sequence of arbitrary characters except newline (and "`'`

"). However,`xxx`

may not be the empty string (i.e. "`''`

" is illegal). Note that`abc`

and`'abc'`

are treated as identical atoms. However, when the reserved words are quoted, they can be used as ordinary atoms. - Integers are sequences of digits (at least one),
optionally preceded by a "
`-`

". The maximal allowed integer is 65535, the minimal integer is -65536 (i.e. integers are 16 bit). - Variables start with an uppercase letter.
After that,
they can contain arbitrary alphanumeric characters.
Some national characters are recognized.
The underscore letter ("
`_`

") is treated like an uppercase letter, so it is acceptable everywhere within the variable. However, the token consisting of a single underscore is treated special: Every occurrence denotes a new variable ("anonymous variable" like in Prolog). - Conjunction (logical "and") can be written as "
`&`

" or as "`,`

". - Disjunction (logical "or") is written as "
`|`

". The notation "`;`

" is also understood. For compatibility reasons, also "`v`

" is still accepted. - Implication (logical "if") is written as "
`<-`

". The Prolog notation "`:-`

" is also accepted. - Implication (logical "then") is written as "
`->`

". - Equivalence (logical "if and only if") is written as
"
`<->`

". - Negation (logical "not") is written as "
`~`

". Note that this is real classical negation, and not default negation. - Default negation is written "
`not`

". - Parentheses ("
`(`

" and "`)`

") are also understood. - All formulas are ended with "
`.`

". It is required (as in Prolog) that the fullstop is followed by white space (usually a newline).

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:

- An atom, e.g.
`xyz`

, which is a symbolic constant (like an element of an enumeration type). One can also use quoted atoms, e.g.`'quoted atom!'`

. For all practical purposes, these are string constants. - An integer,
e.g.
`64`

or`-4`

.

`_`

.
Therefore it is called the anonymous variable.
The following logical operators can be used in formulas:

Name | Notation | Alternatives | Priority | Associativity |
---|---|---|---|---|

Classical Negation | ~ | 1 | right associative | |

Default Negation | not | 1 | nesting is forbidden | |

Conjunction (and) | & | , (comma) | 2 | right associative |

Disjunction (or) | | | ; (semicolon) v | 3 | 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.

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

- Default negation can only be used in the rule body.
- Default negation cannot be nested.
- Inside default negation,
only conjunction (
`&`

) and disjunction (`|`

) can be used, but not negation (`~`

) or implication (`->`

,`<-`

,`<->`

).

`~`

,
on the left side of `->`

,
or on the right side of `<-`

.
Note however
that two negations cancel out.
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.

There are four possible sources for input:

- If
`slp`

was compiled in CGI-Mode,`slp`

can be called with an argument in the form http://www.informatik.uni-giessen.de/db-cgi/slp?visit, in which case it reads the super logic program from the file visit in a specified directory (`VER_CGI_EXDIR`

) on the server machine. Since such things are potentially dangerous, the argument must be a sequences of lowercase letters (or "`_`

") of length at most 8. - If
`slp`

was compiled in CGI-Mode, but there is no command line argument,`slp`

reads the super logic program from the standard input (according to the CGI-specification for the POST-method). - If
`slp`

was compiled normally, and a file is specified on the command line, the input is taken from this file. In this case, there are no restrictions on the possible file names. - If
`slp`

was compiled normally, and no command line argument is given,`slp`

reads the super logic program from standard input.

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