Prolog and linear algebra