Type Synthesis for Ground Prolog