# from the theory of proveit.numbers.multiplication¶

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
# import Expression classes needed to build the expression
from proveit import Function, Q, f
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import Equals, Forall
from proveit.numbers import Complex, Mult, Sum
from proveit.numbers.summation import summation_b1toj_fQ

In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
expr = Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Equals(Mult(a_1_to_i, summation_b1toj_fQ, c_1_to_k), Sum(index_or_indices = sub_expr1, summand = Mult(a_1_to_i, Function(f, sub_expr1), c_1_to_k), condition = Function(Q, sub_expr1))).with_wrapping_at(2), domain = Complex).with_wrapping()

expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")

Passed sanity check: expr matches stored_expr

In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())

\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right] \end{array} \end{array}\right)\end{array}

In [5]:
stored_expr.style_options()

namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneTrue('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple37, 39
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15
12Operationoperator: 34
operands: 16
13Operationoperator: 24
operand: 21
14ExprRangelambda_map: 18
start_index: 52
end_index: 42
15ExprRangelambda_map: 19
start_index: 52
end_index: 46
16ExprTuple37, 20, 39
17ExprTuple21
18Lambdaparameter: 58
body: 22
19Lambdaparameter: 58
body: 23
20Operationoperator: 24
operand: 30
21Lambdaparameters: 44
body: 26
22Operationoperator: 28
operands: 27
23Operationoperator: 28
operands: 29
24Literal
25ExprTuple30
26Conditionalvalue: 31
condition: 36
27ExprTuple47, 32
28Literal
29ExprTuple49, 32
30Lambdaparameters: 44
body: 33
31Operationoperator: 34
operands: 35
32Literal
33Conditionalvalue: 38
condition: 36
34Literal
35ExprTuple37, 38, 39
36Operationoperator: 40
operands: 44
37ExprRangelambda_map: 41
start_index: 52
end_index: 42
38Operationoperator: 43
operands: 44
39ExprRangelambda_map: 45
start_index: 52
end_index: 46
40Variable
41Lambdaparameter: 58
body: 47
42Variable
43Variable
44ExprTuple48
45Lambdaparameter: 58
body: 49
46Variable
47IndexedVarvariable: 50
index: 58
48ExprRangelambda_map: 51
start_index: 52
end_index: 53
49IndexedVarvariable: 54
index: 58
50Variable
51Lambdaparameter: 58
body: 55
52Literal
53Variable
54Variable
55IndexedVarvariable: 56
index: 58
56Variable
57ExprTuple58
58Variable