For Programmers: Free Programming Magazines  


Home > Archive > Prolog > May 2006 > "Undefined procedure" error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author "Undefined procedure" error
Eren Aykin

2006-05-28, 7:05 pm

Hello everybody.
I'm trying to write a simple automobile diagnosis expert system.
I want the user to enter the certainty of some facts about the car.
Then I want the program to print all the new conclusions it produces.
I'm using SWI Prolog and the code is like this:

min(X,Y,Min) :- X<Y,!,Min=X;Min=Y.
max(X,Y,Max) :- X>=Y,!,Max=X;Max=Y.

:- op(800, fx, if).
:- op(700, xfx, then).
:- op(300, xfy, or).
:- op(200, xfy, and).

if spark_plug_wrong and gasoline_motor
then spark_plug_gasoline_relation :0.8.
if spark_plug_gasoline_relation or points__gasoline_relation
then gasoline_fuel_sourced:0.8.
/* rules continue like this */

go :-
new_derived_certainity(P, A), !, write(P), write(' '), write(A), nl,
assert(certainity(P, A)), go.

new_derived_certainity(Concl, B) :-
if Cond then Concl : C, not certainity(Concl, X1), certainity(Cond,
X2).

certainty(Cond1 and Cond2, Cert) :-
certainty(Cond1, Cert1), certainty(Cond2, Cert2), min(Cert1, Cert2,
Cert).

certainty(Cond1 or Cond2, Cert) :-
certainty(Cond1, Cert1), certainty(Cond2, Cert2), max(Cert1, Cert2,
Cert).

certainty(P, Cert) :-
if Cond then P : C1, certainty(Cond, C2), Cert is C1 * C2.
---------------------------------------------------------------------------------------------------
I query this program like:
assert(certainity(spark_plug_wrong, 0.7)).
assert(certainity(gasoline_motor, 0.7)).
go.

But I get the following error:
"ERROR: go/0: Undefined procedure: new_derived_certainity/2"

Does anybody has an idea about what can be the source of the error?
Any recomendations would be greatly appreciated.
Regards.

Pierpaolo BERNARDI

2006-05-28, 7:05 pm

On Sun, 28 May 2006 22:17:57 +0200, Eren Aykin <erenaykin@gmail.com> wrote:

> Any recomendations would be greatly appreciated.


use \+ instead of not.


--
Anything below this line is being added by the newsserver

Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com