Logical Operator in Prolog

The description of the two operators is explained in this section. It takes arguments, and those arguments are called terms.

Not operator

To provide the negation, not/1 prefix operator can be placed before any goal. If the original goal fails, the negation goal succeeds. If the original goal succeeds, the negation goal fails.

The use of not/1 is explained in the following example. Suppose a single clause contained in the database.

For example:

Disjunction Operator

The ';/2' is the disjunction operator. It is an infix operator, which represents 'or'. It takes two arguments, and both the arguments are goals. If either Goal1 or Goal2 succeeds, the Goal1;Goal2 succeeds.

For example: