Analytical goal-driven learning of procedural knowledge by observation