Extended Lifted Inference with Joint Formulas