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, e
from proveit.core_expr_types import a_1_to_i, c_1_to_k, d_1_to_i, f_1_to_k
from proveit.linear_algebra import TensorProd, VecZero
from proveit.logic import And, Equals, Implies, InSet, NotEquals
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([b, e], Conditional(Implies(Equals(TensorProd(a_1_to_i, b, c_1_to_k), TensorProd(d_1_to_i, e, f_1_to_k)).with_wrapping_at(2), Equals(TensorProd(a_1_to_i, c_1_to_k), TensorProd(d_1_to_i, f_1_to_k)).with_wrapping_at(2)).with_wrapping_at(2), And(InSet(b, V), InSet(e, V), Equals(b, e), NotEquals(b, VecZero(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(\left(b, e\right) \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} 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} e{\otimes} f_{1} {\otimes}  f_{2} {\otimes}  \ldots {\otimes}  f_{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} c_{1} {\otimes}  c_{2} {\otimes}  \ldots {\otimes}  c_{k}\right) =  \\ \left(d_{1} {\otimes}  d_{2} {\otimes}  \ldots {\otimes}  d_{i}{\otimes} f_{1} {\otimes}  f_{2} {\otimes}  \ldots {\otimes}  f_{k}\right) \end{array} \end{array}\right) \end{array} \end{array} \textrm{ if } b \in V ,  e \in V ,  b = e ,  b \neq \vec{0}\left(V\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: 21
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12, 13, 14
9Operationoperator: 20
operands: 15
10Operationoperator: 20
operands: 16
11Operationoperator: 18
operands: 17
12Operationoperator: 18
operands: 19
13Operationoperator: 20
operands: 21
14Operationoperator: 22
operands: 23
15ExprTuple24, 25
16ExprTuple26, 27
17ExprTuple36, 42
18Literal
19ExprTuple37, 42
20Literal
21ExprTuple36, 37
22Literal
23ExprTuple36, 28
24Operationoperator: 32
operands: 29
25Operationoperator: 32
operands: 30
26Operationoperator: 32
operands: 31
27Operationoperator: 32
operands: 33
28Operationoperator: 34
operand: 42
29ExprTuple38, 36, 39
30ExprTuple40, 37, 41
31ExprTuple38, 39
32Literal
33ExprTuple40, 41
34Literal
35ExprTuple42
36Variable
37Variable
38ExprRangelambda_map: 43
start_index: 48
end_index: 46
39ExprRangelambda_map: 44
start_index: 48
end_index: 49
40ExprRangelambda_map: 45
start_index: 48
end_index: 46
41ExprRangelambda_map: 47
start_index: 48
end_index: 49
42Variable
43Lambdaparameter: 59
body: 50
44Lambdaparameter: 59
body: 51
45Lambdaparameter: 59
body: 52
46Variable
47Lambdaparameter: 59
body: 53
48Literal
49Variable
50IndexedVarvariable: 54
index: 59
51IndexedVarvariable: 55
index: 59
52IndexedVarvariable: 56
index: 59
53IndexedVarvariable: 57
index: 59
54Variable
55Variable
56Variable
57Variable
58ExprTuple59
59Variable