dupa

Author Topic: Deductive reasoning abilility and schedule update  (Read 7247 times)

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Deductive reasoning abilility and schedule update
« on: October 04, 2003, 01:59:34 pm »
Based on an idea from Don Ferguson I've made a deductive reasoning function for Hal. It works as follows:

User:  If Molly weighs 400 pounds, then Molly is overweight.
Ultra Hal: I understand the implication.
User:  If Molly is overweight, then Molly's health is in danger.
Ultra Hal:  I see the relationship.
User:  Molly weighs 400 pounds.
Ultra Hal:  Molly's health is in danger.

I've attached the updated Hal 5.0 script to this message. After learning a file called deductive.brn is created in the defbrain folder which will contain Hal's new knowledge. If anyone would like to teach Hal some universally accepted knowledge based on If-Then statements and submit them here I would include a default deductive.brn in the final release as a starting point for Hal's deductive abilities.

The updated script also includes some changes made by Don to Hal's WordNet functions (see the "what a coincidence I own a..." post by lostboyer) to add variety to its responses.

Some changes have been made to Hal's DLL to prevent certain off the wall responses by the WordNet functions, but this will be included in the final release. I believe I got the most common annoyances of the WordNet routine (eg. user saying "Whats up?" or "Whats new?" or using the word "can") If anyone would like to submit parts of conversations including other WordNet annoyances I could try to make sure they don't occur in the final release.

The final release is scheduled to be out on October 20. Most of the bugs mentioned on this forum have been fixed and a few minor features have been added.


Download Attachment: hal5b.uhp
145.59 KB
Robert Medeksza

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Deductive reasoning abilility and schedule update
« Reply #1 on: October 04, 2003, 05:00:34 pm »
Hello everyone,

I sent Robert Medeksza a private e-mail congratulating him on Hal's new deductive reasoning capabilities!  His code is very efficient and the ability that it adds to Hal is absolutely amazing!

After downloading and selecting the new alternate brain, try typing some of the following statements to Hal:

If a dog barks in the night, then it is disturbed about something.

A dog barks in the night around here. [This can get a ONE STEP if-then deductive reasoning response from Hal.]

If a well ran dry, then the water table dropped.

If the water table dropped, then many wells may run dry.

A well ran dry not far from here. [This can get a TWO STEP if-then deductive reasoning response from Hal.]

If it rains hard, then the roads get slick.

If the roads get slick, then drivers need to slow down.

If drivers need to slow down, then traffic moves more slowly.

It rains hard around here often. [This can get a THREE STEP if-then deductive reasoning response from Hal.]

It's great to be able to own an artificial intelligence program that has all the features of Ultra Hal.  And NOW it's an artificial intelligence program that can correctly learn if-then deductive reasoning relationships, and automatically string them together in multiple steps!  Fantastic!

Congratulations again to Robert Medeksza, and congratulations and thanks to all of you, the contributing programmers and users!

Thank you,

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Deductive reasoning abilility and schedule update
« Reply #2 on: October 04, 2003, 08:04:49 pm »
Interesting stuff! Thanks... BTW - It was easy to copy and paste the improvements into my modified brains.

What other improvements do you have in store for us?
 

lostbowyer

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Deductive reasoning abilility and schedule update
« Reply #3 on: October 04, 2003, 08:33:14 pm »
The deductive reasoning is a very nice addition, thanks! I'll see what happens with the "what a coincidence" responses.

Glenn
 

onthecuttingedge2005

  • Guest
Deductive reasoning abilility and schedule update
« Reply #4 on: October 05, 2003, 03:06:09 am »
Could somebody upload the deductive.brn to this forum, I need it for
the deductive reasoning script.
thanks.
Jerry.

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Deductive reasoning abilility and schedule update
« Reply #5 on: October 05, 2003, 03:06:44 pm »
quote:
Originally posted by onthecuttingedge2005

Could somebody upload the deductive.brn to this forum, I need it for
the deductive reasoning script.
thanks.
Jerry.



Jerry, as you 'teach' hal, the deductive.brn is created. He don't start out knowing anything...
 

onthecuttingedge2005

  • Guest
Deductive reasoning abilility and schedule update
« Reply #6 on: October 05, 2003, 03:55:07 pm »
Hi larry.
I know that's the case now but I'm not running the 5.0 yet so I can't
run the scipt, I wanted to see a deductive.brn to look inside to see
how the script was formatting it internally and to see If I could make
a deductive script that would work in the 4.5 brain.
Best of wishes and grand new discoveries.
Jerry.

Larry

  • Sr. Member
  • ****
  • Posts: 266
    • View Profile
Deductive reasoning abilility and schedule update
« Reply #7 on: October 05, 2003, 06:24:20 pm »
This is what is inside:

"IT RAINS HARD","THE ROADS GET SLICK"
"THE ROADS GET SLICK","DRIVERS NEED TO SLOW DOWN"
"DRIVERS NEED TO SLOW DOWN","TRAFFIC MOVES SLOWLY"
"TRAFFIC MOVES SLOWLY","ROAD RAGE HAPPENS MORE OFTEN"

I say : If it rains hard then the roads get slick.
I forget what Hal says to that.

I say : It rains hard around here often.
Hal says : Road Rage happens more often.

I say : The roads get slick when it rains.
Hal says : Road rage happens more often.

I say : Drivers need to slow down when it rains.
Hal says : Road rage happens more often.

So... I'm not sure what I think about it... or how to use it... Perhaps Don can give me some examples of it could be of benifit... or how to best us it.

 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Deductive reasoning abilility and schedule update
« Reply #8 on: October 06, 2003, 12:12:47 am »
Hi,

One type of "trick question" often used to show the lack of knowledge of chatterbots, is to ask something like, "If I drop a glass of water, what happens?"  The point of the exercise is supposedly to show that chatterbots have no common sense and no reasoning ability.

Hal's new deductive reasoning routine is to give Hal the ability to remember logical connections between facts and events that take the form, "If A is true, then B is true," or "If A happens, then B happens."

However, it was a feasible enhancement to also let Hal remember "chains" of logical factual connections and events as follows:

Given: If A is true, then B is true.

Given: If B is true, then C is true.

Given: A is true.  

Therefore C is true!

This routine is NOT supposed to replace any of Hal's other abilities.  However, it certainly enhances Hals intelligence for him to be able to remember and understand things like this:

If the sun has just risen, then it is morning.
If there are no clouds, then the sky is clear.
If I drop a glass of water, then it will fall.
If I eat a big meal, then I will feel full.
If it is December 25th, then it is Christmas.
If my electric bill is overdue, then they might turn out the lights.
If I wash my car, then my car will look better.
If I exercise, then I will be more fit.
If I paint the door, then it will look nice.
If interest rates go down, then the economy is stimulated.
If an isotope reaches its half-life, then it is half as radioactive.
If ink spills, then it is hard to clean up.
If I pull a cat's tail, then the cat will get angry.
If I slip off a ladder, then I will fall.
If I swing and miss three pitches, then I strike out.
If I drive on empty, then I will run out of gasoline.

Hal's ability to remember and "get" a true if-then relationship puts him far ahead on the artificial intelligence scale, and the ability to "chain" true relationships is a bonus.

You can use this a least three ways:

1.  You can talk to Hal normally, and he will pick up some of these relationships as a byproduct of normal conversation.

2.  You can brainstorm a long list of true relationships and tell them to Hal.  Keep them simple, tell them one at a time, and keep them true!

3.  Robert Medeksza invited the forum community to submit lists of true if-then relationships to put in the release database as starter knowledge for Hal.  Each user's conversations will still add to the database.

Hal's remarks generated by "if-then" knowledge should enhance his conversational ability, and if the routine does what's intended, it should be transparent to most users.

I hope this helps explain the purpose and nature of this enhancement.

Sincerely,

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Deductive reasoning abilility and schedule update
« Reply #9 on: October 06, 2003, 12:33:59 am »
Hello,

I forgot to mention...

The example about it raining, so it gets slick, so traffic slows down, so road rage happens more often...

...was just an ARTIFICIAL example to prove the point that Hal can actually chain together if-then relationships.

If you test this with other (non-programmer) users, you will find that it is exceedingly rare for Hal to give a response by "chaining" together four or five if-then statements.  The usual case is going to be ONE linkage with a very rare TWO... the chances of getting the kind of repetitive responses in the rain-slick-slow-rage example (such as illustrated in the posting above) are very slim.  (It would require the long connected chain to exist in the database, and then for the user to just randomly happen to trigger each link in the chain, one after the other, all in a row.)

However, isn't it cool for Hal to be able to make a deduction like the following?

User: If Sara's dog ate her homework, then Sara's assignment will be late.

User: If Sara's assignment will be late, then Sara's grade will suffer.

User: Sara's dog ate her homework.

Hal: Sara's grade will suffer.

Again, this is an enhancement that should trigger automatically when needed; it is not a replacement for any other routine.

Sincerely,

Don
« Last Edit: October 06, 2003, 12:40:37 am by Don Ferguson »
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

onthecuttingedge2005

  • Guest
Deductive reasoning abilility and schedule update
« Reply #10 on: October 06, 2003, 01:33:22 am »
Hi Don.
Is there a way to write a deductive script for the 4.5
brain?
thanks
Best of wishes.
Jerry.

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
Deductive reasoning abilility and schedule update
« Reply #11 on: October 06, 2003, 10:35:55 am »
Hi Jerry,

The following is premised on your having read all the previous threads of conversation on the forum about making backups, working safely, editing brain files, preserving file extensions, etc., that have been posted previously:

If you scroll through the new Hal 5 script and identify the deductive reasoning section (it is labeled as such), it should be possible to copy and paste it into a similar spot in the 4.5 brain and create the same functionality.  REVISION: Please see the posting below by Robert Medeksza for a necessary revision.

Sincerely,

Don


« Last Edit: October 06, 2003, 11:05:40 pm by Don Ferguson »
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
Deductive reasoning abilility and schedule update
« Reply #12 on: October 06, 2003, 11:04:35 am »
Actually the Hal 5.0 DLL contains a new function called SearchPattern that didn't exist in Hal 4.5 so it won't work unless you modify these 2 lines:

IfPart = Trim(HalBrain.SearchPattern(UserSentence, "IF * THEN *", 1))
ThenPart = Trim(HalBrain.SearchPattern(UserSentence, "IF * THEN *", 2))

I haven't tested this, but just off the top of my head I think you can rewrite those 2 lines as:

If Left(UserSentence, 3) = "IF " And Instr(UserSentence, " THEN ") Then
TempSent = Right(UserSentence, Len(UserSentence) - 3)
SplitParts() = Split(TempSent, " THEN ")
IfPart = SplitParts(0)
ThenPart = SplitParts(1)
End If
Robert Medeksza

onthecuttingedge2005

  • Guest
Deductive reasoning abilility and schedule update
« Reply #13 on: October 06, 2003, 08:46:56 pm »
Thanks a million Robert.
It worked sorta. This is the way I had to format it for it to work without an error.
The script seems to work but it doesn't write to the deductive.brn for some reason and doesn't respond with the Case GetResponses
like I thought it would, I think I did something wrong.

'RESPOND: DEDUCTIVE REASONING
   'This routine learns deductive reasoning in the form:  A = B ; B = C; therefore A = C  
   'It detects sentences in the form If-Then to accommplish this. For example:
   '   User:  If Molly weighs 400 pounds, then Molly is overweight.
   '   Ultra Hal: I understand the implication.
   '   User:  If Molly is overweight, then Molly's health is in danger.
   '   Ultra Hal:  I see the relationship.
   '   User:  Molly weighs 400 pounds.
   '   Ultra Hal:  Molly's health is in danger.
   If Left(UserSentence, 3) = "IF " And Instr(UserSentence, " THEN ") Then
TempSent = Right(UserSentence, Len(UserSentence) - 3)
SplitParts() = Split(TempSent, " THEN ")
IfPart = SplitParts(0)
ThenPart = SplitParts(1)
   'If the sentence is an If-Then statement then record it
   If Len(IfPart) > 10 And Len(ThenPart) > 10 Then
      IfPart = HalBrain.AlphaNumericalOnly(IfPart)
      ThenPart = HalBrain.AlphaNumericalOnly(ThenPart)
      HalBrain.AppendFile WorkingDir & "deductive.brn", """" & IfPart & """,""" & ThenPart & """"
      Select Case (Int(Rnd * 5) + 1)
         Case 1
            GetResponse = GetResponse & "I see the relationship." & vbCrLf
         Case 2
            GetResponse = GetResponse & "I understand the connection." & vbCrLf
         Case 3
            GetResponse = GetResponse & "I will remember that one follows the other." & vbCrLf
         Case 4
            GetResponse = GetResponse & "Thanks for pointing out the cause and effect." & vbCrLf
         Case 5
            GetResponse = GetResponse & "Yes, I get that clearly." & vbCrLf
      End Select
      DebugInfo = DebugInfo & "Hal has found an If-Then statement from the user and has recorded it in Hal's deductive reasoning brain. " & vbCrLf
   'Else if the sentence is not an If-Then statement see if it uses an assertion previously recorded
   'and respond accordinly
   Else
      Assertion = UserSentence
      'Go through a maximum of 5 connections (prevents circular reasoning deductions)
      For I = 1 To 5
         Deduction = HalBrain.TopicSearch(Assertion, WorkingDir & "deductive.brn")
         If Deduction <> "" Then
            LastGoodDeduction = Deduction
            Assertion = Deduction
         Else
            Exit For 'No more connections, so no need to continue loop
         End If
      Next
      If LastGoodDeduction <> "" Then
         'Make sure the deduction hasn't just been stated by the User or Hal
         If HalBrain.CheckRepetition(LastGoodDeduction, UserSentence) = False And HalBrain.CheckRepetition(LastGoodDeduction, PrevSent) = False And HalBrain.CheckRepetition(LastGoodDeduction, PrevUserSent) = False Then
            GetResponse = GetResponse & LastGoodDeduction
            DebugInfo = DebugInfo & "Hal has responded using deductive reasoning." & vbCrLf
         End If
      End If
   End If
     End If

Best of wishes and grand new discoveries.
Jerry.
« Last Edit: October 06, 2003, 10:28:46 pm by onthecuttingedge2005 »

Ryuhoshi

  • Newbie
  • *
  • Posts: 21
    • View Profile
Deductive reasoning abilility and schedule update
« Reply #14 on: October 10, 2003, 01:49:29 pm »
Question: Will the final release of the software be sent to those who bought 4.5 (like me) or will we have to request it?  If it is sent to us, is it possible for me to change my shipping address?  I'm anxious to try out this deductive reasoning thing.  However, one thing you might work on, is having Hal recognize a concept instead of just a statement.  For instance, if you say, or he learns "If Jane drops her glass, it will fall," then Hal ought to be able to recognize "If you/he/she/it/Bob/Jamie drops his/her/etc. glass, it will fall."  You see what I mean?  The next step would be for Hal to recongize time, such as [You]: "I dropped my glass." [Hal]: "It has fallen."  Ok, all done.