logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.tensors

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
from proveit.core_expr_types import Q__b_1_to_j, a_1_to_i, b_1_to_j, c_1_to_k, f__b_1_to_j
from proveit.linear_algebra import TensorProd, VecSpaces, VecSum
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Forall, Implies, InClass, InSet
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
sub_expr2 = TensorProd(a_1_to_i, f__b_1_to_j, c_1_to_k)
expr = ExprTuple(Lambda(V, Conditional(Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, V), condition = Q__b_1_to_j), Equals(TensorProd(a_1_to_i, vec_summation_b1toj_fQ, c_1_to_k), VecSum(index_or_indices = sub_expr1, summand = sub_expr2, condition = Q__b_1_to_j)).with_wrapping_at(1)).with_wrapping_at(2)).with_wrapping(), InClass(V, VecSpaces(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(V \mapsto \left\{\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k}}~\\
\left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(\left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} f\left(b_{1}, b_{2}, \ldots, b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) \in V\right)\right] \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} \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]{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  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} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} f\left(b_{1}, b_{2}, \ldots, b_{j}\right){\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right)\right] \end{array} \end{array}\right) \end{array} \end{array}\right)\end{array} \textrm{ if } V \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\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
1Lambdaparameter: 38
body: 3
2ExprTuple38
3Conditionalvalue: 4
condition: 5
4Operationoperator: 20
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple38, 10
9Lambdaparameters: 11
body: 12
10Operationoperator: 13
operand: 17
11ExprTuple45, 47
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17
15Literal
16ExprTuple18, 19
17Variable
18Operationoperator: 20
operand: 24
19Operationoperator: 22
operands: 23
20Literal
21ExprTuple24
22Literal
23ExprTuple25, 26
24Lambdaparameters: 52
body: 27
25Operationoperator: 42
operands: 28
26Operationoperator: 35
operand: 32
27Conditionalvalue: 30
condition: 44
28ExprTuple45, 31, 47
29ExprTuple32
30Operationoperator: 33
operands: 34
31Operationoperator: 35
operand: 39
32Lambdaparameters: 52
body: 37
33Literal
34ExprTuple40, 38
35Literal
36ExprTuple39
37Conditionalvalue: 40
condition: 44
38Variable
39Lambdaparameters: 52
body: 41
40Operationoperator: 42
operands: 43
41Conditionalvalue: 46
condition: 44
42Literal
43ExprTuple45, 46, 47
44Operationoperator: 48
operands: 52
45ExprRangelambda_map: 49
start_index: 60
end_index: 50
46Operationoperator: 51
operands: 52
47ExprRangelambda_map: 53
start_index: 60
end_index: 54
48Variable
49Lambdaparameter: 66
body: 55
50Variable
51Variable
52ExprTuple56
53Lambdaparameter: 66
body: 57
54Variable
55IndexedVarvariable: 58
index: 66
56ExprRangelambda_map: 59
start_index: 60
end_index: 61
57IndexedVarvariable: 62
index: 66
58Variable
59Lambdaparameter: 66
body: 63
60Literal
61Variable
62Variable
63IndexedVarvariable: 64
index: 66
64Variable
65ExprTuple66
66Variable