naive ruby implementation of Prolog