Mathematical theory on formation of category detecting nerve cells