This is a prolog program which defines the syntax of propositional logic
So I'm stuck trying to find where X is a sub formula of Y. I have made the following predicates but I am having problems with this one. Not exactly sure what to do after. I know that I need to check whether X and Y are formulas, but I don't understand the next step.
at(a). % Our first atom.
at(b). % Our second atom.
%fmla shows if it is a formula or not
fmla(X):- at(X). % an atom is a formula
fmla(neg(X)) :- fmla(X). % neg(F) is a formula if F is a formula
fmla(or(X,Y)) :- fmla(X), fmla(Y). % or(F,G) is a formula if F and G are formulas
fmla(and(X,Y)) :- fmla(X), fmla(Y). % and(F,G) is a formula if F and G are formulas
fmla(imp(X,Y)) :- fmla(neg(X)), fmla(Y). %imp is a formula when not F and G are formulas
fmla(iff(X,Y)) :- fmla(imp(X,Y)), fmla(imp(Y,X)). %Double implication
sub(X,Y) :- fmla(X), fmla(Y).
Would like some ideas of how to solve the sub formula part.