Exemplo n.º 1
0
 def _explanations_implied_by(
     self,
     other: Comparable,
     explanation: Explanation,
 ) -> Iterator[Explanation]:
     """Generate explanations for how other may imply self."""
     reversed = explanation.reversed_context()
     if isinstance(other, Factor):
         other = FactorGroup(other)
     if isinstance(other, FactorGroup):
         yield from other._explanations_implication(self,
                                                    explanation=reversed)
Exemplo n.º 2
0
    def _explanations_contradiction(
            self, other, context: Explanation) -> Iterator[Explanation]:
        self_to_other = self.procedure.explain_contradiction_some_to_all(
            other.procedure, context)
        other_to_self = (
            register.reversed_context()
            for register in other.procedure.explain_contradiction_some_to_all(
                self.procedure, context.reversed_context()))

        if other.universal:
            yield from self_to_other

        if self.universal:
            yield from other_to_self
Exemplo n.º 3
0
 def _implied_by_holding(self, other: Holding,
                         context: Explanation) -> bool:
     return all(
         other.implies(self_holding, context=context.reversed_context())
         for self_holding in self.holdings)