Given a large corpus of logs, The Mystery Machine uses iterative refinement to infer causal relationships. It first generates all possible hypotheses for casual relationships among segments(tasks). Then, it iterates through the traces and rejects a hypothesis if it finds a counterexample in any trace, based on happens-before, mutual exclusion, and pipeline. The nice thing about The Mystery Machine is that it discovers causal relationships/dependencies between segments automatically, which is critical for services that evolve quickly and constantly.