logo

Expression of type ExprTuple

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 ExprArray, ExprTuple, Lambda, b, d
from proveit.core_expr_types import a_1_to_i, c_1_to_i
from proveit.logic import And, Equals
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a_1_to_i, b, c_1_to_i, d], Equals(Equals(ExprArray(a_1_to_i, b), ExprArray(c_1_to_i, d)), And(Equals([a_1_to_i], [c_1_to_i]), Equals(b, d))).with_wrapping_at(2)))
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}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{i}, d\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left(\left(\begin{array}{c} 
 \multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & a_{1} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & a_{2} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & \vdots & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & a_{i} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & b & \rightarrow \end{array}} \\
\end{array}
\right) = \left(\begin{array}{c} 
 \multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & c_{1} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & c_{2} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & \vdots & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & c_{i} & \rightarrow \end{array}} \\
\multicolumn{1}{c}{\begin{array}{lcr} \leftarrow & d & \rightarrow \end{array}} \\
\end{array}
\right)\right) =  \\ \left(\left(\left(a_{1}, a_{2}, \ldots, a_{i}\right) = \left(c_{1}, c_{2}, \ldots, c_{i}\right)\right) \land \left(b = d\right)\right) \end{array} \end{array}\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: 2
body: 3
2ExprTuple21, 19, 22, 20
3Operationoperator: 15
operands: 4
4ExprTuple5, 6
5Operationoperator: 15
operands: 7
6Operationoperator: 8
operands: 9
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10ExprTuple21, 19
11ExprTuple22, 20
12Operationoperator: 15
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17ExprTuple21
18ExprTuple22
19Variable
20Variable
21ExprRangelambda_map: 23
start_index: 25
end_index: 26
22ExprRangelambda_map: 24
start_index: 25
end_index: 26
23Lambdaparameter: 32
body: 27
24Lambdaparameter: 32
body: 28
25Literal
26Variable
27IndexedVarvariable: 29
index: 32
28IndexedVarvariable: 30
index: 32
29Variable
30Variable
31ExprTuple32
32Variable