logo

Expression of type ExprTuple

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.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, 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, InSet
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]
sub_expr2 = Function(f, sub_expr1)
sub_expr3 = Function(Q, sub_expr1)
expr = ExprTuple(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, Complex), condition = sub_expr3), 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, sub_expr2, c_1_to_k), condition = sub_expr3)).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())
\left(\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in \mathbb{C}\right), \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}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 4
operand: 6
2Operationoperator: 4
operand: 7
3ExprTuple6
4Literal
5ExprTuple7
6Lambdaparameters: 51
body: 8
7Lambdaparameters: 9
body: 10
8Conditionalvalue: 11
condition: 43
9ExprTuple44, 46
10Conditionalvalue: 12
condition: 13
11Operationoperator: 35
operands: 14
12Operationoperator: 15
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple45, 39
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 41
operands: 23
20Operationoperator: 31
operand: 28
21ExprRangelambda_map: 25
start_index: 59
end_index: 49
22ExprRangelambda_map: 26
start_index: 59
end_index: 53
23ExprTuple44, 27, 46
24ExprTuple28
25Lambdaparameter: 65
body: 29
26Lambdaparameter: 65
body: 30
27Operationoperator: 31
operand: 37
28Lambdaparameters: 51
body: 33
29Operationoperator: 35
operands: 34
30Operationoperator: 35
operands: 36
31Literal
32ExprTuple37
33Conditionalvalue: 38
condition: 43
34ExprTuple54, 39
35Literal
36ExprTuple56, 39
37Lambdaparameters: 51
body: 40
38Operationoperator: 41
operands: 42
39Literal
40Conditionalvalue: 45
condition: 43
41Literal
42ExprTuple44, 45, 46
43Operationoperator: 47
operands: 51
44ExprRangelambda_map: 48
start_index: 59
end_index: 49
45Operationoperator: 50
operands: 51
46ExprRangelambda_map: 52
start_index: 59
end_index: 53
47Variable
48Lambdaparameter: 65
body: 54
49Variable
50Variable
51ExprTuple55
52Lambdaparameter: 65
body: 56
53Variable
54IndexedVarvariable: 57
index: 65
55ExprRangelambda_map: 58
start_index: 59
end_index: 60
56IndexedVarvariable: 61
index: 65
57Variable
58Lambdaparameter: 65
body: 62
59Literal
60Variable
61Variable
62IndexedVarvariable: 63
index: 65
63Variable
64ExprTuple65
65Variable