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}")
expr = ExprArray(ExprRange(sub_expr1, [IndexedVar(A, [p, j]), IndexedVar(B, [sub_expr1, j]), IndexedVar(C, [j, k]), IndexedVar(D, [k, sub_expr1])], one, m))
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())
\begin{array}{cccc} 
 A_{p, j} & B_{1, j} & C_{j, k} & D_{k, 1} \\
A_{p, j} & B_{2, j} & C_{j, k} & D_{k, 2} \\
\vdots & \vdots & \vdots & \vdots \\
A_{p, j} & B_{m, j} & C_{j, k} & D_{k, m} \\
\end{array}

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
0ExprTuple1
1ExprRangelambda_map: 2
start_index: 3
end_index: 4
2Lambdaparameter: 22
body: 6
3Literal
4Variable
5ExprTuple22
6ExprTuple7, 8, 9, 10
7IndexedVarvariable: 11
indices: 12
8IndexedVarvariable: 13
indices: 14
9IndexedVarvariable: 15
indices: 16
10IndexedVarvariable: 17
indices: 18
11Variable
12ExprTuple19, 20
13Variable
14ExprTuple22, 20
15Variable
16ExprTuple20, 21
17Variable
18ExprTuple21, 22
19Variable
20Variable
21Variable
22Variable