Compositional reasoning in robot learning