Solving problems using logic programming
Logic programming looks for solutions by using facts and rules. We need to specify a goal for each program. In the case where a logic program and a goal don't contain any variables, the solver comes up with a tree that constitutes the search space for solving the problem and getting to the goal.
One of the most important things about logic programming is how we treat the rules. Rules can be viewed as logical statements. Let's consider the following:
Kathy likes chocolate => Alexander loves Kathy
This can be read as an implication that says, If Kathy likes chocolate, then Alexander loves Kathy. It can also be construed as Kathy likes chocolate implies Alexander loves Kathy. Similarly, let's consider the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access