Prolog (Programming in Logic) is a programming language based on Predicate Logic. It uses the restricted syntax known as Horn Clauses.
Quantification of logical variables is implicit – universal (∀) for facts and rules, existential (∃) for queries – so the quantifiers are taken as read and omitted:
<= (also :- ) | can be read as if, or as is implied by. |
planet(P)<=orbits(P,sun). | can be read as
∀ P, P is a planet if P orbits the sun. (That is not to say that the definition cannot be tightened.) |
satellite(S)<=orbits(S,P), planet(P). | ∀ S, S is a satellite if ∃ P s.t. S orbits P and P is a planet. |
?satellite(S) | does there exist an S such that S is a satellite? |
And the answer, here, is yes, if S is earth's moon, or a moon of another planet. |