我正在编写一个自然演绎的校验工具,而且我的部分校样在列表中“更进了一步”时遇到了问题。
首先我读了一个文件等,然后我调用了引起麻烦的函数:
validate([q],[[1, q, premise],[[2, p, assumption],[3, q, copy(1)]],
[4, imp(p,q), impint(2,3)]].
通过跟踪检查我知道下面的调用是失败的调用:
validate([[1, q, premise], q], [[[2, p, assumption], [3, q, copy(1)]], [4, imp(p, q), impint(2, 3)]])
这些是该计划的相关部分:
%% Premise, this is what should unify at the first call %%
validate(Prems,[[N,Y,premise]|T]):-
member(Y,Prems),
validate([[N,Y,premise]|Prems],T).
%% This is not being called at the moment, so feel free to ignore it, since it's the next step.%%
%%Box, or the deeper level. This should be called from the sentance above%%
validate(Prems, [[[N,X,assumtion]|BT]|Tail]):-
reverse([[[N,X,assumtion]|BT]|Tail], RevBox),
RevBox = [[M,Goal,X]|_],
write('1'),
validate([[N,X,assumtion]|Prems],BT),
write('2'),
validate([[X,Goal, box(N,M)]|Tail]).
%%impint%%
validate(Prems, [[N,imp(P,Q),impint(A,B)]|T]):-
member([P,Q,box(A,B)],Prems),
write('3'),
validate([[N,imp(P,Q),impint(A,B)]|Prems],T).
%% copy %%
validate(Prems,[[_,X,copy(A)]|T]):-
member([A,X,_],Prems),
validate([[_,X,copy(A)]|Prems],T).
答案 0 :(得分:0)
当它被指出它不是第一个但后来要求验证失败时,我可以将它追溯到拼写错误的'假设'这个词。