or, logical disjunction, ;
The logical conjunction (logical-and, ∧) of goals is achieved in Prolog by separating the goals by commas:

happy(X) :- rich(X), famous(X).

says that X is happy if X is rich and X is famous. What about logical-or, ∨, also called disjunction? If we want to say that X is happy if X is rich or if X is famous, we have two possibilities:

  1. use two alternative rules
  2. use the ; operator (pronounced "or").

Option 1:

happy1(X) :- rich(X).
happy1(X) :- famous(X).

Option 2:

happy2(X) :- rich(X) ; famous(X).

Sometimes it is necessary, or at least advisable, to wrap parentheses ( ) around a disjunction in order to make clear what how the conjunctions and disjunctions interact. If you leave out the parentheses, Prolog has its own rules about the precedence of logical-and and logical-or, which might or might not correspond to what you intend. If you use parentheses, the things inside the parentheses are done first, so everything is crystal clear.

Option 3:

happy3(X) :- attractive(X), ( rich(X) ; famous(X) ).

This says X is happy3 if X is attractive, and X is either rich or famous:
happy3(X) ⇐ attractive(X) ∧ (rich(X) ∨ famous(X)).*

* The Prolog Dictionary wishes to acknowledge that a range of world religions and philosophies would not agree that the criteria specified for happy1, happy2, and happy3 are either necessary nor sufficient for happiness. The definitions given in this article, are, therefore, purely intended as Prolog programming examples, and should not be taken as a practical guide to life. Thank you.