refined set

parent 163be7ed
...@@ -951,12 +951,16 @@ expand(Var,V,YY,Lam) :- ...@@ -951,12 +951,16 @@ expand(Var,V,YY,Lam) :-
doall(X,Op,[F]) :- !,F(X). doall(X,Op,[F]) :- !,F(X).
doall(X,Op,[F|L]) :- Op(F(X),doall(X,Op,L)). doall(X,Op,[F|L]) :- Op(F(X),doall(X,Op,L)).
memvv(A,[X|L]) :- A==X,!.
memvv(A,[X|L]) :- memvv(A,L).
findvars0([A|B],U,UU) :- !, findvars0([A|B],U,UU) :- !,
findvars0(A,U,U1), findvars0(A,U,U1),
findvars0(B,U1,UU). findvars0(B,U1,UU).
findvars0(A,U,[A|U]) :- findvars0(A,U,[A|U]) :-
var(A),\+ memq(A,U),!. var(A), (\\+ memvv(A,U)),!.
findvars0(A,U,U). findvars0(A,U,U).
findvars(A,U) :- findvars(A,U) :-
...@@ -979,9 +983,10 @@ expand(Var,V,YY,Lam) :- ...@@ -979,9 +983,10 @@ expand(Var,V,YY,Lam) :-
'f∩'(A,B,C) :- 'f∩'(A,B,C) :-
findvars([A,B],W), findvars([A,B],W),
mkdyn(C), mkdyn(C),
asserta(C(X,W) :- fint0(A(X),B(X)). asserta(C(X,W) :- doall(X,fint0,[A,B])).
'f∩'(L,C) :- 'f∩'(L,C) :-
findvars(L,W),
mkdyn(C), mkdyn(C),
asserta(C(X,W) :- doall(X,fint0,L)). asserta(C(X,W) :- doall(X,fint0,L)).
...@@ -994,28 +999,35 @@ expand(Var,V,YY,Lam) :- ...@@ -994,28 +999,35 @@ expand(Var,V,YY,Lam) :-
fsum0(A,B) :- (((A),\\+(B));((B),\\+(A))). fsum0(A,B) :- (((A),\\+(B));((B),\\+(A))).
'f⊕'(A,B,C) :- 'f⊕'(A,B,C) :-
findvars([A,B],W),
mkdyn(C), mkdyn(C),
asserta(C(X) :- fsum(A(X),B(X))). asserta(C(X,W) :- doall(X,fsum,[A,B])).
'f⊕'(L,C) :- 'f⊕'(L,C) :-
findvars(L,W),
mkdyn(C), mkdyn(C),
asserta(C(X) :- doall(X,fsum0,L)). asserta(C(X,W) :- doall(X,fsum0,L)).
'f×'(A,B,C) :- 'f×'(A(U),B(V),C) :-
findvars([U,V],W),
mkdyn(C), mkdyn(C),
asserta(C([X|Y]) :- (A(X),B(Y))). asserta(C([X|Y],W) :- (A(X,U),B(Y,V))).
fc(A,C) :- fc(A(V),C) :-
mkdyn(C), mkdyn(C),
asserta(C(X) :- \\+A(X)). asserta((C(X,V) :- \\+A(X,V))).
fzero([]). fzero([]).
'f×'([],fzero). 'f×'(L,C) :-
'f×'([X|L],C) :- findvars(L,W),
fcross(L,CC), f0(W,L,C).
fcross(X,CC,C).
'f×'(X,X). f0(W,[],fzero).
f0(W,[A|L],C) :-
f0(W,L,CC),
'f×'(A,CC(W),C).
f0(W,X,X).
") ")
(define subset subset1) (define subset subset1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment