[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[SOLUTION] Inference Engine (#37

Paolo Capriotti

7/4/2005 4:23:00 PM

My solution can be found here:
http://linuz.sns.it/~capriotti/ruby/in...

Paolo Capriotti


8 Answers

Abu Abdullah

7/4/2005 4:55:00 PM

0

Paolo Capriotti wrote:

>My solution can be found here:
>http://linuz.sns.it/~capriotti/ruby/in...
>
>Paolo Capriotti
>
>
>
C:\>inference
> all dogs are mamals
OK
> all mamals are hairy animals
OK
> all mamals are dogs
OK ------------------ ? ? ?



Paolo Capriotti

7/4/2005 5:09:00 PM

0

On 7/4/05, Abu Abdullah <alawi2@eim.ae> wrote:

> C:\>inference
> > all dogs are mamals
> OK
> > all mamals are hairy animals
> OK
> > all mamals are dogs
> OK ------------------ ? ? ?

why not?

Paolo


Nikolai Weibull

7/4/2005 5:36:00 PM

0

Paolo Capriotti wrote:

> On 7/4/05, Abu Abdullah <alawi2@eim.ae> wrote:
>
> > C:\>inference
> > > all dogs are mamals
> > OK
> > > all mamals are hairy animals
> > OK
> > > all mamals are dogs
> > OK ------------------ ? ? ?

> why not?

A ? B doesn't imply B ? A,
nikolai

--
Nikolai Weibull: now available free of charge at http:/...!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}


Ryan Leavengood

7/4/2005 5:44:00 PM

0

Nikolai Weibull wrote:
> Paolo Capriotti wrote:
>
>
>>On 7/4/05, Abu Abdullah <alawi2@eim.ae> wrote:
>>
>>
>>>C:\>inference
>>> > all dogs are mamals
>>>OK
>>> > all mamals are hairy animals
>>>OK
>>> > all mamals are dogs
>>>OK ------------------ ? ? ?
>
>
>>why not?
>
>
> A ? B doesn't imply B ? A,
> nikolai
>

But here the rules are being set up, and the above relationship is being
defined for dogs and mammals. This is not a conflicting rule. I think
Abu sees it as a conflicting rule.

Ryan


Abu Abdullah

7/4/2005 7:18:00 PM

0

Ryan Leavengood wrote:

> Nikolai Weibull wrote:
>
>> Paolo Capriotti wrote:
>>
>>
>>> On 7/4/05, Abu Abdullah <alawi2@eim.ae> wrote:
>>>
>>>
>>>> C:\>inference
>>>> > all dogs are mamals
>>>> OK
>>>> > all mamals are hairy animals
>>>> OK
>>>> > all mamals are dogs
>>>> OK ------------------ ? ? ?
>>>
>>
>>
>>> why not?
>>
>>
>>
>> A ? B doesn't imply B ? A,
>> nikolai
>>
>
> But here the rules are being set up, and the above relationship is
> being defined for dogs and mammals. This is not a conflicting rule. I
> think Abu sees it as a conflicting rule.
>
> Ryan
>
>
using the quiz web page as a source for testing. and selecting from the
available sample there, i selected the facts *2* , *1* and *6* respectivly.
and after supplying the *6th* rule, the engine should say *"Sorry, that
contradicts what I already know."*


James Gray

7/4/2005 8:06:00 PM

0

On Jul 4, 2005, at 2:17 PM, Abu Abdullah wrote:

> using the quiz web page as a source for testing. and selecting from
> the available sample there, i selected the facts *2* , *1* and *6*
> respectivly.
> and after supplying the *6th* rule, the engine should say *"Sorry,
> that contradicts what I already know."*

You skipped the rules that makes it a contradiction:

No cats are dogs. (After: All cats are mammals.)

James Edward Gray II



C Erler

7/5/2005 2:31:00 PM

0

>
> On 04/07/05, Abu Abdullah <alawi2@eim.ae> wrote:
>
> Ryan Leavengood wrote:
>
> > Nikolai Weibull wrote:
> >
> >> Paolo Capriotti wrote:
> >>
> >>
> >>> On 7/4/05, Abu Abdullah <alawi2@eim.ae> wrote:
> >>>
> >>>
> >>>> C:\>inference
> >>>> > all dogs are mamals
> >>>> OK
> >>>> > all mamals are hairy animals
> >>>> OK
> >>>> > all mamals are dogs
> >>>> OK ------------------ ? ? ?
> >>>
> >>
> >>
> >>> why not?
> >>
> >>
> >>
> >> A ? B doesn't imply B ? A,
> >> nikolai
> >>
> >
> > But here the rules are being set up, and the above relationship is
> > being defined for dogs and mammals. This is not a conflicting rule. I
> > think Abu sees it as a conflicting rule.
> >
> > Ryan
> >
> >
> using the quiz web page as a source for testing. and selecting from the
> available sample there, i selected the facts *2* , *1* and *6*
> respectivly.
> and after supplying the *6th* rule, the engine should say *"Sorry, that
> contradicts what I already know."*

You know that not all mammals are dogs. How does the computer ? Let's say I
enter :
All prime numbers are noncomposite.
All prime numbers are nonfactorable.
All noncomposites are prime numbers.
This is of the same form as the example given and would not be a
contradiction. The computer does not know anything about dogs or prime
numbers except what you tell it. All it can look at is the form of what
you've typed in. If the forms don't clearly indicate contradiction, the
computer does not know there is one.
Also, making the computer say "Contradiction" with that small amount of
information would mean that you could never effectively say that two names
(dogs and mammals or prime numbers and noncomposites) refer to the same
thing, even though that happens in real life.

Pit Capitain

7/5/2005 8:43:00 PM

0

Here's my solution. Note that I hadn't enough time to comment it, and
the implementation isn't as understandable as I'd like.

Only to test whether it's possible, I chose irb for the user interface.
After loading the file, you can enter facts and queries in plain text:

irb(main):001:0> require "ie"
=> true
irb(main):002:0> all mammals are hairy animals
=> OK.
irb(main):003:0> all dogs are mammals
=> OK.
irb(main):004:0> are all dogs hairy animals?
=> Yes, all dogs are hairy animals.
irb(main):005:0> describe dogs
=> All dogs are hairy animals.
All dogs are mammals.
irb(main):006:0>

If you want to try it, note that you aren't allowed to enter dots (".")
after facts and that you have to enter question marks ("?") after queries.

Regards,
Pit