ontologyportal / sigmakee

Sigma Knowledge Engineering Environment
https://www.ontologyportal.org
GNU General Public License v3.0
103 stars 35 forks source link

Variables not correctly recognized as functions #72

Open Regermeister opened 3 years ago

Regermeister commented 3 years ago

Consider the following two formulas from Merge.kif:

(=>
  (and
    (instance ?FUNCTION UnitOfMeasureMultiplier)
    (instance ?UNIT CompositeUnitOfMeasure))
  (instance (?FUNCTION ?UNIT) CompositeUnitOfMeasure))

(=>
  (and
    (instance ?FUNCTION UnitOfMeasureMultiplier)
    (instance ?UNIT NonCompositeUnitOfMeasure))
  (instance (?FUNCTION ?UNIT) NonCompositeUnitOfMeasure))

From what I can tell, kb.isFunctional does explicitly consider the case of a variable in the car position, but the context of the variable's typing gets lost when formulas are examined recursively, which is why calling isFunctional on the (?FUNCTION ?UNIT) part will always return false. (At least I think that's what's happening here.)

This affects (probably among other things) the translation to TPTP when holdsPrefix is turned on, where said sub-formula is translated to s__holds_2__(V__FUNCTION,V__UNIT) as opposed to s__apply_2__(V__FUNCTION,V__UNIT).

From what I can tell, these 2 formulas are the only one affected.

apease commented 3 years ago

holdsPrefixing is deprecated, since predicate variable substitution is a much higher performance solution in inference. I recommend running with , but, that said, you're right that isFunction() doesn't check for a Function variable and that would be a good special case to check. I'll see if I can do that. Very good catch!

Regermeister commented 3 years ago

holdsPrefixing is deprecated, since predicate variable substitution is a much higher performance solution in inference.

I see. For future reference, is there somewhere I can check for settings being deprecated?

I recommend running with ,

Did you mean to type "running with predicate variable substitution" or is there something else?

apease commented 3 years ago

oops GitHub removed the XML I included

<preference name="holdsPrefix" value="no" />

I talk about holds prefixing in my book and papers but don't think I have a warning message for it. I'll add that

Regermeister commented 3 years ago

I see. Thank you

apease commented 3 years ago

pushed a fix that now prints a warning of holdsPrefix is set to "yes"