I don’t know about your particular use case, but it is never a bad idea to learn Prolog.
https://www.metalevel.at/prolog
The Power of Prolog is an extremely in depth, comprehensive introduction that starts right from fundamentals, and goes into some pretty advanced topics. It’s a really great resource, with well-produced accompanying videos, and leans into properly grokking the language and the “Prolog way” of problem solving.
I’d make a meta point that learning Prolog and forcing yourself to solve problems the “prolog way” serves as a great exercise in understanding the importance of using the right tool for the job, and working with, rather than in spite of , your tools.