Prolog GnupLog文件有问题';存在错误';

Prolog GnupLog文件有问题';存在错误';,prolog,Prolog,嗨,我有一个gprolog文件,我在里面出错了。我知道什么是存在错误,但找不到解决办法。在有问题的文件中,我试图建立证明树。:- is_true(P,P):-fact P. is_true(C,C<=ProofTreeA):-if A then C, is_true(A,ProofTreeA). is_true(P1 and P2, ProofTree1 and ProofTree2):-(P1<=ProofTree1),(P2<=ProofTree2). is_true(P1

嗨,我有一个gprolog文件,我在里面出错了。我知道什么是存在错误,但找不到解决办法。在有问题的文件中,我试图建立证明树。
:-

is_true(P,P):-fact P.
is_true(C,C<=ProofTreeA):-if A then C, is_true(A,ProofTreeA).
is_true(P1 and P2, ProofTree1 and ProofTree2):-(P1<=ProofTree1),(P2<=ProofTree2).
is_true(P1 or P2, ProofTree1):-(P1 or P2<=ProofTree1).
is_true(P1 or P2, ProofTree2):-(P1 or P2<=ProofTree2).
是真的(P,P):-fact P。

是真的吗(C,C正如@false所指出的,您有语法错误:

Quetzalcoatl$ cat <<.. > pl.pl
> is_true(P,P):-fact P.
> is_true(C,C<=ProofTreeA):-if A then C, is_true(A,ProofTreeA).
> is_true(P1 and P2, ProofTree1 and ProofTree2):-(P1<=ProofTree1),(P2<=ProofTree2).
> is_true(P1 or P2, ProofTree1):-(P1 or P2<=ProofTree1).
> is_true(P1 or P2, ProofTree2):-(P1 or P2<=ProofTree2).
> ..

Quetzalcoatl$ gprolog --init-goal "['pl.pl']"
compiling pl.pl for byte code...
pl.pl:1:20: syntax error: . or operator expected after expression
pl.pl:2:12: syntax error: , or ) expected
pl.pl:3:12: syntax error: , or ) expected
pl.pl:4:12: syntax error: , or ) expected
pl.pl:5:12: syntax error: , or ) expected
    5 error(s)
compilation failed
warning: command-line goal '[''pl.pl'']' failed
GNU Prolog 1.4.4 (64 bits)
Compiled Apr 23 2013, 17:26:17 with /opt/local/bin/gcc-apple-4.2
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?- 
quetzalcatl$cat是真的(P,P):-fact P。

>is_true(C,C is_true(P1和P2,ProofTree1和ProofTree2):-(P1语法看起来很不寻常。
事实
正如@false指出的,这里有一些自定义运算符,你没有提到。你的“有问题”有点模糊。发布问题时最好显示错误消息等。is

Quetzalcoatl$ cat pl.pl 
%you should be aware of the signatures of your rules, e.g. is_true(+fact,?fact), is_true(?fact,?fact)
:-op(800,xfy, and).
:-op(801,xfy, or).
is_true(P,P):-nonvar(P),P. %P should be bounded to a fact (e.g. fact/1) existing in your knowledge base of facts
is_true(C,ProofTreeA):- A , C@=<ProofTreeA, is_true(A,ProofTreeA).  %A is ubounded ?
                                                                 %'if A then C' ---> 'A,C'     %assuming A is a fact in the knowledge base
is_true(and(P1, P2), and(ProofTree1 , ProofTree2)):-(P1@=<ProofTree1),(P2@=<ProofTree2). 
is_true(or(P1 , P2), ProofTree1):-P1 @=< ProofTree1 ; P2 @=< ProofTree1. 
%s_true(or(P1 , P2), ProofTree2):-(P1 or P2<=ProofTree2). this rule is the same than the above one

Quetzalcoatl$ gprolog --init-goal "['pl.pl']"
compiling pl.pl for byte code...
pl.pl compiled, 9 lines read - 1708 bytes written, 4 ms
GNU Prolog 1.4.4 (64 bits)
Compiled Apr 23 2013, 17:26:17 with /opt/local/bin/gcc-apple-4.2
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?-