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, j, v
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, VecSpaces, VecSum
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import NaturalPos, Sum
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
expr = ExprTuple(Lambda(j, Conditional(Forall(instance_param_or_params = [V], instance_expr = Forall(instance_param_or_params = [v], instance_expr = Implies(InSet(vec_summation_b1toj_fQ, K), Equals(ScalarMult(Sum(index_or_indices = sub_expr1, summand = f__b_1_to_j, condition = Q__b_1_to_j), v), VecSum(index_or_indices = sub_expr1, summand = ScalarMult(f__b_1_to_j, v), condition = Q__b_1_to_j)).with_wrapping_at(1)).with_wrapping_at(2), domain = V), domain = VecSpaces(K)), InSet(j, NaturalPos))))
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(j \mapsto \left\{\forall_{V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\left[\forall_{v \in V}~\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 K\right) \Rightarrow  \\ \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] \cdot v\right) \\  = \left[\sum_{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) \cdot v\right)\right] \end{array} \end{array}\right) \end{array} \end{array}\right)\right] \textrm{ if } j \in \mathbb{N}^+\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: 62
body: 3
2ExprTuple62
3Conditionalvalue: 4
condition: 5
4Operationoperator: 14
operand: 8
5Operationoperator: 32
operands: 7
6ExprTuple8
7ExprTuple62, 9
8Lambdaparameter: 31
body: 11
9Literal
10ExprTuple31
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 18
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18
16Literal
17ExprTuple31, 19
18Lambdaparameter: 55
body: 21
19Operationoperator: 22
operand: 37
20ExprTuple55
21Conditionalvalue: 24
condition: 25
22Literal
23ExprTuple37
24Operationoperator: 26
operands: 27
25Operationoperator: 32
operands: 28
26Literal
27ExprTuple29, 30
28ExprTuple55, 31
29Operationoperator: 32
operands: 33
30Operationoperator: 34
operands: 35
31Variable
32Literal
33ExprTuple36, 37
34Literal
35ExprTuple38, 39
36Operationoperator: 41
operand: 48
37Variable
38Operationoperator: 51
operands: 40
39Operationoperator: 41
operand: 44
40ExprTuple43, 55
41Literal
42ExprTuple44
43Operationoperator: 45
operand: 48
44Lambdaparameters: 58
body: 47
45Literal
46ExprTuple48
47Conditionalvalue: 49
condition: 53
48Lambdaparameters: 58
body: 50
49Operationoperator: 51
operands: 52
50Conditionalvalue: 54
condition: 53
51Literal
52ExprTuple54, 55
53Operationoperator: 56
operands: 58
54Operationoperator: 57
operands: 58
55Variable
56Variable
57Variable
58ExprTuple59
59ExprRangelambda_map: 60
start_index: 61
end_index: 62
60Lambdaparameter: 66
body: 63
61Literal
62Variable
63IndexedVarvariable: 64
index: 66
64Variable
65ExprTuple66
66Variable