Пример #1
0
 def deriveCommonConclusion(self, conclusion, assumptions=USE_DEFAULTS):
     '''
     From (A or B) derive and return the provided conclusion C assuming A=>C, B=>C, A,B,C in BOOLEANS.
     '''
     from ._theorems_ import hypotheticalDisjunction
     from proveit.logic import Implies, compose
     # forall_{A in Bool, B in Bool, C in Bool} (A=>C and B=>C) => ((A or B) => C)
     assert len(self.operands) == 2
     leftOperand, rightOperand = self.operands
     leftImplConclusion = Implies(leftOperand, conclusion)
     rightImplConclusion = Implies(rightOperand, conclusion)
     # (A=>C and B=>C) assuming A=>C, B=>C
     compose([leftImplConclusion, rightImplConclusion], assumptions)
     return hypotheticalDisjunction.specialize(
         {
             A: leftOperand,
             B: rightOperand,
             C: conclusion
         },
         assumptions=assumptions).deriveConclusion(
             assumptions).deriveConclusion(assumptions)
Пример #2
0
 def derive_common_conclusion(self, conclusion, assumptions=USE_DEFAULTS):
     '''
     From (A or B) derive and return the provided conclusion C assuming A=>C, B=>C, A,B,C in BOOLEANS.
     '''
     from . import hypothetical_disjunction
     from proveit.logic import Implies, compose
     # forall_{A in Bool, B in Bool, C in Bool} (A=>C and B=>C) => ((A or B)
     # => C)
     assert self.operands.is_double()
     left_operand, right_operand = self.operands
     left_impl_conclusion = Implies(left_operand, conclusion)
     right_impl_conclusion = Implies(right_operand, conclusion)
     # (A=>C and B=>C) assuming A=>C, B=>C
     compose([left_impl_conclusion, right_impl_conclusion], assumptions)
     return hypothetical_disjunction.instantiate(
         {
             A: left_operand,
             B: right_operand,
             C: conclusion
         },
         assumptions=assumptions).derive_conclusion(
             assumptions).derive_conclusion(assumptions)