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 ExprTuple, K, Lambda, i, j, k
from proveit.core_expr_types import A_1_to_i, B_1_to_j, C_1_to_k
from proveit.linear_algebra import TensorProd, VecSpaces
from proveit.logic import Equals, Forall
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(K, Forall(instance_param_or_params = [i, j, k], instance_expr = Forall(instance_param_or_params = [A_1_to_i, B_1_to_j, C_1_to_k], instance_expr = Equals(TensorProd(A_1_to_i, B_1_to_j, C_1_to_k), TensorProd(A_1_to_i, TensorProd(B_1_to_j), C_1_to_k)).with_wrapping_at(1), domain = VecSpaces(K)).with_wrapping(), domain = Natural)))
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[\forall_{i, j, k \in \mathbb{N}}~\left[\begin{array}{l}\forall_{A_{1}, A_{2}, \ldots, A_{i}, B_{1}, B_{2}, \ldots, B_{j}, C_{1}, C_{2}, \ldots, C_{k} \underset{{\scriptscriptstyle c}}{\in} \textrm{VecSpaces}\left(K\right)}~\\
\left(\begin{array}{c} \begin{array}{l} \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i}{\otimes} B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}{\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \\  = \left(A_{1} {\otimes}  A_{2} {\otimes}  \ldots {\otimes}  A_{i} {\otimes} \left(B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{j}\right){\otimes} C_{1} {\otimes}  C_{2} {\otimes}  \ldots {\otimes}  C_{k}\right) \end{array} \end{array}\right)\end{array}\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: 66
body: 2
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple45, 60, 49
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 26
operands: 11
9Literal
10ExprTuple12
11ExprTuple13, 14, 15
12Lambdaparameters: 33
body: 16
13Operationoperator: 19
operands: 17
14Operationoperator: 19
operands: 18
15Operationoperator: 19
operands: 20
16Conditionalvalue: 21
condition: 22
17ExprTuple45, 23
18ExprTuple60, 23
19Literal
20ExprTuple49, 23
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23Literal
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple30, 31, 32
28Operationoperator: 46
operands: 33
29Operationoperator: 46
operands: 34
30ExprRangelambda_map: 35
start_index: 59
end_index: 45
31ExprRangelambda_map: 36
start_index: 59
end_index: 60
32ExprRangelambda_map: 37
start_index: 59
end_index: 49
33ExprTuple38, 54, 40
34ExprTuple38, 39, 40
35Lambdaparameter: 69
body: 41
36Lambdaparameter: 69
body: 42
37Lambdaparameter: 69
body: 43
38ExprRangelambda_map: 44
start_index: 59
end_index: 45
39Operationoperator: 46
operands: 47
40ExprRangelambda_map: 48
start_index: 59
end_index: 49
41Operationoperator: 52
operands: 50
42Operationoperator: 52
operands: 51
43Operationoperator: 52
operands: 53
44Lambdaparameter: 69
body: 55
45Variable
46Literal
47ExprTuple54
48Lambdaparameter: 69
body: 56
49Variable
50ExprTuple55, 57
51ExprTuple65, 57
52Literal
53ExprTuple56, 57
54ExprRangelambda_map: 58
start_index: 59
end_index: 60
55IndexedVarvariable: 61
index: 69
56IndexedVarvariable: 62
index: 69
57Operationoperator: 63
operand: 66
58Lambdaparameter: 69
body: 65
59Literal
60Variable
61Variable
62Variable
63Literal
64ExprTuple66
65IndexedVarvariable: 67
index: 69
66Variable
67Variable
68ExprTuple69
69Variable