import proveit
# Prepare this notebook for defining the theorems of a theory:
%theorems_notebook # Keep this at the top following 'import proveit'.
from proveit.logic import Forall, Equals, NotEquals
from proveit import a, b, c, d, e
from proveit.core_expr_types import (
a_1_to_i, b_1_to_j, c_1_to_j, c_1_to_k, d_1_to_k)
from proveit import a, b, c, d, e, f, g, h, i,j,k, l, m, n, x, y
from proveit.numbers import zero, one, two, three
from proveit.numbers import (
Add, Neg, Mult, frac, Exp,
Less, LessEq, greater, greater_eq,
ZeroSet, Natural, NaturalPos,
Integer, IntegerNonZero, IntegerNeg, IntegerNonPos,
Rational, RationalNonZero, RationalPos, RationalNeg,
RationalNonNeg, RationalNonPos,
Real, RealNonZero, RealPos, RealNeg, RealNonNeg, RealNonPos,
Complex, ComplexNonZero)
from proveit.logic.sets import InSet
%begin theorems
unary_add_reduction = Forall(a, Equals(Add(a), a))
add_zero_closure_bin = Forall((a, b), InSet(Add(a, b), ZeroSet), domain=ZeroSet)
add_zero_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),ZeroSet), domain = ZeroSet), domain=Natural)
add_int_closure_bin = Forall((a, b), InSet(Add(a, b), Integer), domain=Integer)
add_int_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),Integer), domain = Integer), domain=Natural)
add_nat_closure_bin = Forall((a, b), InSet(Add(a, b), Natural), domain=Natural)
add_nat_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), Natural), domain=Natural), domain = Natural)
add_nat_pos_closure_bin = Forall((a, b), InSet(Add(a, b), NaturalPos), domain=NaturalPos)
add_nat_pos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), NaturalPos), domain=NaturalPos), domain = NaturalPos)
add_int_neg_closure_bin = Forall((a, b), InSet(Add(a, b), IntegerNeg), domain=IntegerNeg)
add_int_neg_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), IntegerNeg), domain=IntegerNeg), domain = NaturalPos)
add_int_nonpos_closure_bin = Forall((a, b), InSet(Add(a, b), IntegerNonPos), domain=IntegerNonPos)
add_int_nonpos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), IntegerNonPos), domain=IntegerNonPos), domain = Natural)
add_nat_pos_from_nonneg = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), NaturalPos),
domain=Natural,
condition=greater(b, zero)),
domain=Natural)
add_int_neg_from_nonpos = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), IntegerNeg),
domain=IntegerNonPos,
condition=Less(b, zero)),
domain=Natural)
add_rational_closure_bin = Forall((a, b), InSet(Add(a, b), Rational), domain=Rational)
add_rational_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),Rational), domain=Rational),
domain=Natural)
add_rational_nonneg_closure_bin = Forall((a, b), InSet(Add(a, b), RationalNonNeg), domain=RationalNonNeg)
add_rational_nonneg_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), RationalNonNeg),
domain=RationalNonNeg),
domain=Natural)
add_rational_nonpos_closure_bin = Forall((a, b), InSet(Add(a, b), RationalNonPos), domain=RationalNonPos)
add_rational_nonpos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), RationalNonPos),
domain=RationalNonPos),
domain=Natural)
add_rational_pos_closure_bin = Forall((a, b), InSet(Add(a, b), RationalPos), domain=RationalPos)
add_rational_pos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),RationalPos), domain=RationalPos),
domain=Natural)
add_rational_neg_closure_bin = Forall((a, b), InSet(Add(a, b), RationalNeg), domain=RationalPos)
add_rational_neg_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),RationalNeg), domain=RationalNeg),
domain=NaturalPos)
add_rational_pos_from_nonneg = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), RationalPos),
domain=RationalNonNeg,
condition=greater(b, zero)),
domain=Natural)
add_rational_neg_from_nonpos = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), RationalNeg),
domain=RationalNonPos,
condition=Less(b, zero)),
domain=Natural)
add_real_closure_bin = Forall((a, b), InSet(Add(a, b), Real), domain=Real)
add_real_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),Real), domain=Real),
domain=Natural)
add_real_nonneg_closure_bin = Forall((a, b), InSet(Add(a, b), RealNonNeg), domain=RealNonNeg)
add_real_nonneg_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), RealNonNeg),
domain=RealNonNeg),
domain=Natural)
add_real_nonpos_closure_bin = Forall((a, b), InSet(Add(a, b), RealNonPos), domain=RealNonPos)
add_real_nonpos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), RealNonPos),
domain=RealNonPos),
domain=Natural)
add_real_pos_closure_bin = Forall((a, b), InSet(Add(a, b), RealPos), domain=RealPos)
add_real_pos_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),RealPos), domain=RealPos),
domain=NaturalPos)
add_real_neg_closure_bin = Forall((a, b), InSet(Add(a, b), RealNeg), domain=RealNeg)
add_real_neg_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i), RealNeg), domain=RealNeg),
domain=NaturalPos)
add_real_pos_from_nonneg = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), RealPos),
domain=RealNonNeg,
condition=greater(b, zero)),
domain=Natural)
add_real_neg_from_nonpos = Forall((i, j), Forall((a_1_to_i, b, c_1_to_j),
InSet(Add(a_1_to_i, b, c_1_to_j), RealNeg),
domain=RealNonPos,
condition=Less(b, zero)),
domain=Natural)
add_complex_closure_bin = Forall((a, b), InSet(Add(a, b), Complex), domain=Complex)
add_complex_closure = Forall(i, Forall(a_1_to_i, InSet(Add(a_1_to_i),Complex), domain = Complex), domain=Natural)
rational_pair_addition = Forall(
(a, b, c, d), Equals(Add(frac(a, b), frac(c, d)),
frac(Add(Mult(a, d), Mult(b, c)),
Mult(b, d))),
domain=Integer)
left_add_eq_nat = Forall((a, x, y), Equals(Add(a, x), Add(a, y)), condition=Equals(x, y), domain=Natural)
left_add_eq_int = Forall((a, x, y), Equals(Add(a, x), Add(a, y)), condition=Equals(x, y), domain=Integer)
left_add_eq_rational = Forall((a, x, y), Equals(Add(a, x), Add(a, y)), condition=Equals(x, y), domain=Rational)
left_add_eq_real = Forall((a, x, y), Equals(Add(a, x), Add(a, y)), condition=Equals(x, y), domain=Real)
left_add_eq = Forall((a, x, y), Equals(Add(a, x), Add(a, y)), condition=Equals(x, y), domain=Complex)
right_add_eq_nat = Forall((a, x, y), Equals(Add(x, a), Add(y, a)), condition=Equals(x, y), domain=Natural)
right_add_eq_int = Forall((a, x, y), Equals(Add(x, a), Add(y, a)), condition=Equals(x, y), domain=Integer)
right_add_eq_rational = Forall((a, x, y), Equals(Add(x, a), Add(y, a)), condition=Equals(x, y), domain=Rational)
right_add_eq_real = Forall((a, x, y), Equals(Add(x, a), Add(y, a)), condition=Equals(x, y), domain=Real)
right_add_eq = Forall((a, x, y), Equals(Add(x, a), Add(y, a)), condition=Equals(x, y), domain=Complex)
left_add_neq_nat = Forall((a, x, y), NotEquals(Add(a, x), Add(a, y)), condition=NotEquals(x, y), domain=Natural)
left_add_neq_int = Forall((a, x, y), NotEquals(Add(a, x), Add(a, y)), condition=NotEquals(x, y), domain=Integer)
left_add_neq_rational = Forall((a, x, y), NotEquals(Add(a, x), Add(a, y)), condition=NotEquals(x, y), domain=Rational)
left_add_neq_real = Forall((a, x, y), NotEquals(Add(a, x), Add(a, y)), condition=NotEquals(x, y), domain=Real)
left_add_neq = Forall((a, x, y), NotEquals(Add(a, x), Add(a, y)), condition=NotEquals(x, y), domain=Complex)
right_add_neq_nat = Forall((a, x, y), NotEquals(Add(x, a), Add(y, a)), condition=NotEquals(x, y), domain=Natural)
right_add_neq_int = Forall((a, x, y), NotEquals(Add(x, a), Add(y, a)), condition=NotEquals(x, y), domain=Integer)
right_add_neq_rational = Forall((a, x, y), NotEquals(Add(x, a), Add(y, a)), condition=NotEquals(x, y), domain=Rational)
right_add_neq_real = Forall((a, x, y), NotEquals(Add(x, a), Add(y, a)), condition=NotEquals(x, y), domain=Real)
right_add_neq = Forall((a, x, y), NotEquals(Add(x, a), Add(y, a)), condition=NotEquals(x, y), domain=Complex)
strong_bound_via_right_term_bound = (
Forall((a, x, y), Less(Add(a, x), Add(a, y)), condition=Less(x, y), domain=Real))
strong_bound_via_left_term_bound = (
Forall((a, x, y), Less(Add(x, a), Add(y, a)), condition=Less(x, y), domain=Real))
strong_bound_via_term_bound = (
Forall((i, j), Forall((x, y), Forall((a_1_to_i, b_1_to_j),
Less(Add(a_1_to_i, x, b_1_to_j), Add(a_1_to_i, y, b_1_to_j)),
domain=Real, condition=Less(x, y))),
domain=Natural))
weak_bound_via_right_term_bound = (
Forall((a, x, y), LessEq(Add(a, x), Add(a, y)), condition=LessEq(x, y), domain=Real))
weak_bound_via_left_term_bound = (
Forall((a, x, y), LessEq(Add(x, a), Add(y, a)), condition=LessEq(x, y), domain=Real))
weak_bound_via_term_bound = (
Forall((i, j), Forall((x, y), Forall((a_1_to_i, b_1_to_j),
LessEq(Add(a_1_to_i, x, b_1_to_j), Add(a_1_to_i, y, b_1_to_j)),
domain=Real, condition=LessEq(x, y))),
domain=Natural))
elim_zero_left = Forall(a, Equals(Add(zero, a), a), domain=Complex)
elim_zero_right = Forall(a, Equals(Add(a, zero), a), domain=Complex)
elim_zero_any = Forall((i, j), Forall((a_1_to_i, b_1_to_j), Equals(Add(a_1_to_i, zero, b_1_to_j),
Add(a_1_to_i, b_1_to_j)),
domain=Complex),
domain=Natural)
term_as_weak_lower_bound = \
Forall((i,j),
Forall((a_1_to_i, c_1_to_j),
Forall(b, greater_eq(Add(a_1_to_i, b, c_1_to_j), b),
domain=Real),
domain=RealNonNeg),
domain=Natural)
term_as_weak_upper_bound = \
Forall((i,j), Forall((a_1_to_i, c_1_to_j),
Forall(b, LessEq(Add(a_1_to_i, b, c_1_to_j), b),
domain=Real),
domain=RealNonPos),
domain=Natural)
term_as_strong_lower_bound = \
Forall((i,j),
Forall((a_1_to_i, c_1_to_j),
Forall(b, greater(Add(a_1_to_i, b, c_1_to_j), b),
domain=Real),
domain=RealPos),
domain=Natural, condition=greater(Add(i, j), zero))
term_as_strong_upper_bound = \
Forall((i,j), Forall((a_1_to_i, c_1_to_j),
Forall(b, Less(Add(a_1_to_i, b, c_1_to_j), b),
domain=Real),
domain=RealNeg),
domain=Natural, condition=greater(Add(i, j), zero))
strictly_decreasing_additions = \
Forall((i,j), Forall((a_1_to_i, c_1_to_j),
Forall(b, Less(Add(a_1_to_i, b, c_1_to_j), b),
domain=Real),
domain=RealNeg),
domain=Natural)
commutation = Forall((a, b), Equals(Add(a, b), Add(b, a)), domain=Complex)
rightward_commutation = \
Forall((i,j,k),
Forall((a_1_to_i,b,c_1_to_j,d_1_to_k),
Equals(Add(a_1_to_i, b, c_1_to_j, d_1_to_k),
Add(a_1_to_i, c_1_to_j, b, d_1_to_k)) \
.with_wrapping_at(2),
domain=Complex),
domain=Natural)
leftward_commutation = \
Forall((i,j,k),
Forall((a_1_to_i,b_1_to_j,c,d_1_to_k),
Equals(Add(a_1_to_i, b_1_to_j, c, d_1_to_k),
Add(a_1_to_i, c, b_1_to_j, d_1_to_k)) \
.with_wrapping_at(2),
domain = Complex),
domain = Natural)
association = \
Forall((i,j,k),
Forall((a_1_to_i,b_1_to_j,c_1_to_k),
Equals(Add(a_1_to_i, b_1_to_j, c_1_to_k),
Add(a_1_to_i, Add(b_1_to_j), c_1_to_k)) \
.with_wrapping_at(2),
domain=Complex),
domain=Natural)
disassociation = \
Forall((i,j,k),
Forall((a_1_to_i,b_1_to_j,c_1_to_k),
Equals(Add(a_1_to_i, Add(b_1_to_j), c_1_to_k),
Add(a_1_to_i, b_1_to_j, c_1_to_k)) \
.with_wrapping_at(2),
domain=Complex),
domain=Natural)
%end theorems