logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.scalar_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 Conditional, ExprTuple, K, Lambda, V, k
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import ScalarMult, VecSum
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(k, Conditional(Implies(InSet(vec_summation_b1toj_fQ, V), Equals(ScalarMult(k, vec_summation_b1toj_fQ), VecSum(index_or_indices = [b_1_to_j], summand = ScalarMult(k, f__b_1_to_j), condition = Q__b_1_to_j)).with_wrapping_at(1)).with_wrapping_at(2), InSet(k, K))))
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(k \mapsto \left\{\begin{array}{c} \begin{array}{l} \left(\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] \in V\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(k \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]\right) \\  = \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(k \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right)\right] \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } k \in K\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 32
body: 3
2ExprTuple32
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 12
operands: 8
6Literal
7ExprTuple9, 10
8ExprTuple32, 11
9Operationoperator: 12
operands: 13
10Operationoperator: 14
operands: 15
11Variable
12Literal
13ExprTuple21, 16
14Literal
15ExprTuple17, 18
16Variable
17Operationoperator: 29
operands: 19
18Operationoperator: 23
operand: 22
19ExprTuple32, 21
20ExprTuple22
21Operationoperator: 23
operand: 26
22Lambdaparameters: 36
body: 25
23Literal
24ExprTuple26
25Conditionalvalue: 27
condition: 31
26Lambdaparameters: 36
body: 28
27Operationoperator: 29
operands: 30
28Conditionalvalue: 33
condition: 31
29Literal
30ExprTuple32, 33
31Operationoperator: 34
operands: 36
32Variable
33Operationoperator: 35
operands: 36
34Variable
35Variable
36ExprTuple37
37ExprRangelambda_map: 38
start_index: 39
end_index: 40
38Lambdaparameter: 44
body: 41
39Literal
40Variable
41IndexedVarvariable: 42
index: 44
42Variable
43ExprTuple44
44Variable