def conclude(self, assumptions): from proveit.logic import InSet, NotEquals from proveit.numbers import (Rational, RationalNonZero, RationalPos, RationalNeg, RationalNonNeg, Less, greater, greater_eq, zero) # If we known the element is in Q, we may be able to # prove that is in RationalNonZero, RationalPos, RationalNeg, or # RationalNonNeg if we know its relation to zero. if (self.number_set != Rational and InSet(self.element, Rational).proven(assumptions)): if self.number_set == RationalNonZero: if NotEquals(self.element, zero).proven(assumptions): from . import non_zero_rational_is_rational_non_zero return non_zero_rational_is_rational_non_zero.instantiate( {q: self.element}, assumptions=assumptions) if self.number_set == RationalPos: if greater(self.element, zero).proven(assumptions): from . import positive_rational_is_rational_pos return positive_rational_is_rational_pos.instantiate( {q: self.element}, assumptions=assumptions) if self.number_set == RationalNeg: if Less(self.element, zero).proven(): from . import negative_rational_is_rational_neg return negative_rational_is_rational_neg.instantiate( {q: self.element}, assumptions=assumptions) if self.number_set == RationalNonNeg: if greater_eq(self.element, zero).proven(): from . import non_neg_rational_in_rational_neg return non_neg_rational_in_rational_neg.instantiate( {q: self.element}, assumptions=assumptions) # Resort to the default NumberMembership.conclude strategies. return NumberMembership.conclude(self, assumptions)
def conclude(self, **defaults_config): from proveit.logic import NotEquals, InSet from proveit.numbers import zero if (InSet(self.element, Complex).proven() and NotEquals(self.element, zero).proven()): return self.conclude_as_last_resort() return NumberMembership.conclude(self)
def conclude(self, **defaults_config): from proveit import ProofFailure from . import n_in_digits # if we know the element is 0-9, then we can show it is a digit try: return NumberMembership.conclude(self) except ProofFailure: return n_in_digits.instantiate({n: self.element})
def conclude(self, assumptions=USE_DEFAULTS): from proveit import ProofFailure from . import n_in_digits # if we know the element is 0-9, then we can show it is a digit try: return NumberMembership.conclude(self, assumptions=assumptions) except ProofFailure: return n_in_digits.instantiate({n: self.element}, assumptions=assumptions)
def conclude(self, **defaults_config): if (InSet(self.element, Integer).proven() and NotEquals(self.element, zero).proven()): return self.conclude_as_last_resort() return NumberMembership.conclude(self)
def __init__(self, element): NumberMembership.__init__(self, element, IntegerNonZero)
def __init__(self, element, number_set): NumberMembership.__init__(self, element, number_set)
def __init__(self, element): NumberMembership.__init__(self, element, RealNonZero)
def conclude(self, **defaults_config): from proveit.numbers import zero, LessEq if (InSet(self.element, Real).proven() and LessEq(self.element, zero).proven()): return self.conclude_as_last_resort() return NumberMembership.conclude(self)
def __init__(self, element): NumberMembership.__init__(self, element, RealPos)
def __init__(self, element, domain): NumberMembership.__init__(self, element, domain) self.domain = domain
def conclude(self, **defaults_config): from proveit.numbers import Rational, zero if (InSet(self.element, Rational).proven() and NotEquals(self.element, zero).proven()): return self.conclude_as_last_resort() return NumberMembership.conclude(self)
def __init__(self, element): NumberMembership.__init__(self, element, ComplexNonZero)