2
|
1
|
|
2 gather(A,X,X1) :- atomic(A),!,
|
|
3 X = [A|X1].
|
|
4 gather(F,X,X1) :- functor(F,_,N),!,
|
|
5 gather_args(0,N,F,X,X1).
|
|
6 gather_args(N,N1,_,X,X) :- N =:= N1,!.
|
|
7 gather_args(N,N1,F,X,X1) :-
|
|
8 N0 is N+1,arg(N0,F,A),
|
|
9 gather(A,X,X0),gather_args(N0,N1,F,X0,X1).
|
|
10
|
|
11
|
|
12 itl(A,C,T,X,X) :- atomic(A),!,
|
|
13 itl_variable(C,A,T).
|
|
14 itl_variable(C,A,T) :-
|
|
15 true(C,A,C,C1),!,
|
|
16
|
|
17 itl_false(C,A,F,X0,X1).
|
20
|
18 itl_true(C,A,T,X,X) :-true.
|
|
19 itl_true(_,_,X,X) :-true.
|
2
|
20
|
|
21 true([],A,C,[A|C]):-!.
|
|
22 true([A|_],A,C,C):-!.
|
|
23 true([not(A)|_],A,C,C):-!,fail.
|
|
24 true([_|T],A,C,C1):-!,true(T,A,C,C1).
|
|
25
|
|
26 false([],A,C,[A|C]):-!.
|
|
27 false([not(A)|_],A,C,C):-!.
|
|
28 false([A|_],A,C,C):-!,fail.
|
|
29 false([_|T],A,C,C1):-!,false(T,A,C,C1).
|
|
30
|