# Theorems (or conjectures) for the theory of proveit.numbers.division¶

In [1]:
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, InSet, Equals, NotEquals, Implies
from proveit.numbers import (Integer, NaturalPos, Rational,
RationalNonZero, RationalPos, RationalNonNeg,
Real, RealPos, RealNeg, RealNonPos, RealNonNeg,
Complex, ComplexNonZero)
from proveit.numbers import Div, frac, Add, subtract, Sum, Mult, Exp, zero, one
from proveit.numbers import Less, LessEq, greater, greater_eq, number_ordering
from proveit import a, b, c, d, e, n, w, x, y, z, P, S #, w_multi, x_multi, y_multi, z_multi, w_etc, x_etc, y_etc, z_etc, Py_etc

In [2]:
%begin theorems

Defining theorems for theory 'proveit.numbers.division'
Subsequent end-of-cell assignments will define theorems
'%end theorems' will finalize the definitions

In [3]:
div_rational_closure = Forall(
[a, b],
InSet(frac(a, b), Rational),
domain=Rational,
conditions=[NotEquals(b, zero)])

Out[3]:
div_rational_closure (conjecture without proof):

In [4]:
div_rational_non_zero_closure = Forall(
[a, b],
InSet(frac(a, b), RationalNonZero),
domain=RationalNonZero)

Out[4]:
div_rational_non_zero_closure (conjecture without proof):

In [5]:
div_rational_pos_closure = Forall(
[a, b],
InSet(frac(a, b), RationalPos),
domain=RationalPos)

Out[5]:
div_rational_pos_closure (conjecture without proof):

In [6]:
div_rational_non_neg_closure = Forall(
[a, b],
InSet(frac(a, b), RationalNonNeg),
domains=(RationalNonNeg, RationalPos))

Out[6]:
div_rational_non_neg_closure (conjecture without proof):

In [7]:
div_real_closure = Forall(
[a, b],
InSet(frac(a, b), Real),
domain=Real,
conditions=[NotEquals(b, zero)])

Out[7]:
div_real_closure (conjecture without proof):

In [8]:
divide_real_pos_closure = Forall([a, b], InSet(frac(a, b), RealPos), domain=RealPos, conditions=[NotEquals(b, zero)])

Out[8]:
divide_real_pos_closure (conjecture without proof):

In [9]:
divide_complex_closure = Forall([a, b], InSet(frac(a, b), Complex), domain=Complex, conditions=[NotEquals(b, zero)])

Out[9]:
divide_complex_closure (conjecture without proof):

In [10]:
frac_not_eq_zero = Forall([a, b], NotEquals(frac(a,b), zero), domain=ComplexNonZero)

Out[10]:
frac_not_eq_zero (conjecture without proof):

In [11]:
frac_zero_numer = Forall(
x, Equals(frac(zero, x), zero), domain=Complex,
conditions=[NotEquals(x, zero)])

Out[11]:
frac_zero_numer (conjecture without proof):

In [12]:
frac_one_denom = Forall(x, Equals(frac(x, one), x), domain=Complex)

Out[12]:
frac_one_denom (conjecture without proof):

### Equals and not equals¶

In [13]:
div_eq = Forall((a, x, y), Equals(frac(x, a), frac(y, a)),
conditions=[Equals(x, y), NotEquals(a, zero)], domain=Complex)

Out[13]:
div_eq (conjecture without proof):

In [14]:
div_neq = Forall((a, x, y), NotEquals(frac(x, a), frac(y, a)),
conditions=[NotEquals(x, y), NotEquals(a, zero)], domain=Complex)

Out[14]:
div_neq (conjecture without proof):

### Bounding division¶

In [15]:
strong_div_from_numer_bound__pos_denom = Forall((a, x, y), Less(frac(x, a), frac(y, a)),
conditions=[Less(x, y), greater(a, zero)], domain=Real)

Out[15]:
strong_div_from_numer_bound__pos_denom (conjecture without proof):

In [16]:
weak_div_from_numer_bound__pos_denom = Forall(
(a, x, y), LessEq(frac(x, a), frac(y, a)),
conditions=[LessEq(x, y), greater(a, zero)], domain=Real)

Out[16]:
weak_div_from_numer_bound__pos_denom (conjecture without proof):

In [17]:
strong_div_from_numer_bound__neg_denom = Forall(
(a, x, y), greater(frac(x, a), frac(y, a)),
conditions=[Less(x, y), Less(a, zero)], domain=Real)

Out[17]:
strong_div_from_numer_bound__neg_denom (conjecture without proof):

In [18]:
weak_div_from_numer_bound__neg_denom = Forall(
(a, x, y), greater_eq(frac(x, a), frac(y, a)),
conditions=[LessEq(x, y), Less(a, zero)], domain=Real)

Out[18]:
weak_div_from_numer_bound__neg_denom (conjecture without proof):

In [19]:
strong_div_from_denom_bound__all_pos = Forall(
(a, x, y), greater(frac(a, x), frac(a, y)),
condition=Less(x, y), domain=RealPos)

Out[19]:
strong_div_from_denom_bound__all_pos (conjecture without proof):

In [20]:
weak_div_from_denom_bound__all_pos = Forall(
a, Forall((x, y), greater_eq(frac(a, x), frac(a, y)),
condition=LessEq(x, y), domain=RealPos),
domain=RealNonNeg)

Out[20]:
weak_div_from_denom_bound__all_pos (conjecture without proof):

In [21]:
strong_div_from_denom_bound__all_neg = Forall(
(a, x, y), Less(frac(a, x), frac(a, y)),
condition=Less(x, y), domain=RealNeg)

Out[21]:
strong_div_from_denom_bound__all_neg (conjecture without proof):

In [22]:
weak_div_from_denom_bound__all_neg = Forall(
a, Forall((x, y), LessEq(frac(a, x), frac(a, y)),
condition=LessEq(x, y), domain=RealNeg),
domain=RealNonPos)

Out[22]:
weak_div_from_denom_bound__all_neg (conjecture without proof):

In [23]:
strong_div_from_denom_bound__neg_over_pos = Forall(
a, Forall((x, y), Less(frac(a, x), frac(a, y)),
condition=Less(x, y), domain=RealPos),
domain=RealNeg)

Out[23]:
strong_div_from_denom_bound__neg_over_pos (conjecture without proof):

In [24]:
weak_div_from_denom_bound__neg_over_pos = Forall(
a, Forall((x, y), LessEq(frac(a, x), frac(a, y)),
condition=LessEq(x, y), domain=RealPos),
domain=RealNonPos)

Out[24]:
weak_div_from_denom_bound__neg_over_pos (conjecture without proof):

In [25]:
strong_div_from_denom_bound__pos_over_neg = Forall(
a, Forall((x, y), greater(frac(a, x), frac(a, y)),
condition=Less(x, y), domain=RealNeg),
domain=RealPos)

Out[25]:
strong_div_from_denom_bound__pos_over_neg (conjecture without proof):

In [26]:
weak_div_from_denom_bound__pos_over_neg = Forall(
a, Forall((x, y), greater_eq(frac(a, x), frac(a, y)),
condition=LessEq(x, y), domain=RealNeg),
domain=RealNonNeg)

Out[26]:
weak_div_from_denom_bound__pos_over_neg (conjecture without proof):

In [27]:
"""
distribute_fraction_through_sum = Forall([x_multi, y],
domain=Complex, conditions=[NotEquals(y, zero)])
"""

Out[27]:
'\ndistribute_fraction_through_sum = Forall([x_multi, y], \n                                      Equals(frac(Add(x_etc), y),\n                                             Add(Etcetera(frac(x_multi, y)))), \n                                      domain=Complex, conditions=[NotEquals(y, zero)])\n'
In [28]:
"""
distribute_fraction_through_subtract = Forall([x, y, z],
Equals(frac(Sub(x, y), z),
Sub(frac(x, z), frac(y, z))),
domain=Complex, conditions=[NotEquals(z, zero)])
"""

Out[28]:
'\ndistribute_fraction_through_subtract = Forall([x, y, z], \n                                          Equals(frac(Sub(x, y), z),\n                                                 Sub(frac(x, z), frac(y, z))), \n                                          domain=Complex, conditions=[NotEquals(z, zero)])\n'
In [29]:
"""
distribute_fraction_through_summation = Forall([P, S],
Implies(Forall(y_multi, InSet(Py_etc, Complex), domain=S),
Forall(z,
Equals(frac(Sum(y_multi, Py_etc, domain=S), z),
Sum(y_multi, frac(Py_etc, z), domain=S)),
domain=Complex)))
"""

Out[29]:
'\ndistribute_fraction_through_summation = Forall([P, S],\n                                    Implies(Forall(y_multi, InSet(Py_etc, Complex), domain=S),\n                                            Forall(z,\n                                                   Equals(frac(Sum(y_multi, Py_etc, domain=S), z),\n                                                          Sum(y_multi, frac(Py_etc, z), domain=S)),\n                                                  domain=Complex)))\n'
In [30]:
"""
frac_in_prod = Forall([w_multi, x, y, z_multi], Equals(Mult(w_etc, frac(x, y), z_etc),
frac(Mult(w_etc, x, z_etc), y)), domain=Complex)
"""

Out[30]:
'\nfrac_in_prod = Forall([w_multi, x, y, z_multi], Equals(Mult(w_etc, frac(x, y), z_etc),\n                                                   frac(Mult(w_etc, x, z_etc), y)), domain=Complex)\n'

We certainly should not be able to cancel when there is division by zero. However, equivalences when both sides have zero in the denominator could be okay if we have axioms that allow us to treat division flexibly -- both sides are undefined.

In [31]:
mult_frac_right = Forall([x, y, z], Equals(Mult(x, frac(y, z)),
frac(Mult(x, y), z)),
domain=Complex, condition=NotEquals(z, zero))

Out[31]:
mult_frac_right (conjecture without proof):

In [32]:
mult_frac_left = Forall([x, y, z], Equals(Mult(frac(x, z), y),
frac(Mult(x, y), z)),
domain=Complex, condition=NotEquals(z, zero))

Out[32]:
mult_frac_left (conjecture without proof):

In [33]:
prod_of_fracs = Forall((x, y), Forall((z, w),
Equals(Mult(frac(x, z), frac(y, w)),
frac(Mult(x, y), Mult(z, w))),
domain=ComplexNonZero),
domain=Complex)

Out[33]:
prod_of_fracs (conjecture without proof):

In [34]:
frac_cancel_left = Forall((x, z), Forall(y,
Equals(frac(Mult(x,y),Mult(x,z)),
frac(y,z)),
domain=Complex),
domain=ComplexNonZero)

Out[34]:
frac_cancel_left (conjecture without proof):

In [35]:
frac_cancel_denom_left = Forall([x,y],
Equals(frac(Mult(x,y),x), y),
domain=Complex, conditions=[NotEquals(x, zero)])

Out[35]:
frac_cancel_denom_left (conjecture without proof):

In [36]:
frac_cancel_numer_left = Forall([x,y],
Equals(frac(x,Mult(x,y)),
frac(one,y)),
domain=ComplexNonZero)

Out[36]:
frac_cancel_numer_left (conjecture without proof):

In [37]:
mult_frac_cancel_numer_left = Forall(
(a, d), Forall((b, c, e),
Equals(Mult(frac(Mult(a, b), c), frac(d, Mult(b, e))),
Mult(frac(a, c), frac(d, e))),
domain=ComplexNonZero),
domain=Complex)

Out[37]:
mult_frac_cancel_numer_left (conjecture without proof):

In [38]:
mult_frac_cancel_denom_left = Forall(
(a, d), Forall((b, c, e), Equals(Mult(frac(a, Mult(b, c)),
frac(Mult(c, d), e)),
Mult(frac(a, b), frac(d, e))),
domain=ComplexNonZero),
domain=Complex)

Out[38]:
mult_frac_cancel_denom_left (conjecture without proof):

In [39]:
# mult_frac_left_cancel = Forall([x,y],
#                       Equals(Mult(frac(x,y),y),x),
#                       domain = Complex, conditions = [NotEquals(y, zero)])

In [40]:
# mult_frac_left_partial_cancel = Forall(
#     [x,y,z], Equals(Mult(frac(x,Mult(y, z)),z),frac(x, y)),
#     domain = Complex, conditions = [NotEquals(y, zero), NotEquals(z, zero)])

In [41]:
# mult_frac_right_cancel = Forall([x,y],
#                              Equals(Mult(x, frac(y, x)),y),
#                              domain = Complex, conditions = [NotEquals(x, zero)])

In [42]:
# mult_frac_right_partical_cancel = Forall(
#     [x,y, z], Equals(Mult(x, frac(y, Mult(x, z))),frac(y, z)),
#     domain = Complex, conditions = [NotEquals(x, zero)])

In [43]:
frac_cancel_complete = Forall(x, Equals(frac(x, x), one),
domain=Complex, conditions = [NotEquals(x, zero)])

Out[43]:
frac_cancel_complete (conjecture without proof):

In [44]:
reverse_fraction_of_subtractions = Forall(
[w, x, y, z], Equals(frac(subtract(w, x), subtract(y, z)),
frac(subtract(x, w), subtract(z, y))),
domain=Complex, condition=NotEquals(y, z))

Out[44]:
reverse_fraction_of_subtractions (conjecture without proof):

In [45]:
# frac_int_exp = Forall(n, Forall((a, b),
#                               Equals(frac(Exp(a, n), Exp(b, n)),
#                                      Exp(frac(a, b), n)),
#                              conditions = [NotEquals(a, zero), NotEquals(b, zero)]),
#                     domain=Integer)

In [46]:
# frac_nat_pos_exp = Forall(n, Forall((a, b),
#                               Equals(frac(Exp(a, n), Exp(b, n)),
#                                      Exp(frac(a, b), n)),
#                              conditions = [NotEquals(b, zero)]),
#                     domain=NaturalPos)

In [47]:
%end theorems

These theorems may now be imported from the theory package: proveit.numbers.division