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

Computation with Logic

We can use Prolog for much more than just a silly example like family-relationship inferences. In Prolog, using nothing but logical inference, we can implement programs to perform any computation that we could implement in a more traditional programming language. To see how we can do that, we’ll look at two examples of how you write more realistic computations in Prolog. First, we’ll pull out Peano arithmetic, which we talked about back in 1, Natural Numbers, and implement it in Prolog. Then we’ll take the most widely used sorting algorithm in modern software and look at how it appears in Prolog.

Peano Arithmetic in Prolog

As we saw back toward the beginning of this book, Peano arithmetic is a formal, axiomatic way ...

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