Hmm. Indeed, two of the variations seem buggy. Part of the problem is that
the patterns you wrote are ill-formed, and the pattern engine is trying to
guess what you meant, and is guessing incorrectly. This "trying to guess
what you meant" is a kind-of historical design accident.

What I think you meant was  `(And (Present (Variable "someone")) (...other
constraints...))`   but since there is no explicit ` (Present (Variable
"someone"))` while the other constraints are negative constraints, the
engine (sometimes) implicitly assumes that `(Present (Variable "someone"))`
was desired.

The pattern engine is a satisifiability solver, not a classical-logic
engine. It has no built-in "law of the excluded middle"; it uses
intuitionist logic only.

When you have only negative constraints, then the engine implicitly adds
one positive constraint:  `(Present (Variable "someone"))` which is
satsified by the entire universe --- it invokes a search over the entire
universe, and applies the negative constraints to weed  down the results.
Very CPU and RAM-intensive.

By contrast Absent is a positive constraint: there is no search done at all
(no wastage of CPU/RAM); the constraint is applied to whatever is given.
But since you had no other positive constraints, the range is over the
empty set. So the result is the empty set.

The two variants: `(NotLink (PresentLink  ...) )` and (NotLink (AndLink
(PresentLink ...))) seem broken, Can you open a bug report for that?

-- Linas






On Tue, May 19, 2020 at 10:18 AM Alexander Gabriel <[email protected]> wrote:

> Hi guys,
> I'm somewhat confused regarding the results of this experiment. Am I doing
> something wrong or are there bugs responsible for the results?
>
> It seems to me like (NotLink (PresentLink ..)) doesn't produce the correct
> results,
> (NotLink (AndLink (PresentLink ...))) produces the same results. (AndLink
> (NotLink (PresentLink)) doesn't produce any results and neither does
> (AbsentLink ...).
>
> I hope you can help me understand this.
>
>
> Best regards and stay safe in these corona times,
>
> Alex
>
>
> The output:
> hungry people
> expected: (SetLink (ConceptNode "me"))
> (SetLink (ConceptNode "me"))
>
> not hungry people (NotLink (PresentLink  ...) )
> expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
> (SetLink (ConceptNode "you") (ConceptNode "hungry") (ConceptNode "me"))
>
> not hungry people (AndLink (NotLink (PresentLink ...)))
> expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
> (SetLink)
>
> not hungry people (NotLink (AndLink (PresentLink ...)))
> expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
> (SetLink (ConceptNode "you") (ConceptNode "hungry") (ConceptNode "me"))
>
> not hungry people (AbsentLink  ...)
> expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
> (SetLink)
>
>
>
> The code (also attached):
>     atomspace = AtomSpace()
>     initialize_opencog(atomspace)
>     me = ConceptNode("me")
>     you = ConceptNode("you")
>     hungry = ConceptNode("hungry")
>
>     StateLink(me, hungry)
>
>
>
>     query = GetLink(
>                 TypedVariableLink(VariableNode("someone"),
> TypeNode("ConceptNode")),
>                 PresentLink(StateLink(VariableNode("someone"), hungry)))
>
>     who_is_hungry = execute_atom(atomspace, query)
>     print("\nhungry people")
>     print('expected: (SetLink (ConceptNode "me"))')
>     print(who_is_hungry)
>
>     query1 = GetLink(
>                 TypedVariableLink(VariableNode("someone"),
> TypeNode("ConceptNode")),
>                 NotLink(PresentLink(StateLink(VariableNode("someone"),
> hungry))))
>
>     who_isnt_hungry1 = execute_atom(atomspace, query1)
>     print("\nnot hungry people (NotLink (PresentLink  ...) )")
>     print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
>     print(who_isnt_hungry1)
>
>     query2 = GetLink(
>                 TypedVariableLink(VariableNode("someone"),
> TypeNode("ConceptNode")),
>
> AndLink(NotLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
>
>     who_isnt_hungry2 = execute_atom(atomspace, query2)
>     print("\nnot hungry people (AndLink (NotLink (PresentLink ...)))")
>     print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
>     print(who_isnt_hungry2)
>
>     query3 = GetLink(
>                 TypedVariableLink(VariableNode("someone"),
> TypeNode("ConceptNode")),
>
> NotLink(AndLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
>
>     who_isnt_hungry3 = execute_atom(atomspace, query3)
>     print("\nnot hungry people (NotLink (AndLink (PresentLink ...)))")
>     print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
>     print(who_isnt_hungry3)
>
>     query4 = GetLink(
>                 TypedVariableLink(VariableNode("someone"),
> TypeNode("ConceptNode")),
>                 AbsentLink(StateLink(VariableNode("someone"), hungry)))
>
>     who_isnt_hungry4 = execute_atom(atomspace, query4)
>     print("\nnot hungry people (AbsentLink  ...)")
>     print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
>     print(who_isnt_hungry4)
>
>
> --
> 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/8120ee46-6bf0-4b11-a72b-24e072acd218%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/8120ee46-6bf0-4b11-a72b-24e072acd218%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/CAHrUA34aBY5JaogUUY0F%2BKyn-Pv6m2Z1jYoJstaC2eGx5pdSoA%40mail.gmail.com.

Reply via email to