Hi, folks.

I have just subscribed to this list hoping that in here I will find some
answers. I haven't found much helpful materials and got a bunch of problems
with my application, mainly because it's my first one. As I am kinda new to
prolog, I got several problems to discuss in here. Tryied the archives
already, but maybe for the lack of knowledge for the certain terms to
search, I wasn't able to find any answers.

Here's my first problem...

There are some predicates in my theory who are opposites. By that, I mean
that
A <=> ¬B (A is equivalent to the negation of B)

As we don't have explicit negation, I have tried some approaches, but most
of them end at a stack overflow for having such definitions. My main example
is about the predicates 'innocent(X)' and 'assassin(X)'.

Obviously, no one can be both. As there IS certainly and assassin, there is
a formula that states that if everyone else but "thisguy" is innocent, then
assassin(thisguy) can just be concluded. So I tryied describing every case,
just like that:

assassino(carlile) :-
inocente(dorothy),inocente(leland),inocente(scott),inocente(barnabas),inocente(zoe),inocente(susan),inocente(rose),inocente(chancey).
assassino(dorothy) :-
inocente(carlile),inocente(leland),inocente(scott),inocente(barnabas),inocente(zoe),inocente(susan),inocente(rose),inocente(chancey).
assassino(leland) :-
inocente(carlile),inocente(dorothy),inocente(scott),inocente(barnabas),inocente(zoe),inocente(susan),inocente(rose),inocente(chancey).
assassino(scott) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(barnabas),inocente(zoe),inocente(susan),inocente(rose),inocente(chancey).
assassino(barnabas) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(scott),inocente(zoe),inocente(susan),inocente(rose),inocente(chancey).
assassino(zoe) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(scott),inocente(barnabas),inocente(susan),inocente(rose),inocente(chancey).
assassino(susan) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(scott),inocente(barnabas),inocente(zoe),inocente(rose),inocente(chancey).
assassino(rose) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(scott),inocente(barnabas),inocente(zoe),inocente(susan),inocente(chancey).
assassino(chancey) :-
inocente(carlile),inocente(dorothy),inocente(leland),inocente(scott),inocente(barnabas),inocente(zoe),inocente(susan),inocente(rose).

And there's another rule that states that if someone is the assassin, than
no one else is an assassin too...

inocente(X) :- assassino(Y), diferente(X,Y).

The predicate different (diferente) is defined splicitly as a list off all
suspects, two by two, and in no other way, so it will always check directly
and there's no problem about it. When I run 'inocente(X).' or
'assassino(X).' as a goal, though, the process will go circular at some
point and never end.

I tried to use cut, but only found out that I didn't understand it's usage
properly...

So, please, can anyone tip me on how to solve this problem and move up to a
next step on my code?
The full code is attached and you may feel free to suggest and criticize it.
I just want to learn some about my errors and solve my problem here... It's
based on a classic game of 'sleuth' and is being implemented as a tool to
certify a logical proof using non-monotonic logics as sample applications of
a certain framework, so it's a serious problem for me.

All help is welcome.

Regards,
Samy Soares.
_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to