bug or feature ?

Gertjan van Heijst <gertjan@swi.psy.uva.nl>
X-Organisation: Social Science Informatics, University of Amsterdam
X-Address:      Roetersstraat 15, 1018 WB  Amsterdam, The Netherlands.
X-Phone:        +31 20 5256789
X-Fax:          +31 20 5256896
Date: Fri, 1 Apr 1994 15:34:23 +0200
From: Gertjan van Heijst <gertjan@swi.psy.uva.nl>
Message-id: <199404011334.AA00330@swisun31.swi.psy.uva.nl>
To: ontolingua@hpp.stanford.edu
Subject: bug or feature ?

Hi,

I'm having a problem with the translation of equivalence sentences. What
happens is the following: Whenever I want to translate a defintion that
contains EQUIVALENT: sentences, such as SINGLE-VALUED-SLOT (defined in the
frame ontology), these sentences are corrupted in the translation process.


(define-relation SINGLE-VALUED-SLOT (?class ?binary-relation)
  "SINGLE-VALUED-SLOT is a constraint on the second argument of a binary
relation that is conditional on the first argument to the relation being
an instance of a given class.  It is like single-valued, except it
is local to the values of the relation on instances of the given subset
of the domain."

  :iff-def (= (slot-cardinality ?class ?binary-relation) 1)

  :equivalent (and (instance-of ?class class)
                   (instance-of ?binary-relation binary-relation)
                   (=> (instance-of ?instance ?class)
                       (=> (holds ?binary-relation ?instance ?slot-value1)
                           (holds ?binary-relation ?instance ?slot-value2)
                           (= ?slot-value1 ?slot-value2)))))


When the above definition is handed over to the translators, the
implementation specific method IMPLEMENT-DEFINE-RELATION gets as its
seventh argument (the equivalence-sentences parameter) the following list
(pretty-printed):

(((AND (CLASS ?CLASS) 
       (BINARY-RELATION ?BINARY-RELATION)
       (=> (INSTANCE-OF ?INSTANCE ?CLASS)
	   (=> (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE1)
	       (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE2)
	       (= ?SLOT-VALUE1 ?SLOT-VALUE2))))
  ((DOMAIN SINGLE-VALUED-SLOT CLASS)
   (RANGE SINGLE-VALUED-SLOT BINARY-RELATION))))

This is not a list of equivalence sentences, but a list with as first
element a list of equivalence sentences and as second element a list of
second order sentences. I could trace down the orgin of this problem to the
function PREPROCESS-DEFINE-RELATION-ARGS defined in relations.lisp. More
specifically in the part of the function that is indicated with ";;---
Clean up :EQUIVALENT" The function ruleify is used. This function seems to
be responsible for this weird behaviour.


      ;;--- Clean up :EQUIVALENT
      (setq equivalent-list 
	    (nuke-second-orders equivalent-list canonical-arg-list
				":EQUIVALENT"))

      (multiple-value-setq (equivalent-list axiom-constraints-list)
	(canonicalize-first-orders equivalent-list axiom-constraints-list
		       relation-name canonical-arg-list t))

===>  (setq equivalent-list
	    (ruleify equivalent-list ":EQUIVALENT"
		     relation-name canonical-arg-list t))

Before the indicated SETQ the variable equivalent-list has the following
value: 

((AND (CLASS ?CLASS) 
      (BINARY-RELATION ?BINARY-RELATION)
      (=> (INSTANCE-OF ?INSTANCE ?CLASS)
	  (=> (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE1)
	      (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE2)
	      (= ?SLOT-VALUE1 ?SLOT-VALUE2))))) 

after the SETQ the value has become:

(((AND (CLASS ?CLASS)
       (BINARY-RELATION ?BINARY-RELATION)
       (=> (INSTANCE-OF ?INSTANCE ?CLASS)
	   (=> (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE1)
	       (HOLDS ?BINARY-RELATION ?INSTANCE ?SLOT-VALUE2)
	       (= ?SLOT-VALUE1 ?SLOT-VALUE2))))
  ((DOMAIN SINGLE-VALUED-SLOT CLASS)
   (RANGE SINGLE-VALUED-SLOT BINARY-RELATION))))

I cannot trace the orgin back any further because I don't really understand
what RULEIFY does. My question is the following: is this a BUG or a
feature? If it is a feature, is there any documntation that describes the
arguments that are passed to the implementation specific translators.

Gertjan van Heijst