Did you know? SWI-Prolog has an interface to FANN, a foss Neural Net librarySearch Documentation:
SWI-Prolog owl logoPredicate flatten/2