Factored out common method from XCycles and AlternatingInferenceChains.