Solar System
Prolog is excellent for queries on relational data (as in the Mathematical sense of a "relation"), e.g.,
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) and 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. |
There are more Prolog examples here.