예제 #1
0
 def sideEffects(self, knownTruth):
     '''
     Yield side-effect methods to try when the element is proven to be in the set of Booleans
     by calling 'inBoolSideEffects' on the element if it has such a method.
     '''
     from proveit.logic.boolean._theorems_ import unfoldInBool
     if hasattr(self.element, 'inBoolSideEffects'):
         for sideEffect in self.element.inBoolSideEffects(knownTruth):
             yield sideEffect
     # don't automatically do unfoldInBoolExplicit if unfoldInBool is unusable -- avoids infinite recursion
     if unfoldInBool.isUsable():
         yield self.unfold
예제 #2
0
 def unfold(self, assumptions=USE_DEFAULTS):
     '''
     From inBool(Element), derive and return [element or not(element)] if
     unfoldInBool is usable.  It it is not, instead try to derive and return
     [(element=TRUE) or (element=FALSE)].
     '''
     from ._theorems_ import unfoldInBool, unfoldInBoolExplicit
     if unfoldInBool.isUsable():
         #  [element or not(element)] assuming inBool(element)
         return unfoldInBool.specialize({A:self.element}, assumptions=assumptions)
     else:
         #  [(element = TRUE) or (element = FALSE)] assuming inBool(element)
         return unfoldInBoolExplicit.specialize({A:self.element}, assumptions=assumptions)