我想test(A,B)
在序言中写一个谓词,如果 A 小于或等于 B,则该谓词为真。
查询示例(应返回 true):
test(s(s(0)), s(s(s(0)))).
test(s(s(s(0))), s(s(s(0)))).
这是我到目前为止编写的代码:
test(0,0).
test(0, s(B)) :- nat(B).
test(s(A),s(B)) :- test(A,B).
但它不起作用。
我想test(A,B)
在序言中写一个谓词,如果 A 小于或等于 B,则该谓词为真。
查询示例(应返回 true):
test(s(s(0)), s(s(s(0)))).
test(s(s(s(0))), s(s(s(0)))).
这是我到目前为止编写的代码:
test(0,0).
test(0, s(B)) :- nat(B).
test(s(A),s(B)) :- test(A,B).
但它不起作用。