Restriction Grammar in Prolog