Montague grammar and the well-formedness constraint