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 ExprTuple, K, Lambda, Q, V, f, 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([K, f, Q], Forall(instance_param_or_params = [j], instance_expr = 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)), domain = 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(\left(K, f, Q\right) \mapsto \left[\forall_{j \in \mathbb{N}^+}~\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]\right]\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
1Lambdaparameters: 2
body: 3
2ExprTuple41, 61, 60
3Operationoperator: 18
operand: 5
4ExprTuple5
5Lambdaparameter: 66
body: 7
6ExprTuple66
7Conditionalvalue: 8
condition: 9
8Operationoperator: 18
operand: 12
9Operationoperator: 36
operands: 11
10ExprTuple12
11ExprTuple66, 13
12Lambdaparameter: 35
body: 15
13Literal
14ExprTuple35
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operand: 22
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22
20Literal
21ExprTuple35, 23
22Lambdaparameter: 59
body: 25
23Operationoperator: 26
operand: 41
24ExprTuple59
25Conditionalvalue: 28
condition: 29
26Literal
27ExprTuple41
28Operationoperator: 30
operands: 31
29Operationoperator: 36
operands: 32
30Literal
31ExprTuple33, 34
32ExprTuple59, 35
33Operationoperator: 36
operands: 37
34Operationoperator: 38
operands: 39
35Variable
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple42, 43
40Operationoperator: 45
operand: 52
41Variable
42Operationoperator: 55
operands: 44
43Operationoperator: 45
operand: 48
44ExprTuple47, 59
45Literal
46ExprTuple48
47Operationoperator: 49
operand: 52
48Lambdaparameters: 62
body: 51
49Literal
50ExprTuple52
51Conditionalvalue: 53
condition: 57
52Lambdaparameters: 62
body: 54
53Operationoperator: 55
operands: 56
54Conditionalvalue: 58
condition: 57
55Literal
56ExprTuple58, 59
57Operationoperator: 60
operands: 62
58Operationoperator: 61
operands: 62
59Variable
60Variable
61Variable
62ExprTuple63
63ExprRangelambda_map: 64
start_index: 65
end_index: 66
64Lambdaparameter: 70
body: 67
65Literal
66Variable
67IndexedVarvariable: 68
index: 70
68Variable
69ExprTuple70
70Variable