Siamese recurrent networks learn first-order logic reasoning and exhibit zero-shot compositional generalization