Пример #1
0
    def _explanations_contradiction(
        self,
        other: Comparable,
        explanation: Explanation,
    ) -> Iterator[Explanation]:
        """Find contexts that would cause ``self`` to contradict ``other``."""

        explanation.operation = contradicts

        if isinstance(other, FactorGroup):
            for other_factor in other:
                yield from self._explain_contradicts_factor(
                    other_factor, explanation=explanation)
        else:
            yield from self._explain_contradicts_factor(
                other, explanation=explanation)
Пример #2
0
    def _explanations_implication(
        self,
        other: Comparable,
        explanation: Explanation,
    ) -> Iterator[Explanation]:
        """Find contexts that would cause ``self`` to imply ``other``."""

        explanation.operation = operator.ge

        if isinstance(other, FactorGroup):
            yield from self._verbose_comparison(
                still_need_matches=list(other.sequence),
                explanation=explanation,
            )
        elif isinstance(other, Factor):
            yield from self._verbose_comparison(
                still_need_matches=[other],
                explanation=explanation,
            )