A recurring problem with generative AI and Prolog code is that models frequently use =/2 instead of proper comparison operators. This issue has persisted for years and continues to occur even with recent Anthropic models like Haiku 4.5 and Sonnet 4.6. (Note: I typically reserve Opus 4.7 for planning rather than coding tasks.)
When I asked Haiku 4.5 to explain this behavior and provide a reference, it cited:
In other words, and unless you are writing hairy control flow code, if you are using “==” you are probably doing it wrong. Use “=” instead.
The model attributed this to the official SWI-Prolog reference manual. However, I was skeptical—I couldn’t imagine @jan writing such advice as a documented fact—so I traced the source. While the quote does appear on the SWI-Prolog page for Comparison and Unification of Terms, it’s actually a user comment at the end of the page, not official documentation.