Keep the gradient flowing

Logic modules in python

As a prerequisite of my GSOC project I have to do some modifications on sympy's current logic module (see previous post), so I decided to go out and take a look at what others are doing in this area. aima-python is a project that tries to implement all algorithms found in the excellent book AI: A Modern Approach (AIMA for short). Code is concise and well written, but is has some (solvable) incompatibilities with SymPy's design. In this module, all logic expressions (no matter if it's and, or, xor etc) are implemented as an Expr class, but in SymPy we prefer to have a base class and implement logic expressions (And, Or, etc.) as subclasses, as this has proven to be a good modularization technique sympy's core objects (Add, Mul, etc.). The book is also my primary source of information, as I only learned very rudimentary logic at college. Pylog is a very interesting project implementing a logic module (although it's primary goal is to write a Prolog interpreter in Python). It's logic module seems to be written in a fashion very similar to SymPy's standards, with a term class and variables predicates deriving from this. Makes extensive use of python generators, something that is lacking in my Python knowledge (and shouldn't!)