Hello everyone!

I would like to know if there is a way to write false in SWI Prolog instead of error. The situation is the following:

I have written a prolog program that says if a statement is a formula or not, for example:

?- fmla(or(a,b)). Answer = true

The problem is that if you enter fmla(or(a,ne(b))) prolog will say ERROR since it will try to match ne(b) to my database and it doesn't exist. I would prefer if it said false.

Here is the code just in case you want to check:

at(a).

at(b).

neg(F) :- fmla(F).

or(F,G) :- fmla(F), fmla(G).

fmla(F) :- at(F).

fmla(F) :- arg(1, F, A), call(F).

imp(F,G) :- fmla(or(neg(F),G)).

and(F,G) :- fmla(neg(or(neg(F),neg(G)))).

iff(F,G) :- and(imp(F,G),imp(G,F)).

Thank you :P!

PD: in order to simplify the program, the only atomic formulas are a and b.