Hello all! Thank you again for all your support last I time I asked. In the meantime I made quite some progress on my project, but now I'm again at a point where I could use your expertise.
I know most of you are more comfortable on the scheme side of things, so I
converted my current problem sandbox for your convenience.
The below code creates 3 concepts, establishes very basic inheritance and
runs a couple of reasoning experiments over inheritance and identity (which
you'll have to uncomment individually as some return errors).
The goal is to get back one set/list of alice and bob with properly
annotated truth values [(Not (stv 1.0 1.0) (Identical (stv 0.0 1.0) alice
bob)) as part of its output], but none of the other weird results.
(Please disregard the pointlessness of this toy example, in my real
application the identity comparison is needed)
I added notes to most lines of the code, saying what effect they have, and
what effects I expect instead.
My main questions are:
- How can I get the backward chainer to evaluate the IdenticalLink on
its own?
- How can I get the backward chainer to assign a proper truth value to
the NotLink?
- How can I change the fuzzy-conjunction role to still be fuzzy but not
cause VariableLinks to be returned by the backward chainer? ...and why is
that happening anyway?
(to run this, you'll have to adjust the load-from-path paths...I haven't
figured out yet if there is a way to include these in a relative fashion
that works across installations.)
(use-modules (opencog) (opencog logger) (opencog exec) (opencog ure))
(define rbs (Concept "foo"))
(ure-set-maximum-iterations rbs 30)
; NOTE: If I use this (instead of the true-conjunction rule) the backward
chainer returns 3 results, 2 of which still include VariableNodes. What
keeps this from happening in the true-conjunction rule is a term I think is
a check for a minimum truth value.
; (load-from-path
"/home/rasberry/git/pln/opencog/pln/rules/propositional/fuzzy-conjunction-introduction.scm"
)
; (Member (DefinedSchema "fuzzy-conjunction-introduction-3ary-rule") rbs)
; NOTE: If I use this, the backward chainer returns only one result, as
expected.
(load-from-path
"/home/rasberry/git/pln/opencog/pln/rules/propositional/crisp-conjunction-introduction.scm"
)
(Member (DefinedSchema "true-conjunction-introduction-3ary-rule") rbs)
; NOTE: I extended the typelist in this file to include the IdenticalLink,
but it still doesnt set the proper truth value for the NotLink when
backward chaining.
(load-from-path
"/home/rasberry/git/pln/opencog/pln/rules/wip/negation-introduction.scm")
(Member (DefinedSchema "negation-introduction-rule") rbs)
(cog-logger-set-level! (cog-ure-logger) "debug")
(cog-logger-set-stdout! (cog-ure-logger) #t)
(define human (Concept "human"))
(define alice (Concept "alice"))
(define bob (Concept "bob"))
; NOTE: If I set this explicitly, I can see that the NotLink doesnt get the
proper (stv 1.0 1.0) assigned even if the chainer would figure that the two
are different, why cant it? cog-evaluate! is able to.
; (Identical (stv 0.0 1.0) alice bob)
(Inheritance (stv 1.0 1.0) alice human)
(Inheritance (stv 1.0 1.0) bob human)
(define variables (VariableList
(TypedVariable
(Variable "person1")
(Type "ConceptNode"))
(TypedVariable
(Variable "person2")
(Type "ConceptNode"))))
(define target (Not (Identical
(Variable "person1")
(Variable "person2") )))
; NOTE: This is non-groundable for some reason and thusly fails. Id expect
it to return a set of tuples that fullfill the query (Not (stv 1.0 1.0) (
Identical (stv 0.0 1.0) alice bob)). Why does it fail?
; (cog-bc rbs target #:vardecl variables)
; NOTE: This works fine and evaluates to (stv 1.0 1.0) as expected, with or
without the inclusion of the negation-introduction-rule.
; (cog-evaluate! target)
(define target (And (Not (Identical
(Variable "person1")
(Variable "person2") ))
(Inheritance (Variable "person1") human)
(Inheritance (Variable "person2") human)))
; NOTE: This returns very strange results including VariableNodes (Thus
violating the TypedVariable definition) for some reason. How can I get this
to only return grounded results? If I use the true-conjunction rule instead
it returns the expected output.
(cog-bc rbs target #:vardecl variables)
; this throws an "Either incorrect or not implemented yet." error. Why?
; (cog-evaluate! target)
Thank you so much!
Best regards,
Alex
--
You received this message because you are subscribed to the Google Groups
"opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/opencog/605d9bc0-21be-4b5d-af9b-315034e83562%40googlegroups.com.
inheritance+identity.scm
Description: Binary data
