def side_effects(self, judgment): ''' In addition to the TransitiveRelation side-effects, also attempt derive_reversed. ''' for side_effect in TransitiveRelation.side_effects(self, judgment): yield side_effect yield self.derive_reversed
def side_effects(self, judgment): ''' Yield the TransitiveRelation side-effects (which also records known_left_sides and known_right_sides). Also derive the left and right implications, derive the reversed version and attempt to derive equality. ''' for side_effect in TransitiveRelation.side_effects(self, judgment): yield side_effect yield self.derive_left_implication # B=>A given A<=>B yield self.derive_right_implication # A=>B given A<=>B yield self.derive_reversed # B<=>A given A<=>B # A=B given A<=>B (assuming A and B are in booleans) yield self.derive_equality
def side_effects(self, judgment): ''' In addition to the TransitiveRelation side-effects, also attempt (where applicable) eliminate_dividen_exponent, eliminate_common_exponent, and eliminate_common_factor. ''' from proveit.numbers import two, Exp, Mult for side_effect in TransitiveRelation.side_effects(self, judgment): yield side_effect # For each of the following, use the default assumptions to # verify some conditions before yielding the side effect method # (i.e. check using .proven() without arguments) # for 2|(b^n), derive 2|b. # (can be generalized to any prime number). if self.lhs == two and isinstance(self.rhs, Exp): try: deduce_number_set(self.rhs.base) deduce_number_set(self.rhs.exponent) except UnsatisfiedPrerequisites: pass if (InSet(self.rhs.base, Integer).proven() and InSet(self.rhs.exponent, Integer).proven()): yield self.eliminate_dividend_exponent # for (a^n)|(b^n) if (isinstance(self.rhs, Exp) and isinstance(self.lhs, Exp) and self.lhs.exponent == self.rhs.exponent): try: deduce_number_set(self.lhs.base) deduce_number_set(self.rhs.base) deduce_number_set(self.lhs.exponent) except UnsatisfiedPrerequisites: pass if (InSet(self.lhs.base, Integer).proven() and InSet(self.rhs.base, Integer).proven() and InSet(self.lhs.exponent, NaturalPos).proven()): yield self.eliminate_common_exponent # for (ka)|(kb) if (isinstance(self.lhs, Mult) and isinstance(self.rhs, Mult)): operands_intersection = (set(self.lhs.operands).intersection( set(self.lhs.operands))) if (len(operands_intersection) > 0): yield self.eliminate_common_factors
def side_effects(self, judgment): ''' Yield the TransitiveRelation side-effects (which also records known_left_sides nd known_right_sides). Also derive the consequent as a side-effect if the antecedent is known to be true (under the "side-effect" assumptions). As a special case, if the consequent is FALSE, do derive_via_contradiction. ''' from proveit.logic.booleans import FALSE for side_effect in TransitiveRelation.side_effects(self, judgment): yield side_effect if self.antecedent.proven(): yield self.derive_consequent # B given A=>B and A if self.consequent == FALSE: # Not(A) given A=>FALSE or A given Not(A)=>FALSE yield self.derive_via_contradiction