O'Reilly logo

Good Math by Mark C. Chu-Carroll

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Computing Family Relationships

I’m going to introduce you to Prolog by using the same example as the previous chapter: family relationships. But instead of writing them out in formal logical syntax, we’ll do it in Prolog, and we’ll see how you’d interact with the Prolog system. I’m using a free, open-source Prolog interpreter called SWI-Prolog,[9] but you can use that or any other Prolog system that runs on your computer.

In logic, you reason over objects, called atoms. In Prolog, an atom is any lowercase identifier, number, or quoted string. For example, mark, 23, and "q" are atoms. For an example, we’ll look at reasoning about family relationships, so the atoms will all be first names.

A variable in Prolog is a symbol that represents an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required