i've the following Problem. I have a List 'A' lets call it "assumptions" and with the predicate ass(A,P)
I want to check, if all of this assumptions does occure in some form in the variable Proof.
For example, if I call:
?- ass([a, b], [[[1], 1, a, 'A', ''], [[2], 2, a->b, 'A',''], [[3], 3, b, 'A', '']]).
it should give the value true, cause [[1], 1, a, 'A', ''] and [[3], 3, b, 'A', '']] are the elements in P assigned to 'a' and 'b' in the list A.
?- ass([a,b],P).
e.g. should deliver P=[[[1], 1, a, 'A', ''], [[2], 2, b, 'A','']]
I've tried to solve it with the following code:
do_list(N, L):-
findall(Num, between(1, N, Num), L).
succ(A, P, I) :- [[I], I, A, 'A', ''] == P.
ass(A, P) :- length(A, L1), length(P,L2), L3 is max(L1,L2), do_list(L3, I), maplist(succ, A, P, I).
my problem now is, that maplist tries to check every pair of [A,P,I]
and if it founds some, where succ(A,P,I)
is false ass(A,P)
is false, too.
Now I've two questions:
- Is their a way to solve my problem?
- Is their a way to fix the parameters P and I in the predicate
succ(A,P,I)
, so it would be possible e.g. to membercheck simply if[[I1],I1,a,'A','']
e.g. is a member of my List P for some I1 in I.
Thanks for the help, Martin