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, 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 And, Equals, Forall, InSet
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j, k], Conditional(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(), And(InSet(i, Natural), InSet(j, Natural), InSet(k, 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(\left(i, j, k\right) \mapsto \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} \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \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
1Lambdaparameters: 2
body: 3
2ExprTuple42, 57, 46
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 23
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 30
body: 13
10Operationoperator: 16
operands: 14
11Operationoperator: 16
operands: 15
12Operationoperator: 16
operands: 17
13Conditionalvalue: 18
condition: 19
14ExprTuple42, 20
15ExprTuple57, 20
16Literal
17ExprTuple46, 20
18Operationoperator: 21
operands: 22
19Operationoperator: 23
operands: 24
20Literal
21Literal
22ExprTuple25, 26
23Literal
24ExprTuple27, 28, 29
25Operationoperator: 43
operands: 30
26Operationoperator: 43
operands: 31
27ExprRangelambda_map: 32
start_index: 56
end_index: 42
28ExprRangelambda_map: 33
start_index: 56
end_index: 57
29ExprRangelambda_map: 34
start_index: 56
end_index: 46
30ExprTuple35, 51, 37
31ExprTuple35, 36, 37
32Lambdaparameter: 66
body: 38
33Lambdaparameter: 66
body: 39
34Lambdaparameter: 66
body: 40
35ExprRangelambda_map: 41
start_index: 56
end_index: 42
36Operationoperator: 43
operands: 44
37ExprRangelambda_map: 45
start_index: 56
end_index: 46
38Operationoperator: 49
operands: 47
39Operationoperator: 49
operands: 48
40Operationoperator: 49
operands: 50
41Lambdaparameter: 66
body: 52
42Variable
43Literal
44ExprTuple51
45Lambdaparameter: 66
body: 53
46Variable
47ExprTuple52, 54
48ExprTuple62, 54
49Literal
50ExprTuple53, 54
51ExprRangelambda_map: 55
start_index: 56
end_index: 57
52IndexedVarvariable: 58
index: 66
53IndexedVarvariable: 59
index: 66
54Operationoperator: 60
operand: 63
55Lambdaparameter: 66
body: 62
56Literal
57Variable
58Variable
59Variable
60Literal
61ExprTuple63
62IndexedVarvariable: 64
index: 66
63Variable
64Variable
65ExprTuple66
66Variable