Hi Alex,
You might need @Nil Geisweiller <[email protected]> to give you the full,
complete reply, as I'm just not that good with the URE. But I think I can
help clarify a few issues.
I didn't test, but I think that maybe your bug goes away if you make the
target into this:
(And (Present (Variable "person1")) (Present (Variable "person2"))
(Not (Indentical (Variable "person1") (Variable "person2"))))
which basically says: "the variable 'person1' must be grounded by something
that is present in the current atomspace at this moment in time. ... and
also person2, and the groundings are not by the same atom" .
I call this a bug because the pattern matcher should have implicitly
assumed this, without you having to explicitly say "present". I'll see if I
can fix this bug "real soon now".
The other one, the throw on (cog-evaluate! target), that's an interesting
one. So, if you read the error message very carefully, it is saying that
it does not know how to evaluate (Inheritance (Variable "person1")
(ConceptNode "human")) ... which makes sense, because how would you
evaluate that, anyway? I find it interesting because we could "fix" this
in an interesting manner: if cog-evaluate! gets something that has (free)
variables in it, it should implicitly assume a SatsifactionLink. For your
example, this works: (cog-evaluate! (Satisfaction target)) -- that is,
there does exist in the atomspace at least one grounding for the variables
such that all clauses are satisfied.
I'm pondering whether or not making this kind of implicit-satisfaction is a
good idea or not. It's certanly .. an interesting thought.
--linas
On Wed, Feb 26, 2020 at 4:48 AM Alexander Gabriel <[email protected]> wrote:
> 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
> <https://groups.google.com/d/msgid/opencog/605d9bc0-21be-4b5d-af9b-315034e83562%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
cassette tapes - analog TV - film cameras - you
--
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/CAHrUA35htFKhjLR2DUf%3D%3DO9q2EJm8w7%2BE714mi8gaC_eUbpZng%40mail.gmail.com.