import proveit
# Prepare this notebook for defining the theorems of a theory:
%theorems_notebook # Keep this at the top following 'import proveit'.
from proveit import ExprRange, IndexedVar
from proveit import a, b, k, n, x, y
from proveit.core_expr_types import x_1_to_n
from proveit.logic import Forall, Equals, NotEquals, InSet
from proveit.numbers import zero, one
from proveit.numbers import ZeroSet, Natural, NaturalPos, Integer, IntegerNonZero, IntegerNeg, IntegerNonPos
from proveit.numbers import Rational, RationalNonZero, RationalPos, RationalNeg, RationalNonNeg, RationalNonPos
from proveit.numbers import Real, RealNonZero, RealPos, RealNeg, RealNonNeg, RealNonPos
from proveit.numbers import Complex, ComplexNonZero
from proveit.numbers import Add, Div, Neg, subtract, Mult, Exp, Less, LessEq, greater, greater_eq
%begin theorems
negated_zero = Equals(Neg(zero), zero)
neg_in_zero_set = Forall(a, InSet(Neg(a), ZeroSet), domain=ZeroSet)
nat_closure = Forall(a, InSet(Neg(a), Natural), domain=IntegerNonPos)
nat_pos_closure = Forall(a, InSet(Neg(a), NaturalPos), domain=IntegerNeg)
int_closure = Forall(a, InSet(Neg(a), Integer), domain=Integer)
int_nonzero_closure = Forall(a, InSet(Neg(a), IntegerNonZero), domain=IntegerNonZero)
int_neg_closure = Forall(a, InSet(Neg(a), IntegerNeg), domain=NaturalPos)
int_nonpos_closure = Forall(a, InSet(Neg(a), IntegerNonPos), domain=Natural)
rational_closure = Forall(a, InSet(Neg(a), Rational), domain=Rational)
rational_nonzero_closure = Forall(a, InSet(Neg(a), RationalNonZero), domain=RationalNonZero)
rational_pos_closure = Forall(a, InSet(Neg(a), RationalPos), domain=RationalNeg)
rational_neg_closure = Forall(a, InSet(Neg(a), RationalNeg), domain=RationalPos)
rational_nonneg_closure = Forall(a, InSet(Neg(a), RationalNonNeg), domain=RationalNonPos)
rational_nonpos_closure = Forall(a, InSet(Neg(a), RationalNonPos), domain=RationalNonNeg)
real_closure = Forall(a, InSet(Neg(a), Real), domain=Real)
real_nonzero_closure = Forall(a, InSet(Neg(a), RealNonZero), domain=RealNonZero)
real_pos_closure = Forall(a, InSet(Neg(a), RealPos), domain=RealNeg)
real_neg_closure = Forall(a, InSet(Neg(a), RealNeg), domain=RealPos)
real_nonneg_closure = Forall(a, InSet(Neg(a), RealNonNeg), domain=RealNonPos)
real_nonpos_closure = Forall(a, InSet(Neg(a), RealNonPos), domain=RealNonNeg)
complex_closure = Forall(a, InSet(Neg(a), Complex), domain=Complex)
complex_nonzero_closure = Forall(a, InSet(Neg(a), ComplexNonZero), domain=ComplexNonZero)
negated_positive_is_negative = Forall(a, Less(Neg(a), zero), domain=Real, conditions=[greater(a, zero)])
neg_as_mult_one = Forall(x,Equals(Neg(x), Mult(Neg(one), x)), domain=Complex)
distribute_neg_through_binary_sum = Forall((a, b), Equals(Neg(Add(a, b)), Add(Neg(a), Neg(b))),
domain=Complex)
distribute_neg_through_subtract = Forall((a, b), Equals(Neg(subtract(a, b)), Add(Neg(a), b)),
domain=Complex)
distribute_neg_through_sum = Forall(n, Forall(x_1_to_n, Equals(Neg(Add(x_1_to_n)),
Add(ExprRange(k, Neg(IndexedVar(x, k)), one, n))),
domain=Complex),
domain=NaturalPos)
distribute_neg_through_div_numerator = Forall(
(x, y),
Equals(Neg(Div(x, y)), Div(Neg(x), y)),
domain=Complex,
conditions=[NotEquals(y, zero)])
neg_not_eq_zero = Forall(a, NotEquals(Neg(a), zero), domain=Complex, conditions=[NotEquals(a, zero)])
mult_neg_one_left = Forall(x, Equals(Mult(Neg(one), x), Neg(x)), domain=Complex)
mult_neg_one_right = Forall(x, Equals(Mult(x, Neg(one)), Neg(x)), domain=Complex)
neg_times_pos = Forall([x, y], Equals(Mult(Neg(x), y), Neg(Mult(x, y))), domain=Complex)
pos_times_neg = Forall([x, y], Equals(Mult(x, Neg(y)), Neg(Mult(x, y))), domain=Complex)
neg_times_neg = Forall([x, y], Equals(Mult(Neg(x), Neg(y)), Mult(x, y)), domain=Complex)
double_negation = Forall(x, Equals(Neg(Neg(x)), x), domain=Complex)
negated_weak_bound = Forall((x, y), greater_eq(Neg(x), Neg(y)),
condition=LessEq(x, y), domain=Real)
negated_strong_bound = Forall((x, y), greater(Neg(x), Neg(y)),
condition=Less(x, y), domain=Real)
%end theorems