Logic with accounts, users and points

231 views
Skip to first unread message

Johannes Castner

unread,
Dec 10, 2018, 11:48:11 AM12/10/18
to opencog
I'm trying to develop a system with users who have accounts with points in them ...how do I associate a user concept and particular instantiations of users with accounts which have a NumberNode in them which is denoted in "points"?
I have this so far:

(define User (ConceptNode "User" (stv 0.01 1)))
(define account (PredicateNode "account"))
(define Animal (ConceptNode "Animal" (stv 0.1 1)))
(define alive (PredicateNode "alive" (stv 0.01 1))) ; something is alive
(define user_animal (InheritanceLink User Animal (stv 1 1))) ; all users are animals; defined by us (no market needed)
(define animal_alive (EvaluationLink alive (ListLink Animal) (stv 0.9 1))) ; most animals we will encounter are alive
;(define create-account (QuantityLink (ConceptNode "points") (NumberNode 100000)))

; all users have an account
(EvaluationLink
    account
    (ListLink
        User
    )
)


How do I say that an account has points in it, that  can be updated and that a user has that account etc?  I'm sorry, I'm still rather new to Atomese and I've been trying to figure this out but I'm seriously stuck. Please help!

Linas Vepstas

unread,
Dec 10, 2018, 9:15:58 PM12/10/18
to opencog
Hi Johannes,
Let me try to answer by supplying some non-answers. So, first atomese
is sort-of meant to be a low-level-language that humans would not
ordinarily write, but rather that other programs and algos would read,
write and transform. That said, its OK to do what you're doing. No
problem there.

Next, atomese is meant to be free-form: you don't have to declare a
structure (or a "class") before using it. You can just dump in data,
in some arbitrary form, and then later search through it. So, for
your example, you might say something like this:

(EvaluationLink
(PredicateNode "has an account")
(ListLink (ConceptNode "Joe")))

(EvaluationLink
(PredicateNode "has some points")
(ListLink (ConceptNode "Joe") (NumberNode 23)))

(Inheritance (ConceptNode "Joe") (ConceptNode "animal"))

and lets say you want to find all users $X that are animals and have 23 points:

(GetLink
(AndLink
(EvaluationLink (Predicate "has an account") (ListLink
(Variable "$X")))
(EvaluationLink (PredicateNode "has some points")
(ListLink (Variable "$X") (NumberNode 23)))
(Inheritance (VariableNode "$X") (ConceptNode "animal"))))

so if you run (cog-execute! (GetLink ...)) you should get back
(SetLink (ConceptNode "Joe"))

You can try creating Alice who has 24 points, and Bob who is not an
animal, in which case the Get should still return only Joe.

These examples are all written in scheme. And I think the above is
fairly easy to understand. But if you want to create big, complex
programs, and you are learning scheme for the first time, then you
might find this hard to do. ... learning a language for the first
time, and also writing a big project in it .. is not a recipe for good
code. ... and so you might want to use python, instead, if the goal
is to build an app, quick..

I kind of dread suggesting python ... in the long run, learning scheme
is "better for you", it opens your mind to functional programming, and
a whole different way of thinking about software, and about
objects/object-oriented -programming, and about data, and what it
means for something to be "data", etc. So its good for you. But if
you're in a hurry to just write an app .. use python. The
examples/python directory has some examples.

BTW, the create-account would be a function:

(define (create-an-account the-users-name initial-points)
(EvaluationLink (Predicate "has an account") (ListLink
(Concept the-users-name)))
(EvaluationLink (PredicateNode "has some points")
(ListLink (Concept the-users-name) (NumberNode
initial-points)))
(Inheritance (Concept the-users-name) (ConceptNode "animal")))

and you'd call you function like this:

(create-an-account "Alice" 24)

Also, by the way, to change to point total, you'd have to either
delete the old point total, or use StateLink. If you don't delete the
old point total, you'll just have same person, with several different
amounts of points.

--linas



--
cassette tapes - analog TV - film cameras - you

Nil Geisweiller

unread,
Dec 11, 2018, 2:28:45 AM12/11/18
to ope...@googlegroups.com
Hi Johannes,

On 12/10/18 6:48 PM, Johannes Castner wrote:
> ; all users have an account
> (EvaluationLink
> account
> (ListLink
> User
> )
> )

note that you don't need to wrap the argument with a ListLink if
there's only one, you might write

(EvaluationLink
account
User)

> How do I say that an account has points in it, that can be updated and

Depends on what you mean "has points in it". `account` is a predicate
so it indeed can have stuff in it by using `EvaluationLink` as you did
with `User`, which says `User` is in `account`. If `account` where a
concept, then you could equivalently (or isomorphically equivalently)
write

(MemberLink
User
account)

> that a user has that account etc? I'm sorry, I'm still rather new to
> Atomese and I've been trying to figure this out but I'm seriously stuck.
> Please help!

It's not clear to me what you want to express. If you write it in FOL
we'll definitely be able to translate it to Atomese.

Nil

Nil Geisweiller

unread,
Dec 11, 2018, 2:41:25 AM12/11/18
to ope...@googlegroups.com
On 12/11/18 4:15 AM, Linas Vepstas wrote:
> code. ... and so you might want to use python, instead, if the goal
> is to build an app, quick..

You may also use Haskell.

(Personal note: Python is evil, like a charming psychopath. Its weak
type system combined with its by-reference semantics is a recipe for
disaster, all that hidden behind a sweet syntax, blargh).

Nil

Johannes Castner

unread,
Dec 11, 2018, 4:55:47 AM12/11/18
to opencog
Well, thank you very much for your andwers, they’re very helpful indeed! How does a StateLink work? In other words, how do you update a NumberNode? Once I understand this logic, I should be well on my way to get my basic program done so I can demonstrate it. All the other things I’m trying to do have illustrative examples in the PLN part of the GitHub page.

I’ve been coding in Scala for some time and I’m quite used to functional programming and in fact I love it and while Python is the language I’ve written the most code in, I’d very much prefer something functional. So Scheme shouldn’t be an issue for me. Whenever I have a bit of time I’m also working through the excellent Structure and Interpretation book; it’s really wonderful. Again, thank you for your help!

Nil Geisweiller

unread,
Dec 11, 2018, 5:20:43 AM12/11/18
to ope...@googlegroups.com, Johannes Castner
On 12/11/18 11:55 AM, Johannes Castner wrote:
> How does a StateLink work?

https://wiki.opencog.org/w/StateLink

For more info on atom types see

https://wiki.opencog.org/w/Category:Atom_Types

> In other words, how do you update a NumberNode?

NumberNode is immutable, as are all atoms. What could be seen as
mutable is how they relate to each other within an atomspace.

Values on the other hand are mutable.

Nil

Johannes Castner

unread,
Dec 11, 2018, 7:09:35 AM12/11/18
to opencog


On Tuesday, December 11, 2018 at 9:55:47 AM UTC, Johannes Castner wrote:
Well, thank you very much for your answers, they’re very helpful indeed!   How does a StateLink work?  In other words, how do you update a NumberNode?  Once I understand this logic, I should be well on my way to get my basic program done so I can demonstrate it.  All the other things I’m trying to do have illustrative examples in the PLN part of the GitHub page.

Johannes Castner

unread,
Dec 11, 2018, 7:13:36 AM12/11/18
to opencog
Hi Nil,

What I'm trying to say is a user has an account and an account has points in it that can change--just as with any computer game, really.  Does that make sense?

Johannes

Nil Geisweiller

unread,
Dec 11, 2018, 8:12:22 AM12/11/18
to ope...@googlegroups.com
On 12/11/18 2:13 PM, Johannes Castner wrote:
> What I'm trying to say is a user has an account and an account has
> points in it that can change--just as with any computer game, really.
> Does that make sense?

There are different ways to do that, and they depend on what you
intend to do with the knowledge. One way would be to use value

https://wiki.opencog.org/w/Value

for instance to attach a score of 3 to John, you'd say

```
(define john (Concept "John"))
(define score (Concept "score"))
(cog-set-value! john score (Number 3))
```

then you may ask John's score with
```
(cog-value john score)
```
which will return 3.

Later on you may update John's score with
```
(cog-set-value! john score (Number 4))
```

And
```
(cog-value john score)
```
which will return 4.

The problem with that (and with mutability in general) is that you
lose information. So for instance you won't be able to use reasoning
or specialized forms thereof like pattern mining to analyze the
evolution of your data. For that you need to keep track of these
updates. One way could be to use AtTimeLink, so for instance you way
write that at 10pm John had a score of 3

AtTimeLink
Evaluation
Predicate "score-of"
List
(Concept "John")
(Number 3)
TimeNode "10pm"

but at 11pm he had a score of 4

AtTimeLink
Evaluation
Predicate "score-of"
List
(Concept "John")
(Number 4)
TimeNode "10pm"

Etc... There are many ways to represent knowledge.

Johannes Castner

unread,
Dec 11, 2018, 8:40:02 AM12/11/18
to opencog
Thank you Nil; that is really awesome; I love that TimeLink version; could you just tell me how to query that (how do I find out what Joe's points were at 10PM?) and also one more thing: is there a way to say *now* and it recognizing the current time and attaching that rather than some given constant like 10PM?  I'll be able to do a lot with that version, I think.

Johannes

Johannes Castner

unread,
Dec 11, 2018, 9:14:56 AM12/11/18
to opencog
Hi Nil,

Actually, I figured out the "now" part:

(AtTimeLink
                (EvaluationLink
                                      (PredicateNode "score-of")
                                       (ListLink (ConceptNode "John") (NumberNode 8))
                                       (TimeNode (current-time)))
)

I still need to figure out how to query previous scores and in particular the last score that was assigned to John.


On Tuesday, December 11, 2018 at 1:12:22 PM UTC, Nil wrote:

Johannes Castner

unread,
Dec 11, 2018, 11:02:39 AM12/11/18
to opencog
So I have the following now:

(define User (ConceptNode "User" (stv 0.01 1)))
(define Animal (ConceptNode "Animal" (stv 0.1 1)))
(define alive (PredicateNode "alive" (stv 0.01 1))) ; something is alive
(define user_animal (InheritanceLink User Animal (stv 1 1))) ; all users are animals
(define animal_alive (EvaluationLink alive (ListLink Animal) (stv 0.9 1))) ; most animals we will encounter are alive

(define (name first last) (string-append first " " last))
; all users have an account with scores
(define (make-user f l)
        (define usr (ConceptNode (name f l)))
        (InheritanceLink usr User (stv 1 1))

        (AtTimeLink
                (EvaluationLink
                        (PredicateNode "score-of")
                        (ListLink
                                usr
                                (NumberNode "100000")
                        )
                        (TimeNode (current-time))
                )
        )
)

Does this make sense?  To update scores, I still need to be able to fetch the old score and then add or subtract things from it or multiply or divide the old score by some new number and then add it at the new time point.

On Tuesday, December 11, 2018 at 1:12:22 PM UTC, Nil wrote:

Nil Geisweiller

unread,
Dec 11, 2018, 11:22:38 AM12/11/18
to ope...@googlegroups.com
Hi Johannes,

On 12/11/18 4:14 PM, Johannes Castner wrote:
> Hi Nil,
>
> Actually, I figured out the "now" part:
>
> (AtTimeLink
>    (EvaluationLink
>        (PredicateNode "score-of")
>        (ListLink (ConceptNode "John")
> (NumberNode 8))
>   (TimeNode (current-time)))
> )

So you know, the TimeNode should be indented at the same level than the
EvaluationLink.

> I still need to figure out how to query previous scores and in
> particular the last score that was assigned to John.

There's a time server, but I haven't had a look at this for a while
(like years), I don't know what it can and cannot do.

Linas? Any update on temporal querying?

Nil

>
>
> On Tuesday, December 11, 2018 at 1:12:22 PM UTC, Nil wrote:
>
> On 12/11/18 2:13 PM, Johannes Castner wrote:
> > What I'm trying to say is a user has an account and an account has
> > points in it that can change--just as with any computer game,
> really.
> > Does that make sense?
>
> There are different ways to do that, and they depend on what you
> intend to do with the knowledge. One way would be to use value
>
> https://wiki.opencog.org/w/Value <https://wiki.opencog.org/w/Value>
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/b7c124f1-95cf-4a18-a893-069383c9922f%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/b7c124f1-95cf-4a18-a893-069383c9922f%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Linas Vepstas

unread,
Dec 11, 2018, 12:43:26 PM12/11/18
to opencog
On Tue, Dec 11, 2018 at 6:13 AM Johannes Castner <jac...@gmail.com> wrote:
>
> What I'm trying to say is a user has an account and an account has points in it that can change--just as with any computer game, really. Does that make sense?
>

OK, so here's something to ponder during system design. Atoms are
meant to represent graphs, which can be walked, searched,
compared-by-shape, modified. So if you can think of your data as
graphs, atoms are your thing.

But if our data is time-varying -- rapidly varying even, and you don't
care about the above, then use values. Every atom has, attached to it,
a key-value database. If you know the atom, and you know the key, you
can find the value; update it, change it to your heart's content.
What you cannot do is search for it (except by exhaustive
brute-force.) -- if you don't know the atom or the key, you won't
(easily) find it.

So, if you ever need to search for everyone who's score is 23, then
use a NumberNode. But if you never want to do that, use a Value.
Values are an order of magnitude faster than Atoms, thinner,
lighter-weight, etc.

TruthValues are a special case of values.

Linas.

Linas Vepstas

unread,
Dec 11, 2018, 12:55:40 PM12/11/18
to opencog
On Tue, Dec 11, 2018 at 10:22 AM 'Nil Geisweiller' via opencog
<ope...@googlegroups.com> wrote:
>
> There's a time server, but I haven't had a look at this for a while
> (like years), I don't know what it can and cannot do.

I assume it doesn't work, but I don't know. Maybe it's easy to revive.
My general impression is that the TimeNode, AtTimeLink concepts are
"version 0.3" -- they are an OK first try for representing time, but
no one has built anything fancy, large, sophisticated with them, so we
don't know how usable they are, or if there is some better way of
doing things. This is unexplored territory.

> Linas? Any update on temporal querying?

Misgana is going to have the basic octomap server working and merged
"any day now". It stores time and location as values on an atom, so
that you can ask "where in space/time is this atom?" When he finishes
this (there's really only a few more hours/days worth of work) then
work will commence on step two: preposition predicates: "before",
"after", near, far, left-of, right-of, above, behind, big, small,
on-top-of, etc. We have not yet scratched the surface on those.

--linas

Johannes Castner

unread,
Dec 11, 2018, 1:37:32 PM12/11/18
to opencog
Hi Linas and Nil,

What I’d like to do is just find the last value; I won’t know what the value is so searching for a number isn’t what I need but rather I need to search for a user (by name or ID) and then get her current score and subtract or add something to it, according to some user behavior. Ideally I’d have a function update_score(user, number), which gets the last score and then adds or subtracts or multiplied or divides that score by the supplied number. Does that make sense?

Max Tom

unread,
Dec 11, 2018, 7:28:27 PM12/11/18
to opencog
Hello

Nil Geisweiller

unread,
Dec 12, 2018, 12:49:36 AM12/12/18
to ope...@googlegroups.com, Linas Vepstas
On 12/11/18 7:55 PM, Linas Vepstas wrote:
> Misgana is going to have the basic octomap server working and merged
> "any day now". It stores time and location as values on an atom, so
> that you can ask "where in space/time is this atom?" When he finishes
> this (there's really only a few more hours/days worth of work) then
> work will commence on step two: preposition predicates: "before",
> "after", near, far, left-of, right-of, above, behind, big, small,
> on-top-of, etc. We have not yet scratched the surface on those.

Sounds great, so I suppose we'll have virtual links like BeforeLink,
NearLink, BigLink, etc, right?

Nil

Nil Geisweiller

unread,
Dec 12, 2018, 12:49:47 AM12/12/18
to ope...@googlegroups.com
On 12/11/18 8:37 PM, Johannes Castner wrote:
> What I’d like to do is just find the last value; I won’t know what the value is so searching for a number isn’t what I need but rather I need to search for a user (by name or ID) and then get her current score and subtract or add something to it, according to some user behavior. Ideally I’d have a function update_score(user, number), which gets the last score and then adds or subtracts or multiplied or divides that score by the supplied number. Does that make sense?

If all you need is the last value then, for now, I would recommend to
attach a Value (cog-set-value!, etc) to your user id, as I initially
presented.

Nil

Johannes Castner

unread,
Dec 12, 2018, 3:19:53 AM12/12/18
to opencog
Yes, for now I’ll definitely do that; in the longer run it would benefit me for sure if I could also somehow have a timeseries of score values, sorted in a decreasing order by age and if I could sort users by current or past period score wealth etc. I’ll stick a pin in this thought for a later day. I’ll definitely be interested in the time and space profiles, once those features are out!

Johannes Castner

unread,
Dec 12, 2018, 5:59:12 AM12/12/18
to opencog
I want to thank you for your help; without it I'd really be stuck right now!  Maybe I can contribute an example to the example folder once I have my module completed.  I'm trying to turn human game players into Mind Agents of sorts.  Working on hacking something workable for a minimum viable product for a service I'm trying to provide as a commercial application of OpenCog ...right now something very hacky and minimal will suffice to work as something from which to get first customers and then some investment so that then I have some resources to contribute as much as possible to OpenCog and to bend its capabilities a bit in the direction of my interest: Collective General Intelligence.  Does that make sense?  I'd greatly value your perspective!  

Johannes

Nil Geisweiller

unread,
Dec 13, 2018, 12:58:31 AM12/13/18
to ope...@googlegroups.com
On 12/12/18 12:59 PM, Johannes Castner wrote:
> I want to thank you for your help; without it I'd really be stuck right
> now!  Maybe I can contribute an example to the example folder once I
> have my module completed.

Yes, that is very welcome.

> Mind Agents of sorts.  Working on hacking something workable for a
> minimum viable product for a service I'm trying to provide as a
> commercial application of OpenCog ...right now something very hacky and
> minimal will suffice to work as something from which to get first
> customers and then some investment so that then I have some resources to
> contribute as much as possible to OpenCog and to bend its capabilities a
> bit in the direction of my interest: Collective General Intelligence.
> Does that make sense?  I'd greatly value your perspective!

That's a great goal. By Collective General Intelligence you mean
something like Distributed General Intelligence? Sounds a bit like what
SingularityNET is trying to achieve.

Nil

>
> Johannes
>
> On Wednesday, December 12, 2018 at 5:49:47 AM UTC, Nil wrote:
>
> On 12/11/18 8:37 PM, Johannes Castner wrote:
> > What I’d like to do is just find the last value; I won’t know
> what the value is so searching for a number isn’t what I need but
> rather I need to search for a user (by name or ID) and then get her
> current score and subtract or add something to it, according to some
> user behavior. Ideally I’d have a function update_score(user,
> number), which gets the last score and then adds or subtracts or
> multiplied or divides that score by the supplied number.  Does that
> make sense?
>
> If all you need is the last value then, for now, I would recommend to
> attach a Value (cog-set-value!, etc) to your user id, as I initially
> presented.
>
> Nil
>
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/c01e0e4b-d02f-4ab3-bb04-f64755335992%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/c01e0e4b-d02f-4ab3-bb04-f64755335992%40googlegroups.com?utm_medium=email&utm_source=footer>.

Linas Vepstas

unread,
Dec 13, 2018, 2:18:46 AM12/13/18
to Nil Geisweiller, opencog
Maybe. That's a possibility. Have not yet thought about it much. So
let me blather a bit.

Clearly, NearLink, BigLink is superior to (GPN "scm:is-near") and (GPN
"scm-is-big")
because one could write down some reasoning rules "if looks-small and far-away
then maybe its big" ... but this would be a chore. You could
hand-write a few, but
then it gets buggy and complex. Ideally, want to learn these, somehow.

Ideally, this could be done in some "extensible" way, without defining
new atom types.
So that I don't have to have atom types just to add a new preposition.

So maybe use GPN's, but then "hide" them behind "well-known"
DefinedPredicateNodes.
Since they're defined, they could be used for reasoning. I dunno. I
still don't really
know how to do reasoning ...

Ben asked me to think about this a few months ago, I'm trying to clear
my backlog
of unfinished tasks, but haven't gotten far yet.

-- Linas

Johannes Castner

unread,
Dec 13, 2018, 3:18:58 AM12/13/18
to opencog
Hi Nil,

Thank you for your response! Well, if I understand SingularityNet correctly it has a bit of a different goal, namely for people to contribute their AI algorithms for more synergy in artificial cognition.  What we are trying to do is to elicit logical beliefs from people directly and with the help of technology (inferences etc) to let them collectively decide what are the right relationships, attention-values and truth-values via something similar but more general than prediction markets; markets and democratic institutions with emergent collective general intelligence.  As far as I understand MindAgents, we're essentially trying to have humans take the role of MindAgents for decision making and understanding systems.  Essentially, I think that there hasn't been nearly enough innovation and work to improve markets and democracy.  Markets are not just aggregating beliefs, they are also giving more power to those who have fewer economic constraints and democracy currently has no incentives for people to vote for those things that they belief will serve the whole collective but rather the incentives are to care only about one's own narrowly defined groups.  Also, I'm thinking that if the singularity were to have humans in the loop and we could all work effectively together to solve complex problems then it would be more human friendly as well?   In other words, while jobs as we know them are being automated we could be creative and solve problems together instead of working bagging groceries.  I believe instinctively that we all have something to contribute when it comes to solving complex decision problems and I intent to test my instincts and then prove these ideas to others.  Is that making sense to you?

Johannes 

Johannes Castner

unread,
Dec 13, 2018, 4:35:10 AM12/13/18
to opencog
This is really cool; for my purposes, I could use something a bit different with respect to distances; think about an application of rescuing people from the ruins of a hurricane and having to think how fast one can get to the right location, given its distance and the damages to infrastructure etc.  and who should take the call etc. ...situations where a collective of thinkers has to estimate distances and times to work through problems.  I guess embodiment isn't a problem when there's humans--who are already embodied--in the loop. Our first application will actually be time estimates for products and projects related to IT;how long will it take me to have my MVP working, how long will it then take me to fix a particular bug etc.  ...maybe our star programmer gets sick because of a flue that is going around in the area where she lives and maybe it spreads from a neighborhood close to her at some rate r and thus will affect her with probability p at time T etc. 

Nil Geisweiller

unread,
Dec 13, 2018, 5:37:32 AM12/13/18
to ope...@googlegroups.com
On 12/13/18 10:18 AM, Johannes Castner wrote:
> cognition.  What we are trying to do is to elicit logical beliefs from
> people directly and with the help of technology (inferences etc) to let
> them collectively decide what are the right relationships,
> attention-values and truth-values via something similar but more general
> than prediction markets; markets and democratic institutions with
> emergent collective general intelligence.  As far as I understand
> MindAgents, we're essentially trying to have humans take the role of
> MindAgents for decision making and understanding systems.  Essentially,
> I think that there hasn't been nearly enough innovation and work to
> improve markets and democracy.  Markets are not just aggregating
> beliefs, they are also giving more power to those who have fewer
> economic constraints and democracy currently has no incentives for
> people to vote for those things that they belief will serve the whole
> collective but rather the incentives are to care only about one's own
> narrowly defined groups.  Also, I'm thinking that if the singularity
> were to have humans in the loop and we could all work effectively
> together to solve complex problems then it would be more human friendly
> as well?   In other words, while jobs as we know them are being
> automated we could be creative and solve problems together instead of
> working bagging groceries.  I believe instinctively that we all have
> something to contribute when it comes to solving complex decision
> problems and I intent to test my instincts and then prove these ideas to
> others.  Is that making sense to you?

Sounds awesome, makes total sense to me.

I can vaguely recall seeing a platform to aggregate people's believes to
help predict stuff, but I forgot the name. So what you describe sounds
like something like that combined with some AI synergy.

Nil
> > an email to opencog+u...@googlegroups.com <javascript:>
> > <mailto:opencog+u...@googlegroups.com <javascript:>>.
> > To post to this group, send email to ope...@googlegroups.com
> <javascript:>
> > <mailto:ope...@googlegroups.com <javascript:>>.
> <https://groups.google.com/group/opencog>.
> <https://groups.google.com/d/msgid/opencog/c01e0e4b-d02f-4ab3-bb04-f64755335992%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/optout>.
>
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/47c88db9-2c42-4697-853c-6959c84d8f7b%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/47c88db9-2c42-4697-853c-6959c84d8f7b%40googlegroups.com?utm_medium=email&utm_source=footer>.

Johannes Castner

unread,
Dec 13, 2018, 5:54:01 AM12/13/18
to opencog
Yes, well there are many prediction market platforms out there, like PredictIt and Gnosis etc. but all of them just have events and the collective is estimating the probability that each of these events is taking on each of N outcomes; who will get elected the next  president of the United States, will there be an earthquake of a certain magnitude in California this year ...etc.  but non of them allow for various forms of probabilistic arguments and synergy between them.  Also few allow even for connected events with conditional probabilities; some do.   In any case, I think that one thing that makes opencog so special in Artificial Intelligence is the flexibility of expressing arguments; I'm trying to accomplish the same for collectives of humans interacting with machine intelligence to create probabilistic structures of connected beliefs of various logical kinds; allowing them to form intricate belief systems that act in synergy; the machine should then be able to help with inference.  In other words, people should be able to decide the axioms of what is true and why and with what probabilities, as well as the ethics of the system and the attention that should be paid to various parts of the system etc. and the machine can then run inferences about what else these statements jointly imply and the importance of these implications to those things that the humans in the system deem to be important.     

On Thursday, December 13, 2018 at 10:37:32 AM UTC, Nil wrote:
On 12/13/18 10:18 AM, Johannes Castner wrote:
> cognition.  What we are trying to do is to elicit logical beliefs from tr

Nil Geisweiller

unread,
Dec 13, 2018, 6:00:25 AM12/13/18
to opencog
On 12/13/18 9:18 AM, Linas Vepstas wrote:
> So maybe use GPN's, but then "hide" them behind "well-known"
> DefinedPredicateNodes.
> Since they're defined, they could be used for reasoning. I dunno. I
> still don't really
> know how to do reasoning ...

In principle reasoning can be performed on anything, even
GroundedPredicateNodes. All you need is to "axiomatize" them, for
instance if you want to say that `near` is symmetric you'd write

ImplicationScope (stv 1 1)
VariableList
Variable "$X"
Variable "$Y"
Evaluation
GroundedPredicate "near"
List
Variable "$X"
Variable "$Y"
Evaluation
GroundedPredicate "near"
List
Variable "$Y"
Variable "$X"

or if you already have higher knowledge about symmetry, maybe you'd
just write

Member (stv 1 1)
GroundedPredicate "near"
Concept "symmetric"

In practice I don't know how well the URE would chew on
GroundedPredicate though, as they have a special meaning to the
pattern matcher, as virtual clauses. Would need to try and fix what
needs to be fixed, quote what needs to be quoted, etc. Alexey and his
team have already stumbled on that kind of problems when trying to
incorporate neural nets to the URE.

Nil

Johannes Castner

unread,
Dec 13, 2018, 11:08:41 AM12/13/18
to opencog
Hi Nil,

I have a question about predicates and truth values:  How is it said in PLN that if predicate p has (stv 0.6 1) then Not p should obviously have (stv 0.4 1) right ...if it is true that being fast has certain probability 0.6 then not being fast should automatically be assigned certain probability 0.4 right?  Or am I wrong?

Johannes

Nil Geisweiller

unread,
Dec 14, 2018, 1:59:41 AM12/14/18
to ope...@googlegroups.com
Hi Johannes,

On 12/13/18 6:08 PM, Johannes Castner wrote:
> I have a question about predicates and truth values: How is it said in
> PLN that if predicate p has (stv 0.6 1) then Not p should obviously have
> (stv 0.4 1) right ...if it is true that being fast has certain
> probability 0.6 then not being fast should automatically be assigned
> certain probability 0.4 right? Or am I wrong?

Correct.

See

https://github.com/opencog/opencog/blob/master/opencog/pln/rules/wip/negation-introduction.scm

Soon you'll be able to use pln by loading the pln module in say scheme

```
(use-modules (opencog pln))
```

and choose amongst some predefined rule sets.

It's not there yet however, the Not rule would not be loaded for
instance, the best is to configure your rule base yourself. See
https://wiki.opencog.org/w/URE_Configuration_Format for more
information (it's a bit outdated but still mostly relevant). See also
examples

https://github.com/opencog/atomspace/tree/master/examples/rule-engine
https://github.com/opencog/opencog/tree/master/examples/pln

Nil
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/217bfe32-13e2-4bc8-9b6d-8973350e0877%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/217bfe32-13e2-4bc8-9b6d-8973350e0877%40googlegroups.com?utm_medium=email&utm_source=footer>.

Johannes Castner

unread,
Dec 14, 2018, 6:22:20 AM12/14/18
to opencog
Thank you, Nil, so this is really the folder that holds all of the PLN rules? https://github.com/opencog/opencog/tree/master/opencog/pln/rules/wip

Can I just load them all separately?

Johannes

Johannes Castner

unread,
Dec 14, 2018, 10:49:22 AM12/14/18
to opencog
Hi Nil,

How is the negation-introduction-rule invoked? 

I'm doing the following:

(define p (PredicateNode "p" (stv 0.6 0.8)))

(negation-introduction-rule p)

and then I'm getting this error:

ERROR: Wrong type to apply: (BindLink
   (TypedVariableLink
      (VariableNode "$X")
      (TypeChoice
         (TypeNode "EvaluationLink")
         (TypeNode "InheritanceLink")
         (TypeNode "PredicateNode")
         (TypeNode "ConceptNode")
      )
   )
   (AndLink
      (VariableNode "$X")
      (EvaluationLink
         (GroundedPredicateNode "scm: gt-zero-confidence")
         (VariableNode "$X")
      )
   )
   (ExecutionOutputLink
      (GroundedSchemaNode "scm: negation-introduction-formula")
      (ListLink
         (NotLink
            (VariableNode "$X")
         )
         (VariableNode "$X")
      )
   )
)


On Friday, December 14, 2018 at 6:59:41 AM UTC, Nil wrote:

Nil Geisweiller

unread,
Dec 17, 2018, 12:50:39 AM12/17/18
to ope...@googlegroups.com
Hi Johannes,

On 12/14/18 1:22 PM, Johannes Castner wrote:
> Thank you, Nil, so this is really the folder that holds all of the PLN
> rules? https://github.com/opencog/opencog/tree/master/opencog/pln/rules/wip

All rules/* directories, not just rules/wip. You may want to take a look
at rules/README.md

>
> Can I just load them all separately?

You can, note however that most of the rules under rules/wip are
work-in-progress, often only compatible with the forward chainer, not
the backward chainer.

Nil

>
> Johannes
>
> On Friday, December 14, 2018 at 6:59:41 AM UTC, Nil wrote:
>
> Hi Johannes,
>
> On 12/13/18 6:08 PM, Johannes Castner wrote:
> > I have a question about predicates and truth values:  How is it
> said in
> > PLN that if predicate p has (stv 0.6 1) then Not p should
> obviously have
> > (stv 0.4 1) right ...if it is true that being fast has certain
> > probability 0.6 then not being fast should automatically be assigned
> > certain probability 0.4 right?  Or am I wrong?
>
> Correct.
>
> See
>
> https://github.com/opencog/opencog/blob/master/opencog/pln/rules/wip/negation-introduction.scm
> <https://github.com/opencog/opencog/blob/master/opencog/pln/rules/wip/negation-introduction.scm>
>
>
> Soon you'll be able to use pln by loading the pln module in say scheme
>
> ```
> (use-modules (opencog pln))
> ```
>
> and choose amongst some predefined rule sets.
>
> It's not there yet however, the Not rule would not be loaded for
> instance, the best is to configure your rule base yourself. See
> https://wiki.opencog.org/w/URE_Configuration_Format
> <https://wiki.opencog.org/w/URE_Configuration_Format> for more
> information (it's a bit outdated but still mostly relevant). See also
> examples
>
> https://github.com/opencog/atomspace/tree/master/examples/rule-engine <https://github.com/opencog/atomspace/tree/master/examples/rule-engine>
>
> https://github.com/opencog/opencog/tree/master/examples/pln
> > an email to opencog+u...@googlegroups.com <javascript:>
> > <mailto:opencog+u...@googlegroups.com <javascript:>>.
> > To post to this group, send email to ope...@googlegroups.com
> <javascript:>
> > <mailto:ope...@googlegroups.com <javascript:>>.
> <https://groups.google.com/group/opencog>.
> <https://groups.google.com/d/msgid/opencog/217bfe32-13e2-4bc8-9b6d-8973350e0877%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/optout>.
>
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/9b1ee198-49f3-411d-b4dc-b6a61421b493%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/9b1ee198-49f3-411d-b4dc-b6a61421b493%40googlegroups.com?utm_medium=email&utm_source=footer>.

Nil Geisweiller

unread,
Dec 17, 2018, 1:01:19 AM12/17/18
to ope...@googlegroups.com
On 12/14/18 5:49 PM, Johannes Castner wrote:
> How is the negation-introduction-rule invoked?
>
> I'm doing the following:
>
> (define p (PredicateNode "p" (stv 0.6 0.8)))
>
> (negation-introduction-rule p)

A rule, in its given form cannot be applied on a given source (or
target), rather it is applied over the entire atomspace (or possibly its
attentional). Thus

(cog-execute! negation-introduction-rule)

The following methods

https://github.com/opencog/atomspace/blob/master/opencog/rule-engine/Rule.h#L230-L266

can be used to unify a rule with a given source or target and thus
restrict its applying to that given source or target, however it hasn't
been exposed to scheme yet.

Nil
> https://github.com/opencog/atomspace/tree/master/examples/rule-engine <https://github.com/opencog/atomspace/tree/master/examples/rule-engine>
>
> https://github.com/opencog/opencog/tree/master/examples/pln
> > an email to opencog+u...@googlegroups.com <javascript:>
> > <mailto:opencog+u...@googlegroups.com <javascript:>>.
> > To post to this group, send email to ope...@googlegroups.com
> <javascript:>
> > <mailto:ope...@googlegroups.com <javascript:>>.
> <https://groups.google.com/group/opencog>.
> <https://groups.google.com/d/msgid/opencog/217bfe32-13e2-4bc8-9b6d-8973350e0877%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/optout>.
>
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/a43ca4cd-12e0-4b30-b4bb-9b9924da46e4%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/a43ca4cd-12e0-4b30-b4bb-9b9924da46e4%40googlegroups.com?utm_medium=email&utm_source=footer>.

Johannes Castner

unread,
Dec 17, 2018, 5:54:14 AM12/17/18
to opencog
Hi Nil,

Now I'm getting the following error.  I type:

(define P (PredicateNode "p" (stv 0.3 1))

(cog-execute! negation-introduction-rule)

And I get this error:

[2018-12-17 10:50:42:031] [ERROR] Backtrace:
           7 (opencog-extension cog-execute! (#))
           6 (apply-smob/1 #<catch-closure 15faba0>)
           5 (apply-smob/1 #<catch-closure 15fab20>)
In ice-9/eval.scm:
   191:27  4 (_ #f)
   223:20  3 (proc #<directory (guile-user) 112f140>)
In unknown file:
           2 (%resolve-variable (7 . r2l-check-name) #<directory (guile-user) 112f140>)
In ice-9/boot-9.scm:
   751:25  1 (dispatch-exception 0 unbound-variable (#f "Unbound variable: ~S" (r2l-check-name) #f))
In unknown file:
           0 (apply-smob/1 #<catch-closure 15faae0> unbound-variable #f "Unbound variable: ~S" (r2l-check-name) #f)

ERROR: In procedure apply-smob/1:
Unbound variable: r2l-check-name
ABORT: unbound-variable
 (/tmp/atomspace-master/opencog/guile/SchemeEval.cc:1068)
    Stack Trace:
    2: Logger.cc:512      opencog::Logger::logva(opencog::Logger::Level, char const*, __va_list_tag*)
    3: Logger.cc:524      opencog::Logger::Error::operator()(char const*, ...)
    4: exceptions.cc:55      opencog::StandardException::parse_error_message(char const*, __va_list_tag*, bool)
    5: exceptions.cc:82      opencog::StandardException::parse_error_message(char const*, char const*, __va_list_tag*, bool)
    6: exceptions.cc:142      opencog::RuntimeException::RuntimeException(char const*, char const*, ...)
    7: SchemeEval.cc:1068      opencog::SchemeEval::apply_v(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opencog::Handle)
    8: SchemeEval.h:185      opencog::SchemeEval::apply_tv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, opencog::Handle)
    9: shared_ptr_base.h:658      std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()
    10: DefaultPatternMatchCB.cc:528      opencog::DefaultPatternMatchCB::clause_match(opencog::Handle const&, opencog::Handle const&, std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&)
    11: PatternMatchEngine.cc:1582      opencog::PatternMatchEngine::clause_accept(opencog::Handle const&, opencog::Handle const&)
    12: PatternMatchEngine.cc:1517      opencog::PatternMatchEngine::do_term_up(std::shared_ptr<opencog::PatternTerm> const&, opencog::Handle const&, opencog::Handle const&)
    13: PatternMatchEngine.cc:1397      opencog::PatternMatchEngine::explore_single_branch(std::shared_ptr<opencog::PatternTerm> const&, opencog::Handle const&, opencog::Handle const&)
    14: PatternMatchEngine.cc:1327      opencog::PatternMatchEngine::explore_choice_branches(std::shared_ptr<opencog::PatternTerm> const&, opencog::Handle const&, opencog::Handle const&)
    15: PatternMatchEngine.cc:1298      opencog::PatternMatchEngine::explore_link_branches(std::shared_ptr<opencog::PatternTerm> const&, opencog::Handle const&, opencog::Handle const&)
    16: PatternMatchEngine.cc:1169      opencog::PatternMatchEngine::explore_term_branches(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    17: PatternMatchEngine.cc:2078      opencog::PatternMatchEngine::explore_clause(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    18: InitiateSearchCB.cc:830      opencog::InitiateSearchCB::variable_search(opencog::PatternMatchEngine*)
    19: PatternMatch.cc:358      opencog::PatternLink::satisfy(opencog::PatternMatchCallback&) const
    20: PatternMatch.cc:339      opencog::BindLink::imply(opencog::PatternMatchCallback&, opencog::AtomSpace*, bool)
    21: Implicator.cc:102      opencog::do_imply(opencog::AtomSpace*, opencog::Handle const&, opencog::Implicator&, bool)
    22: DefaultImplicator.h:35      opencog::DefaultImplicator::~DefaultImplicator()
    23: Satisfier.cc:182      opencog::satisfying_set(opencog::AtomSpace*, opencog::Handle const&, unsigned long)
    24: Instantiator.cc:476      opencog::Instantiator::walk_tree(opencog::Handle const&, bool)
    25: Instantiator.cc:637      opencog::Instantiator::instantiate(opencog::Handle const&, std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&, bool)
    26: stl_tree.h:858      std::_Rb_tree<opencog::Handle, std::pair<opencog::Handle const, opencog::Handle>, std::_Select1st<std::pair<opencog::Handle const, opencog::Handle> >, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > >::~_Rb_tree()
    27: SchemeModule.cc:69      opencog::FunctionWrap::as_wrapper_v_h(opencog::Handle)
    28: shared_ptr_base.h:658      std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count()
    29: SchemePrimitive.cc:162      opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*)
    30: vm-engine.c:787    vm_debug_engine()
    31: vm.c:1258    scm_call_n()
    32: eval.c:664    scm_primitive_eval()
    33: eval.c:696    scm_eval()
    34: script.c:454    scm_shell()
    35: init.c:342    invoke_main_func()
    36: continuations.c:422    c_body()
    37: vm-engine.c:787    vm_regular_engine()
    38: vm.c:1258    scm_call_n()
    39: throw.c:139    catch()
    40: continuations.c:367    scm_i_with_continuation_barrier()
    41: continuations.c:461    scm_c_with_continuation_barrier()
    42: threads.c:664    with_guile()
    43: misc.c:1968    GC_call_with_stack_base()
    44: threads.c:711    scm_with_guile()
    45: init.c:328    scm_boot_guile()
    46: guile.c:103    main()
    47: libc-start.c:325    __libc_start_main()
    48: [0x400a09] ??() ??:0

ERROR: In procedure opencog-extension:
Throw to key `C++-EXCEPTION' with args `("cog-execute!" "Backtrace:\n           7 (opencog-extension cog-execute! (#))\n           6 (apply-smob/1 #<catch-closure 15faba0>)\n           5 (apply-smob/1 #<catch-closure 15fab20>)\nIn ice-9/eval.scm:\n   191:27  4 (_ #f)\n   223:20  3 (proc #<directory (guile-user) 112f140>)\nIn unknown file:\n           2 (%resolve-variable (7 . r2l-check-name) #<directory (guile-user) 112f140>)\nIn ice-9/boot-9.scm:\n   751:25  1 (dispatch-exception 0 unbound-variable (#f \"Unbound variable: ~S\" (r2l-check-name) #f))\nIn unknown file:\n           0 (apply-smob/1 #<catch-closure 15faae0> unbound-variable #f \"Unbound variable: ~S\" (r2l-check-name) #f)\n\nERROR: In procedure apply-smob/1:\nUnbound variable: r2l-check-name\nABORT: unbound-variable\n (/tmp/atomspace-master/opencog/guile/SchemeEval.cc:1068)\nFunction args:\n((BindLink\n   (TypedVariableLink\n      (VariableNode \"$X\")\n      (TypeChoice\n         (TypeNode \"EvaluationLink\")\n         (TypeNode \"InheritanceLink\")\n         (TypeNode \"PredicateNode\")\n         (TypeNode \"ConceptNode\")\n      )\n   )\n   (AndLink\n      (VariableNode \"$X\")\n      (EvaluationLink\n         (GroundedPredicateNode \"scm: gt-zero-confidence\")\n         (VariableNode \"$X\")\n      )\n   )\n   (ExecutionOutputLink\n      (GroundedSchemaNode \"scm: negation-introduction-formula\")\n      (ListLink\n         (NotLink\n            (VariableNode \"$X\")\n         )\n         (VariableNode \"$X\")\n      )\n   )\n)\n)")'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.

I'm I missing some modules?

Nil Geisweiller

unread,
Dec 17, 2018, 6:54:21 AM12/17/18
to ope...@googlegroups.com
On 12/17/18 12:54 PM, Johannes Castner wrote:
> (cog-execute! negation-introduction-rule)
>
> And I get this error:
>
> [2018-12-17 10:50:42:031] [ERROR] Backtrace:
>            7 (opencog-extension cog-execute! (#))
>            6 (apply-smob/1 #<catch-closure 15faba0>)
>            5 (apply-smob/1 #<catch-closure 15fab20>)
> In ice-9/eval.scm:
>    191:27  4 (_ #f)
>    223:20  3 (proc #<directory (guile-user) 112f140>)
> In unknown file:
>            2 (%resolve-variable (7 . r2l-check-name) #<directory
> (guile-user) 112f140>)
> In ice-9/boot-9.scm:
>    751:25  1 (dispatch-exception 0 unbound-variable (#f "Unbound
> variable: ~S" (r2l-check-name) #f))
> In unknown file:
>            0 (apply-smob/1 #<catch-closure 15faae0> unbound-variable #f
> "Unbound variable: ~S" (r2l-check-name) #f)

I'm not getting this error.

There's been a lot of structural changes lately, you probably need to
pull the last change of cogutil, atomspace and opencog, recompile and
install.

Maybe you'll need to clean your system as well, with

sudo trash /usr/local/include/opencog
sudo trash /usr/local/share/opencog
sudo trash /usr/local/lib/opencog
sudo trash /usr/share/guile/site/2.2/opencog*
sudo trash /usr/local/share/guile/site/2.2/opencog*
trash ~/.cache/guile

(replace trash by rm if your a responsible admin, unlike me).

Nil

Johannes Castner

unread,
Dec 17, 2018, 9:02:44 AM12/17/18
to opencog
Thank you, will do!

Linas Vepstas

unread,
Dec 17, 2018, 3:25:25 PM12/17/18
to opencog
On Mon, Dec 17, 2018 at 4:54 AM Johannes Castner <jac...@gmail.com> wrote:
>

> ERROR: In procedure apply-smob/1:
> Unbound variable: r2l-check-name
> ABORT: unbound-variable

That's insane; r2l is relex2logic and should not ever show up in pln code.

--linas

Nil Geisweiller

unread,
Dec 18, 2018, 12:53:52 AM12/18/18
to ope...@googlegroups.com
That's probably because the former pln module included r2l, that's been
fixed since then.

Nil

Johannes Castner

unread,
Dec 18, 2018, 4:30:10 AM12/18/18
to opencog
Hi Nil, what repo are you working with? If I clone that, it’ll also be easier for me to contribute at least some examples, for now... maybe later something more significant.

Nil Geisweiller

unread,
Dec 18, 2018, 10:06:35 AM12/18/18
to ope...@googlegroups.com
Hi,

On 12/18/18 11:30 AM, Johannes Castner wrote:
> Hi Nil, what repo are you working with? If I clone that, it’ll also be easier for me to contribute at least some examples, for now... maybe later something more significant.

I'm guessing that you wonder whether you should use opencog or singnet.
A bunch of work it taking place on singnet but opencog is the upstream
repo. Personally I'm doing my best to keep opencog always up-to-date so
as far as PLN is concerned I would recommend that you use opencog, thus

https://github.com/opencog/cogutil
https://github.com/opencog/atomspace
https://github.com/opencog/opencog

Nil

Johannes Castner

unread,
Dec 18, 2018, 10:33:11 AM12/18/18
to opencog
Thank you!

Johannes

Johannes Castner

unread,
Dec 27, 2018, 1:57:27 PM12/27/18
to opencog
Hi Nil,

Is there a way to get the value from a NumberNode?  In other words, can I get the 4 out of (NumberNode 4)?  I need to do some other, quite general intermediate calculations and then produce another NumberNode; how do I best do that?

Johannes

There are different ways to do that, and they depend on what you
intend to do with the knowledge. One way would be to use value

https://wiki.opencog.org/w/Value

for instance to attach a score of 3 to John, you'd say

```
(define john (Concept "John"))
(define score (Concept "score"))
(cog-set-value! john score (Number 3))
```

then you may ask John's score with
```
(cog-value john score)
```
which will return 3.

Later on you may update John's score with
```
(cog-set-value! john score (Number 4))
```

And
```
(cog-value john score)
```
which will return 4.

The problem with that (and with mutability in general) is that you
lose information. So for instance you won't be able to use reasoning
or specialized forms thereof like pattern mining to analyze the
evolution of your data. For that you need to keep track of these
updates. One way could be to use AtTimeLink, so for instance you way
write that at 10pm John had a score of 3

AtTimeLink
   Evaluation
     Predicate "score-of"
     List
       (Concept "John")
       (Number 3)
   TimeNode "10pm"

but at 11pm he had a score of 4

AtTimeLink
   Evaluation
     Predicate "score-of"
     List
       (Concept "John")
       (Number 4)
   TimeNode "10pm"

Etc... There are many ways to represent knowledge.

amebel@hr

unread,
Dec 28, 2018, 12:00:25 AM12/28/18
to opencog
Hi Johannes,

(cog-number (Number 3))

Amen B.

Johannes Castner

unread,
Dec 28, 2018, 3:39:23 AM12/28/18
to opencog
Thank you very much, Amen!

Johannes

Johannes Castner

unread,
Jan 9, 2019, 11:18:40 AM1/9/19
to opencog
Hi Nil,

So here is the logic now that I'm using thus far for my project.  I'm using to files, one Scheme file to express most of the logic and one Python file because I find that Python is easier to use for communication with a soon to emerge JavaScript front-end.

Also, I find Python easier to allow for undetermined number of entities in one statement and also an undetermined number of sub-statements.  Ultimately, I want users to be able to make arbitrary statements on the front-end that then follow this sort of logic in which truth values are determined in a variant of a prediction market mechanism as in that Scheme file.


And here's a Python wrapper with a bit of extra logic added as well: https://github.com/CollectiWise/collectiwise/blob/master/python/wrapper.py

Now to my question:

I'm trying to generalize this logic so that a person on the frontend can make any sort of statement that is permissible in opencog.  I'm starting with general statements that have one simple truth value (for now I'm setting the secondary parameter always to 1 but that can be easily relaxed).  Next, I need to be able to make statements of the following kind, as an example:

There's five people:
john =Concept john
mike =Concept mike
judy=Concept judy
anne=Concept Anne
george= Concept george

One of them will win some contest: Concept contest

Winner is:
george will-win (stv 0.1 1)
mike will win (stv 0.2 1)
john will win (stv 0.2 1)
judy will win (stv 0.1 1)
anne will win (stv 0.3 1)
george will win (stv 1-p(all-the-other-ones) 1)

How do I insure that there's a statement, like will win and 5 outcomes, the probabilities of which always add to 1, such that if one probability changes all others will automatically adjust?

Also, do you think that there's a simpler way than the way that I have started to code for users to be able to make general statements with probabilities determined in a type of market? 

I know that these are a lot of questions and I apologize ahead of time!

Thank you!

Johannes



On Tuesday, December 11, 2018 at 7:28:45 AM UTC, Nil wrote:
Hi Johannes,

On 12/10/18 6:48 PM, Johannes Castner wrote:
> ; all users have an account
> (EvaluationLink
>      account
>      (ListLink
>          User
>      )
> )

note that you don't need to wrap the argument with a ListLink if
there's only one, you might write

(EvaluationLink
      account
      User)

> How do I say that an account has points in it, that  can be updated and

Depends on what you mean "has points in it". `account` is a predicate
so it indeed can have stuff in it by using `EvaluationLink` as you did
with `User`, which says `User` is in `account`. If `account` where a
concept, then you could equivalently (or isomorphically equivalently)
write

(MemberLink
     User
     account)

> that a user has that account etc?  I'm sorry, I'm still rather new to
> Atomese and I've been trying to figure this out but I'm seriously stuck.
> Please help!

It's not clear to me what you want to express. If you write it in FOL
we'll definitely be able to translate it to Atomese.

Nil

Nil Geisweiller

unread,
Jan 10, 2019, 8:31:58 AM1/10/19
to ope...@googlegroups.com
Hi Johannes,

On 1/9/19 6:18 PM, Johannes Castner wrote:
> with general statements that have one simple truth value (for now I'm
> setting the secondary parameter always to 1 but that can be easily

PLN rules as currently implemented do not support well confidence
anyway. It is a work in progress. Basically dealing with second order
probabilities, as opposed to relying on crude heuristics, is costly to
compute and nontrivial to implement. But we're getting there, for
instance the URE control policy explicitly deals with second order
distributions, not PLN yet.

> There's five people:
> john =Concept john
> mike =Concept mike
> judy=Concept judy
> anne=Concept Anne
> george= Concept george
>
> One of them will win some contest: Concept contest
>
> Winner is:
> george will-win (stv 0.1 1)
> mike will win (stv 0.2 1)
> john will win (stv 0.2 1)
> judy will win (stv 0.1 1)
> anne will win (stv 0.3 1)
> george will win (stv 1-p(all-the-other-ones) 1)

you've repeated george, I suppose you meant

anne will win (stv 1-others 1)

>
> How do I insure that there's a statement, like will win and 5 outcomes,
> the probabilities of which always add to 1, such that if one probability
> changes all others will automatically adjust?

PLN doesn't offer that out-of-the-box. Roman Treutlein is working on a
generalization of Truth Value that will make it possible to manipulate
second order distribution over any domain, not just [0,1]. Till it's
ready you need to represent that as atoms in the atomspace.

So for instance you could represent each probability of winning of
each candidate (except anne)

Inheritance <0.1 1>
Concept "win"
Concept "george"
...
Inheritance <0.1 1>
Concept "win"
Concept "judy"

Then that candidates are disjoint.

And <0 1>
Concept "george"
Concept "mike"
...
And <0 1>
Concept "judy"
Concept "anne"

Then that all candidates are subsets of win.

Inheritance <1 1>
Or
Concept "george"
...
Concept "anne"
Concept "win"

then I suppose, though I haven't tried, PLN could infer that

Inheritance <0.4 1>
Concept "win"
Concept "anne"

If you want to be general, you could axiomatize the notion of
partition and then, to be efficient, write a rule especially for it.

> Also, do you think that there's a simpler way than the way that I have
> started to code for users to be able to make general statements with
> probabilities determined in a type of market?

It's hard to tell, there are many ways to represent things. To really
help I would need to carefully read your example.

Quick remark,

two-are-fast

seems ill-formed, LambdaLink only takes 1 or 2 outgoings, the first
one for the variable declaration, the second for the pattern (if used
in the context of the pattern matcher) or function (if directly
evaluated), however in your example it takes 3. I suppose you mean
BindLink, not LambdaLink.

> I know that these are a lot of questions and I apologize ahead of time!

Happy to help. If you can break down your example, or shrink to a
minimal size, yet still capturing the essence of what you want to
express, it would help.

Nil
> --
> 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 opencog+u...@googlegroups.com
> <mailto:opencog+u...@googlegroups.com>.
> To post to this group, send email to ope...@googlegroups.com
> <mailto:ope...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/opencog.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/opencog/5459cd60-4a1f-4c4e-9079-d6608b5b032f%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/5459cd60-4a1f-4c4e-9079-d6608b5b032f%40googlegroups.com?utm_medium=email&utm_source=footer>.

Linas Vepstas

unread,
Jan 10, 2019, 2:09:30 PM1/10/19
to opencog
I'm sort of afraid that what I write below may torpedo a good effort,
but ... I think its important and might lead to a better design.

Yesterday, I was reminded of grakn.ai -- it is a "graph knowledge
base" and its very clean and well-designed. It is a very nice model of
what (parts of) our own Atomese (should) look like. I am guessing
that if Johannes tries to re-write, re-design his system in grakn.ai,
it will make it a lot more clear as to what he is trying to do. It
will also make it quite clear how opencog has many more tools and
systems than grakn.ai does. Doing this exercise, even with pencil and
paper, will make for a better system, and will make clear what the
correct design should be.

So -- here: look at this: There are five short examples here:
https://grakn.ai/grakn-core They are:

Panel 1 is labeled ER "Entity-Relationship" and these are just like
our EvaluationLink/PredicateNode idea.

Panel 2 is "Types", which is like our type system (the "deep types" part)

Panel 3 is called "Rules" and its almost identical to our BindLink

Panel 4 is called "Inference" and it is almost identical to running our GetLink

Panel 5 is called "Analytics" and we don't do that.

If you can recast your project in terms of grakn, it will make clear
exactly how to do it with atomese. If you cannot, it will also make
clear why opencog can do things that grakn cannot (and/or make clear
other things ...)

-- Linas
> To unsubscribe from this group and stop receiving emails from it, send an email to opencog+u...@googlegroups.com.
> To post to this group, send email to ope...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/747038b4-66eb-b7d8-df78-177b7a7fd4eb%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.



Johannes Castner

unread,
Jan 14, 2019, 2:15:09 PM1/14/19
to opencog
Hi Linas ,

Thank you, it looks very interesting, but is it probabilistic? And the other question is that if yes, it’s probabilistic (allowing for something like PLNs) then would it allow for those probabilities to be determined by some sort of interaction between people? The main reason why I was drawn to opencog because it seemed as though one could generalize the idea of prediction markets using opencog and now I’m quite sure that this is possible (because it’s mostly there) and that this could lead to something like generalized collective intelligence. However if you think that this same probabilistic (prediction markets like) behavior is easy to implement in Grakn I’d definitely give it a spin.

Johannes

Linas Vepstas

unread,
Jan 14, 2019, 9:46:51 PM1/14/19
to opencog
No it has nothing at all to do with probability. It has to do with knowledge representation. -- linas

--
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 opencog+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.

For more options, visit https://groups.google.com/d/optout.

Johannes Castner

unread,
Jan 15, 2019, 6:50:42 AM1/15/19
to opencog
Well I definitely need something that allows for belief presentation, in the form of every day world reasoning—something that allows for the general expression of uncertain logic and that has reasoning capabilities, like PLN. I’m working on essentially working with Robin Hanson’s scoring rules from experimental economics to form the TruthValue on each logical statement. I’ve already made it work for the most part. There’s some types of beliefs that I’m still not sure as to how to make work but I’ve already gotten pretty far. For an MVP we basically have enough expressive power; we are working on a frontend and once we have that I’d love to demonstrate it to you, if you’re interested? At that point we’ll have a bunch of questions. We should hopefully be able to contribute to opencog as well—at least with examples.

Johannes

Nil Geisweiller

unread,
Jan 15, 2019, 10:32:56 AM1/15/19
to ope...@googlegroups.com
On 1/15/19 1:50 PM, Johannes Castner wrote:
> Well I definitely need something that allows for belief presentation, in the form of every day world reasoning—something that allows for the general expression of uncertain logic and that has reasoning capabilities, like PLN. I’m working on

Yep, OpenCog has really been made for that. Just want to re-emphasize
that it is a work in progress (especially PLN), to not create
disappointment later on.

BTW, so you know, although I haven't started implementing
surprinsingness, I'm back working on the pattern miner, and it's the
very next thing on my list.

> expressive power; we are working on a frontend and once we have that I’d love to demonstrate it to you, if you’re interested?

You bet we are. ;-)

Nil

Johannes Castner

unread,
Jan 15, 2019, 11:32:05 AM1/15/19
to opencog
“Just want to re-emphasize
that it is a work in progress (especially PLN), to not create
disappointment later on.”

We are very much aware of that. Our immediate goal is to hack together a platform where people can interact, make and react to probabilistic statements to estimate project completion times and potential events that could have impacts on those etc. if we have something basic working, (an MVP) we can serve two software firms I know as beta users and then get some investment and feedback etc. we also want to contact Nate Silver as we want to have a system where people can make rigorous statements for politics and economics, that make some predictions that can be tested over time. At that point, hopefully we’ll get some investment and then we can hire some geniuses to help us do much more. We’re hoping to essentially be in a position soon, where we can help you accomplish your goals as well, pull up our sleeves and get into the mud of it.

Johannes

Nil Geisweiller

unread,
Jan 16, 2019, 2:20:33 AM1/16/19
to ope...@googlegroups.com
:+1:

Nil
Reply all
Reply to author
Forward
0 new messages