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 ExprRange, ExprTuple, IndexedVar, U, Variable, W, a, c, d, e, i, k
from proveit.logic import InSet
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = IndexedVar(U, sub_expr1)
sub_expr3 = IndexedVar(W, sub_expr1)
expr = ExprTuple(ExprRange(sub_expr1, InSet(IndexedVar(a, sub_expr1), sub_expr2), one, i), ExprRange(sub_expr1, InSet(IndexedVar(c, sub_expr1), sub_expr3), one, k), ExprRange(sub_expr1, InSet(IndexedVar(d, sub_expr1), sub_expr2), one, i), ExprRange(sub_expr1, InSet(IndexedVar(e, sub_expr1), sub_expr3), one, 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(\left(a_{1} \in U_{1}\right), \left(a_{2} \in U_{2}\right), \ldots, \left(a_{i} \in U_{i}\right),\left(c_{1} \in W_{1}\right), \left(c_{2} \in W_{2}\right), \ldots, \left(c_{k} \in W_{k}\right),\left(d_{1} \in U_{1}\right), \left(d_{2} \in U_{2}\right), \ldots, \left(d_{i} \in U_{i}\right),\left(e_{1} \in W_{1}\right), \left(e_{2} \in W_{2}\right), \ldots, \left(e_{k} \in W_{k}\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2, 3, 4
1ExprRangelambda_map: 5
start_index: 10
end_index: 8
2ExprRangelambda_map: 6
start_index: 10
end_index: 11
3ExprRangelambda_map: 7
start_index: 10
end_index: 8
4ExprRangelambda_map: 9
start_index: 10
end_index: 11
5Lambdaparameter: 34
body: 12
6Lambdaparameter: 34
body: 13
7Lambdaparameter: 34
body: 14
8Variable
9Lambdaparameter: 34
body: 15
10Literal
11Variable
12Operationoperator: 19
operands: 16
13Operationoperator: 19
operands: 17
14Operationoperator: 19
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple21, 24
17ExprTuple22, 26
18ExprTuple23, 24
19Literal
20ExprTuple25, 26
21IndexedVarvariable: 27
index: 34
22IndexedVarvariable: 28
index: 34
23IndexedVarvariable: 29
index: 34
24IndexedVarvariable: 30
index: 34
25IndexedVarvariable: 31
index: 34
26IndexedVarvariable: 32
index: 34
27Variable
28Variable
29Variable
30Variable
31Variable
32Variable
33ExprTuple34
34Variable