I'm trying to extract symbols from formula. Ex:
?- formula((p v q) & (q v r), U).
U = [p, q, v].
What I've done so far:
simbol_formula([],[]).
simbol_formula(negation X, [X]).
simbol_formula(X or Y, [X,Y]).
simbol_formula(X and Y, [X,Y]).
I believe what I did is correct but incomplete. I am stuck. It obviously works for simple formulas but for more complex formulas it does not. I know I have to define something as simbol_formula(F,U) :-
. Using recursion somehow or break the given formula into "smaller" ones.