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, Lambda, V, b
from proveit.core_expr_types import a_1_to_i, c_1_to_k, d_1_to_i, e_1_to_k
from proveit.linear_algebra import TensorProd
from proveit.logic import Equals, Implies, InSet
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(b, Conditional(Implies(Equals(TensorProd(a_1_to_i, c_1_to_k), TensorProd(d_1_to_i, e_1_to_k)).with_wrapping_at(2), Equals(TensorProd(a_1_to_i, b, c_1_to_k), TensorProd(d_1_to_i, b, e_1_to_k)).with_wrapping_at(2)).with_wrapping_at(2), InSet(b, V))))
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(b \mapsto \left\{\begin{array}{c} \begin{array}{l} \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i}{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i}{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(a_{1} {\otimes}  a_{2} {\otimes}  \ldots {\otimes}  a_{i} {\otimes} b{\otimes} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i} {\otimes} b{\otimes} e_{1} {\otimes}  e_{2} {\otimes}  \ldots {\otimes}  e_{k}\right) \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } b \in V\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: 28
body: 3
2ExprTuple28
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple28, 12
10Operationoperator: 14
operands: 13
11Operationoperator: 14
operands: 15
12Variable
13ExprTuple16, 17
14Literal
15ExprTuple18, 19
16Operationoperator: 23
operands: 20
17Operationoperator: 23
operands: 21
18Operationoperator: 23
operands: 22
19Operationoperator: 23
operands: 24
20ExprTuple25, 26
21ExprTuple27, 29
22ExprTuple25, 28, 26
23Literal
24ExprTuple27, 28, 29
25ExprRangelambda_map: 30
start_index: 35
end_index: 33
26ExprRangelambda_map: 31
start_index: 35
end_index: 36
27ExprRangelambda_map: 32
start_index: 35
end_index: 33
28Variable
29ExprRangelambda_map: 34
start_index: 35
end_index: 36
30Lambdaparameter: 46
body: 37
31Lambdaparameter: 46
body: 38
32Lambdaparameter: 46
body: 39
33Variable
34Lambdaparameter: 46
body: 40
35Literal
36Variable
37IndexedVarvariable: 41
index: 46
38IndexedVarvariable: 42
index: 46
39IndexedVarvariable: 43
index: 46
40IndexedVarvariable: 44
index: 46
41Variable
42Variable
43Variable
44Variable
45ExprTuple46
46Variable