AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

How can syllogisms be processed with AIML?
 
 

Is there any example of implementation of the syllogisms with AIML?
How are syllogisms handled by other frameworks?

 

 
  [ # 1 ]

steve really should be answering this but I’ll give it a try.

.b beginning tag
. end tag
bfirstop2 2nd digit
operationzxder1 1st digit is 1
I’m not sure if the spacing is correct on these aiml categories.

.btopic name=“SAYWHATYOUWANT”.
.bcategory..bpattern.WHAT IS * PLUS *.pattern.
.btemplate..brandom. .bli..bsrai..bexplode..bstar/..explode..srai..bsrai.a.bexplode..bstar index=“2”/..explode..srai..li..random..template.
.category..topic.


.btopic name=“SAYWHATYOUWANT”.
.bcategory..bpattern.AZX 1.pattern.
.btemplate..brandom..bli..bcondition name=“bfirstop2”.
      .bli value=“1”.2.li.
      .bli value=“2”.3.li.
      .bli value=“3”.4.li.
      .bli value=“4”.5.li.
      .bli value=“5”.6.li.
      .bli value=“6”.7.li.
      .bli value=“7”.8.li.
      .bli value=“8”.9.li.
      .bli value=“9”.carryleft1 0.li.
      .bli value=“0”.0.li.
     
     
  .condition.
  .li.  .random..template.
.category..topic.


.btopic name=“SAYWHATYOUWANT”.
.bcategory..bpattern.OPERATIONZXDER1.pattern.
.btemplate..brandom..bli..bcondition name=“afirstop”.
      .bli value=“1”.2.li.
      .bli value=“2”.3.li.
      .bli value=“3”.4.li.
      .bli value=“4”.5.li.
      .bli value=“5”.6.li.
      .bli value=“6”.7.li.
      .bli value=“7”.8.li.
      .bli value=“8”.9.li.
      .bli value=“9”.10.li.
      .bli value=“0”.1.li.
 
     
    .condition. .li.  .random..template.
.category..topic.

 

 

.btopic name=“SAYWHATYOUWANT”.
.bcategory..bpattern.A1 *.pattern.
.btemplate..brandom..bli..bthink..bset name=“afirstop”.1.set..think..li..random. .brandom..bli..bsrai.azx .bstar/..srai..li..random..template.
.category..topic.


.btopic name=“SAYWHATYOUWANT”.
.bcategory..bpattern.1 *.pattern.
.btemplate..brandom..bli..bsrai.operationzxder1.srai..bthink..bset name=“bfirstop2”..bstar/..set..think..li..random..template.
.category..topic.

the answer to the this particular problem in aiml is 11 plus 11 which equals 22

Im not sure how we apply it to a syllogism but lets say we have something like this

pattern if * then * then * pattern
      <star> then <star index=“3”>

however if you’re trying to evaluate the soundness of your premises then I don’t know what you would do. hopefully the way I made my calculator will help or maybe someone more experienced in aiml can help you.

you could also use a that tag for modus tollems but you were asking about syllogisms.

* then *
robot: how very interesting <think> <set name=“mt”><star index=“2”> <set name=“p”><star></think>
pattern it is not * pattern
<that>how very interesting<that>

I couldn’t quite get this working. I did use eval and conditions with my learn file but it’s a lot of work for me to get this working. there is an explanation for how to use eval and learn to compare predicates in this thread which I think you would need for modus tollems.

https://www.chatbots.org/ai_zone/viewthread/1497/

 

 
  [ # 2 ]

Thanks for the effort, but, excuse me, I find it difficult to understand your code and the logic with which this code could solve syllogisms like:
Socrates is a man.
A man is mortal.
Is Socrates a mortal?

 

 
  [ # 3 ]

From my experience, people who ask these sorts of things are doing so just to test the bot. Here is an example of how I do this in AIML:

<category>
    <
pattern>ALL HAVE *</pattern>
    <
template>
        <
think>
            <
set name="syll"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category

<
category>
<
pattern>_ IS A *</pattern>
<
that>INTERESTING INFORMATION</that>
<
template>So therefore <person/> has <get name="syll"/>.</template>
</
category

Human: All cats have whiskers
Bot: Interesting information
Human: Garfield is a cat
Bot: So therefore Garfield has whiskers

This can be amended for different phrases such as ALL * ARE *

 

 
  [ # 4 ]

To solve:

Socrates is a man.
A man is mortal.
Is Socrates a mortal?

You would write code to handle the following:

x = y
y = z
is x=z?

 

 
  [ # 5 ]

In fact I’m trying to understand how AIML works and how to integrate it into my software.
Thanks, now I can understand and read the code, or at least I think.
I understand that it is thanks to the “interesting information” pattern that the two categories are linked.
I wonder what happens if “interesting information” is present in other categories and if there would be some kind of overlap or conflict.

 

 
  [ # 6 ]

The “interesting information” part doesn’t necessarily need to be unique, as the 2nd category would only be triggered if the bot had said “interesting information” and the user had said, “x is a y” immediately afterwards.

However, to be 100% certain, you can change the “interesting information” to be something like, “Thanks for telling me.”, “That’s good to know” or something else unique.

 

 
  [ # 7 ]

Socrates is a man.
A man is mortal.
Is Socrates a mortal?

These aren’t written In any argument form. In Steve’s example it’s stated all cats have whiskers. It’s assumed from this that this is stated as an empirical fact. so youre linked to a that category that assumes you are going to talk about a cat.

all cats have whiskers.
this person is a cat.
this person has whiskers

the way you have written your premises the chatbot might not be able to guess the premises correctly

all men are mortal
socrates is a man
therefore socrates is mortal.

this is the same as the cat example so we know it works.

however I don’t know about the way you’ve written your premises.

Again there may be a way to do this for modus tollems and other logic concepts but I do think you need to have a way to check if predicates match to do logic in aiml. my point is the more features you can use in aiml the better for something as complicated as logic.

I guess I think socrates is a man is going to cause conflicts with other patterns, but maybe I’m wrong on that.


there is a way to fix this but this was written after you posted.

socrates is a man
all men are mortal
all men are mortal
<template><srai><think><set name=“logic”><input index=“2/></think></srai></template>
basically at this point you need to check if the last input typed was whether someone was a man then you can use that to show that socrates is mortal and you can do this without affecting normal sentences.

 

 
  [ # 8 ]
Steve Worswick - Sep 21, 2019:

The “interesting information” part doesn’t necessarily need to be unique, as the 2nd category would only be triggered if the bot had said “interesting information” and the user had said, “x is a y” immediately afterwards.

However, to be 100% certain, you can change the “interesting information” to be something like, “Thanks for telling me.”, “That’s good to know” or something else unique.

Yes, I understand that that pattern is important for linking the categories and making it more univocal puts you away from conflict.
I will try to write the code for classic syllogism if you have the patience to take a look ...
I understand that we need to capture the variables and then leave traces between the various categories so that we can preserve the logical chain.

<category>
    <
pattern>* IS A *</pattern>
    <
template>
        <
think>
            <
set name="syll1"><star index="1"/></set>
        </
think>
        <
think>
            <
set name="syll2"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category

...

 

 
  [ # 9 ]

“Socrates is a man” is so common that AIML has a standard response to this already. From my experience, people only ever use syllogisms to test the bot.

I always balance the amount of time it takes to code for a situation against how likely is it that someone else will trigger the input again.

 

 
  [ # 10 ]

Sure. I would be happy to look at your code. Your category for setting up x and y looks good but we can streamline it even further by missing out the extra think tags.

<category>
    <
pattern>* IS A *</pattern>
    <
template>
        <
think>
            <
set name="syll1"><star index="1"/></set>
            <
set name="syll2"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category
 

 
  [ # 11 ]

But now I need a category equal to that of before but with different variables: is it possible to do such a thing and how to differentiate equal categories but which carry variables with different names?

<category>
    <
pattern>* IS A *</pattern>
    <
template>
        <
think>
            <
set name="syll1"><star index="1"/></set>
            <
set name="syll2"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category

<
category>
    <
pattern>* IS A *</pattern>
    <
template>
        <
think>
            if <
star index="1"is equal to <"syll2">   PSEUDOCODE
            
<set name="syll3"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category

<
category>
    <
pattern>* IS A *</pattern>
    <
template>
        <
think>
            if <
star index="1"is equal to <"syll3">   PSEUDOCODE
            
<set name="syll4"><star index="2"/></set>
        </
think>
        
Interesting information.
    </
template>
</
category

 

 

 
  [ # 12 ]

If you put your AIML in code tags, it would be easier to read.

No, you can’t have 2 categories with the same pattern, as the bot wouldn’t know which one to trigger. Can you give an example of a conversation that you are trying to handle?

 

 
  [ # 13 ]

I would like to try to manage a long logical chain to which I can then respond.
For example:
The PILOT has a AIRPLANE.
An AIRPLANE can FLY.
If it can FLY it goes FAST.
If it is FAST it is UNBEATABLE.
Is the PILOT UNBEATABLE?

 

 
  [ # 14 ]

I think you are trying to run before you can walk. My advice would be to start small with just 1 or 2 inputs before trying something more advanced like that.

 

 
  [ # 15 ]

I just wanted to generalize the idea, that is, to make sure that the logical connections between the various categories are preserved, regardless of the length of the logical chain being treated.
I understand that at least before you have to know how to respond to situations like this:
The PILOT has a AIRPLANE.
An AIRPLANE can FLY.
Can PILOT FLY?

 

 1 2 > 
1 of 2
 
  login or register to react