[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The syntax of PowerLoom is described below using a modified BNF notation adapted from the KIF specification.
13.1 Alphabet | ||
13.2 Grammar |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
We distinguish between terminals, which are part of the language, and
nonterminals. All nonterminals are bracketed as follows
<nonterminal>
. Squared brackets means zero or one instances of
the enclosed expression; <nonterminal>*
means zero or more
occurrences and <nonterminal>+
means one or more occurrences of
<nonterminal>
. The notation <nonterminal1> - <nonterminal2>
refers to all of the members of <nonterminal1>
except for those
in <nonterminal2>
.
A word is a contiguous sequence of characters, which include all upper case letters, lower case letters, digits and alpha characters (ASCII character set from 93 to 128) excluding some special characters like white spaces, single and double quotes and brackets.
<word> ::=
a primitive syntactic object
Special words are those who refer to a variable. All variables are preceded by a question mark.
<indvar> ::=
a word beginning with the character ?
A string <string>
is a character sequence including words plus
all special charcters (except double quotes) enclosed in double quotes.
A double quote can be included in a string if it is preceeded by the
escape character ’\
’.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Legal expressions in PowerLoom are forms, which are either a statement or a definition, described in more detail below.
<form> ::= <statement> | <definition>
13.2.1 Constants and Typed Variables | ||
13.2.2 Terms | ||
13.2.3 Sentences | ||
13.2.4 Definitions |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The language consists of several groups of operators, defined as follows:
<termop> ::= listof | setof | the | setofall | kappa
<sentop> ::= = | /= | not | fail | and | or | forall | exists
| <= | => | <=> |<<= | =>> | <~ | ~> | <<~ | ~>>
<defop> ::= defconcept | deffunction | defrelation | defrule |
:documentation | :-> |
:<= | :=> | :<<= | :=>> |
:<=> | :<=>> :<<=> | :<<=>> | := |
:axioms
<operator> ::= <termop> | <sentop> | <defop>
All other words are constants (words which are not operators or variables):
<constant> ::= <word> - <indvar> - <operator>
Semantically, there are different categories of constants — Concept
constants <conceptconst>
, Function constants
<funconst>
, Relation constants <relconst>
,
Rule constants <ruleconst>
and Logical constants
<logconst>
. The differences between these categories are entirely
semantic. However, some operators will only accept specific constants.
In contrast to the specification of KIF3.0, PowerLoom supports a typed syntax. Therefore, variables in quantified terms and sentences can appear either typed or untyped, as follows:
<vardecl> ::= (<indvar> <constant>) | <indvar>
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Terms are used to denote objects in the world being described:
<term> ::= <indvar> | <constant> | <funterm> | <listterm> | <setterm> |
<quanterm>
<listterm> ::= (listof <term>*)
<setterm> ::= (setof <term>*)
<funterm> ::= (<funconst> <term>+)
Note: Zero arguments are allowed for <funterm>
in KIF3.0:
<term>*
<quanterm> ::= (the <vardecl> <sentence>) |
(setofall <vardecl> <sentence>) |
(kappa {<vardecl> | (<vardecl>+)} <sentence>) |
(lambda {<vardecl> | (<vardecl>+)} <term>)
Note: KIF3.0 allows <term>
instead of <vardecl>
for
setofall
. No <quanterm>
as well as no <setterm>
in
core of KIF as a result of descision 95-3 (March 1995).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Sentences are used to express propositions about the world:
<sentence> ::= <constant> | <equation> | <inequality> |
<relsent> | <logsent> | <quantsent>
<equation> ::= (= <term> <term>)
<inequality> ::= (/= <term> <term>)
<relsent> ::= (<constant> <term>+)
Note: Zero arguments allowed in KIF3.0 for <relsent>
(<term>*
). <funconst>
is currently not allowed in
PowerLoom (use (= <funterm> <term>)
instead).
<logsent> ::= (not <sentence>) |
(fail <sentence>) |
(and <sentence>*) |
(or <sentence>*) |
(=> <sentence>* <sentence>) | (=>> <sentence>* <sentence>) |
(<= <sentence> <sentence>*) | (<<= <sentence> <sentence>*) |
(~> <sentence>* <sentence>) | (~>> <sentence>* <sentence>) |
(<~ <sentence> <sentence>*) | (<<~ <sentence> <sentence>*)
<quantsent> ::= (forall {<vardecl> | (<vardecl>+)} <sentence>) |
(forall {<vardecl> | (<vardecl>+)} <sentence> <sentence>) |
(exists {<vardecl> | (<vardecl>+)} <sentence>)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
PowerLoom supports two distinct categories of definitions — relation
definitions (including concept and function definitions) and rule
definitions. A relation definition introduces a new logical constant,
and states some facts about that constant (e.g., who its parents are in
a subsumption taxonomy). A rule definitions binds a new constant to a
proposition (so that the constant denotes the proposition) and
asserts the truth of that proposition. Usually, the proposition
asserted by a defrule
is an implication. The assertional truth
of a proposition defined by a rule can be altered by asserting or
retracting the constant that denotes the proposition.
<keyword-option> ::= <keyword> <word> <definition> ::= <reldefinition> | <objdefinition> | <ruledefinition> <reldefinition> ::= (defconcept <conceptconst> <vardecl> [:documentation <string>] [:<= <sentence>] | [:=> <sentence>] | [:<<= <sentence>] | [:=>> <sentence>] | [:<=> <sentence>] | [:<=>> <sentence>] | [:<<=> <sentence>] | [:<<=>> <sentence>] | [:axioms {<sentence> | (<sentence>+)}] | [<keyword-option>*]) | (deffunction <funconst> (<vardecl>+) [:documentation <string>] [:-> <vardecl>] [:<= <sentence>] | [:=> <sentence>] | [:<<= <sentence>] | [:=>> <sentence>] | [:<=> <sentence>] | [:<=>> <sentence>] | [:<<=> <sentence>] | [:<<=>> <sentence>] | [:axioms {<sentence> | (<sentence>+)}] [<keyword-option>*]) | (defrelation <relconst> (<vardecl>+) [:documentation <string>] [:<= <sentence>] | [:=> <sentence>] | [:<<= <sentence>] | [:=>> <sentence>] | [:<=> <sentence>] | [:<=>> <sentence>] | [:<<=> <sentence>] | [:<<=>> <sentence>] | [:axioms {<sentence> | (<sentence>+)}] [<keyword-option>*]) <objdefinition> ::= (defobject <constant> [:documentation <string>] [<keyword-option>*]) <ruledefinition> ::= (defrule <constant> <sentence> [:documentation <string>] [<keyword-option>*]) |
<ruledefinition> ::= (defrule <ruleconst> <sentence>)
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by Hans Chalupsky on January 6, 2023 using texi2html 1.82.