Conditional independence structure and its closure: Inferential rules and algorithms