The problem of grammatical inference is considered and a number of positive answers to decidability questions obtained. Conditions are prescribed under which it is possible for a machine to infer a grammar (or the best grammar) for even the general rewriting systems.