This project is a solution to a simplified version of the Zebra Puzzle, involving logical reasoning about the Potter family. The solution applies Propositional Logic and First-Order Logic (FOL) techniques to represent the facts, rules, and queries related to their hobbies, favorite desserts, and dreams. The program answers questions about the family using Python and inference algorithms from the AIMA Python library.
The puzzle introduces the Potter family and their relative Aunt Polly. Each family member has unique hobbies, dessert preferences, and aspirations. The solution needs to:
- Identify who likes Napoleon cake.
- Determine who dreams of visiting Paris.
-
First-Order Logic (FOL):
- Used to model relationships among family members and their hobbies or dreams.
-
Propositional Logic:
- Used to model binary facts about hobbies, desserts, and dreams.
- Query 1: Who likes Napoleon cake?
- Query 2: Who dreams of visiting Paris?
The solution uses the AIMA Python library for logic representation and inference. The core components include:
- Knowledge Base (KB):
- Initialized using FolKB for FOL and PropKB for propositional logic.
- Populated with facts and rules as clauses.
- Inference:
- Implemented using fol_fc_ask for FOL.
- Used dpll_satisfiable and pl_resolution for propositional logic queries.