A study of grammatical inference