Terms is a production system. With it, you define words, and use the words to produce sentences and rules, that you add to the knowledge base. Terms extracts consecuences from those sentences and rules, and adds them to the knowledge base. Then you query the knowledge base. The knowledge base resides in a RDBMS.
I think the systax of Terms is intuitive enough that that I can give some code examples without going into much detail.
Almost everything in Terms are words. Words have types, and those types are themselves words. Facts are made out of words, and are themselves words. Only rules (and definitions of words) are not words. You can use Python in the rules, but I won’t touch on that here.
This means that we only need first order variables (ranging over words) to cover all Terms constructs with the exception of rules. I will give an example of this.
To start with, we define a word she of type thing:
she is a thing.
Then we define 2 verbs (2 words of type verb), wants and gets:
wants is exists, what a word.
gets is exists, what a word.
With these words, we can make facts shuch as (wants she, what <some word>).
Let’s make some more words, so that she can want/get things:
a fruit is a thing.
this-banana is a fruit.
eats is exists, what a fruit.
Now we can make a fact such as (eats she, what this-banana).
Now we introduce a rule that expresses that she always gets what she wants:
(wants she, what Word1)
->
(gets she, what Word1).
Now, if we say that she wants this banana:
(wants she, what this-banana).
We obtain that she gets it:
(gets she, what this-banana)?
true
And also if she wants a verb, or a noun, or a number, or a fact...:
(wants she, what fruit).
(gets she, what fruit)?
true
(wants she, what eats).
(gets she, what eats)?
true
(wants she, what number).
(gets she, what number)?
true
(gets she, what 42)?
false
(wants she, what 42).
(gets she, what 42)?
true
(wants she, what (eats she, what this-banana)).
(gets she, what (eats she, what this-banana))?
true
Then you can do something like:
(gets she, what (Exists1))
->
(Exists1).
To obtain that:
(eats she, what this-banana).
I don’t think that you can do that easily in other logic systems. Am I wrong?
No comments:
Post a Comment