logo

Expression of type ExprArray

from the theory of proveit.core_expr_types.expr_arrays

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 A, B, C, D, ExprArray, ExprRange, IndexedVar, Variable, j, k, m, p
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [A, B, C, D]
expr = ExprArray(sub_expr2, ExprRange(sub_expr1, [[IndexedVar(A, [p, j]), IndexedVar(B, [sub_expr1, j])], [IndexedVar(C, [j, k]), IndexedVar(D, [k, sub_expr1])]], one, m), sub_expr2)
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())
ExprArray\left(\begin{array}{c} \left(A, B, C, D\right), \\ \left(\left(A_{p, j}, B_{1, j}\right), \left(C_{j, k}, D_{k, 1}\right)\right),  \\ \left(\left(A_{p, j}, B_{2, j}\right), \left(C_{j, k}, D_{k, 2}\right)\right), \ldots, \left(\left(A_{p, j}, B_{m, j}\right), \left(C_{j, k}, D_{k, m}\right)\right), \left(A, B, C, D\right) \end{array}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenterwith_justification
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple2, 1, 2
1ExprRangelambda_map: 3
start_index: 4
end_index: 5
2ExprTuple14, 16, 18, 20
3Lambdaparameter: 25
body: 7
4Literal
5Variable
6ExprTuple25
7ExprTuple8, 9
8ExprTuple10, 11
9ExprTuple12, 13
10IndexedVarvariable: 14
indices: 15
11IndexedVarvariable: 16
indices: 17
12IndexedVarvariable: 18
indices: 19
13IndexedVarvariable: 20
indices: 21
14Variable
15ExprTuple22, 23
16Variable
17ExprTuple25, 23
18Variable
19ExprTuple23, 24
20Variable
21ExprTuple24, 25
22Variable
23Variable
24Variable
25Variable