Logic Learning from Demonstrations for Multi-step Manipulation Tasks in Dynamic Environments