KIF and packages

Tom Gruber <Gruber@sumex-aim.stanford.edu>
Full-Name: Tom Gruber
Message-id: <2863367454-316614@KSL-Mac-69>
Date: Wed, 26 Sep 90  12:50:54 PDT
From: Tom Gruber <Gruber@sumex-aim.stanford.edu>
To: interlingua@vaxa.isi.edu
Subject: KIF and packages
At the KSL we are trying an experiment to generate KIF 2.0 sentences
>From ontology definitions.  (I'll describe more about the approach
we're taking in a later message.)  One of the practical issues we've
run into is worth airing, since it's easy to "fix" in the
specification.

KIF is said to use the Lisp reader, which I assume means the Common
Lisp reader as specfied in "Common Lisp the Language: Second Edition".
The Lisp functions in the appendix of the KIF document are, of course
Common Lisp functions that reside in the lisp package.  So are symbols
intrinsic to KIF, such as <= and QUOTE.  Where are the other KIF
symbols, such as =>?

We need to specify in what package all symbols mentioned in the KIF
document reside.  The original Steele book was a tad ambiguous about
this for Lisp symbols, which resulted in incompatible implementations
until everybody figured out how to do the right thing.  Let's avoid
this for KIF.  This is not an issue for the KRSS group; the
translation from text to sentences with internal sexp structure is
part of the definition of the interlingua.

Below is a proposal worked out by Jim Rice, who is implementing a KIF
generator.  It basically says that all KIF symbols are in the KIF
package, which uses the common-lisp package.  This allows users to
(use-package '("COMMON-LISP" "KIF")).  We would require that for
knowledge exchange purpose any KIF reader or printer would bind
*package* to the KIF package.  We have to decide whether built-in KIF
symbols are exported, whether those include symbols that are also
exported from the Lisp and Common-Lisp package.  In general, it will
require the KIF document to be clear about exactly which symbols are
"taken" by KIF and which are only used as illustrative examples.

Here is a package definition form to implement this proposal, modulo
mentioning the right KIF-specified symbols.

(defpackage "KNOWLEDGE-INTERCHANGE-FORMAT"
  (:Use "COMMON-LISP")
  (:Nicknames "KIF")
  (:Export ;;; Appendix 3. Relation Constants.
	   "ALIKE"
	   "IS"
	   "<-"
	   "<--"
	   ;;; Appendix 4. Logical Constants.
	   "CUT"
	   ;;; Appendix 6. Sentence Operators.
	   "<=="
	   "==>"
	   ;;; Not mentioned in KIF 2.0 appendixes directly.
	   "=>"
	   "<=>"

	   "EXISTS"
	   "FORALL"
	   "DEFOBJECT"
	   "DEFUNCTION"
	   "DEFPRIMRELATION"
	   "DEFRELATION"
	   "SEQVARP"
	   "VARP"
	   "TRUE"
	   "DENOTATION"
	   "NAME"
	   "PROBABILITY"
	   "PREDICATE-COMPLETION"
	   "CIRCUMSCRIPTION"
	   "CIRC"
	   "ACTION"
	   "PERCEPT"
	   "CALL"
	   "PROVABLE"
	   "LISP"
	   "=<"
  ))