Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Chapter 5: First-Order Logic - Implementation

Next Steps: Family Relations

The lab notebook (Chapter 5 Lab: First-Order Logic) builds a family knowledge base with Parent facts and rules such as

Grandparent(X, Z) :- Parent(X, Y), Parent(Y, Z)
Sibling(X, Y)     :- Parent(Z, X), Parent(Z, Y), X ≠ Y

With Parent(John, Mary), Parent(John, Bob) and Parent(Mary, Ann), forward chaining should derive Grandparent(John, Ann), Sibling(Mary, Bob) and Sibling(Bob, Mary). Leaving out the X ≠ Y test also derives Sibling(Mary, Mary): a good check that your implementation enforces it.