decision procedure for syntactic causality

Including correctness proof and extraction to Haskell.