Using Causal Analysis to Learn Specifications from Task Demonstrations