1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % Author
: Tom Schrijvers
3 % Email
: Tom
.Schrijvers
@cs.kuleuven
.be
4 % Copyright
: K
.U
.Leuven
2004
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 :- use_module
(hprolog
).
14 :- use_module
(library
(lists
),[append
/3]).
17 %% :- use_module
(library
(terms
),[term_variables
/2]).
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21 negate_b
(A
,B
) :- once
(negate
(A
,B
)).
22 negate
((A
,B
),NotB
) :- A
==true
,negate
(B
,NotB
). % added by jon
23 negate
((A
,B
),NotA
) :- B
==true
,negate
(A
,NotA
). % added by jon
24 negate
((A
,B
),(NotA
;NotB
)) :- negate
(A
,NotA
),negate
(B
,NotB
). % added by jon
25 negate
((A
;B
),(NotA
,NotB
)) :- negate
(A
,NotA
),negate
(B
,NotB
). % added by jon
28 negate
(X
=< Y
, Y
< X
).
29 negate
(X
> Y
, Y
>= X
).
30 negate
(X
>= Y
, Y
> X
).
31 negate
(X
< Y
, Y
=< X
).
32 negate
(X
== Y
, X \
== Y
). % added by jon
33 negate
(X \
== Y
, X
== Y
). % added by jon
34 negate
(X
=:= Y
, X
=\
= Y
). % added by jon
35 negate
(X is Y
, X
=\
= Y
). % added by jon
36 negate
(X
=\
= Y
, X
=:= Y
). % added by jon
37 negate
(X
= Y
, X \
= Y
). % added by jon
38 negate
(X \
= Y
, X
= Y
). % added by jon
39 negate
(var
(X
),nonvar
(X
)).
40 negate
(nonvar
(X
),var
(X
)).
41 negate
(\
+ X
,X
). % added by jon
42 negate
(X
,\
+ X
). % added by jon
44 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 entails_b
(fail
,_
) :-!.
57 entails
(A
,C
,History
) :-
59 \
+ hprolog
:memberchk_eq
(B
,History
),
60 entails
(B
,C
,[B
|History
]).
62 entails_
(X
> Y
, X
>= Y
).
63 entails_
(X
> Y
, Y
< X
).
64 entails_
(X
>= Y
, Y
=< X
).
65 entails_
(X
=< Y
, Y
>= X
). %added by jon
66 entails_
(X
< Y
, Y
> X
).
67 entails_
(X
< Y
, X
=< Y
).
68 entails_
(X
> Y
, X \
== Y
).
69 entails_
(X \
== Y
, Y \
== X
).
70 entails_
(X
== Y
, Y
== X
).
71 entails_
(X
== Y
, X
=:= Y
) :- ground
(X
). %added by jon
72 entails_
(X
== Y
, X
=:= Y
) :- ground
(Y
). %added by jon
73 entails_
(X \
== Y
, X
=\
= Y
) :- ground
(X
). %added by jon
74 entails_
(X \
== Y
, X
=\
= Y
) :- ground
(Y
). %added by jon
75 entails_
(X
=:= Y
, Y
=:= X
). %added by jon
76 entails_
(X
=\
= Y
, Y
=\
= X
). %added by jon
77 entails_
(X
== Y
, X
>= Y
). %added by jon
78 entails_
(X
== Y
, X
=< Y
). %added by jon
79 entails_
(ground
(X
),nonvar
(X
)).
80 entails_
(compound
(X
),nonvar
(X
)).
81 entails_
(atomic
(X
),nonvar
(X
)).
82 entails_
(number
(X
),nonvar
(X
)).
83 entails_
(atom
(X
),nonvar
(X
)).
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 binds_
(nonvar
(_
),L
,L
).
93 binds_
(ground
(_
),L
,L
).
94 binds_
(compound
(_
),L
,L
).
95 binds_
(number
(_
),L
,L
).
97 binds_
(atomic
(_
),L
,L
).
98 binds_
(integer
(_
),L
,L
).
111 binds_
(X is _
,[X
|L
],L
).
112 binds_
((G1
,G2
),L
,T
) :-
115 binds_
((G1
;G2
),L
,T
) :-
118 binds_
((G1
->G2),L
,T
) :-
125 binds_
(G
,L
,T
) :- term_variables
(G
,GVars
),append
(GVars
,T
,L
). %jon