logo

Expression of type ExprTuple

from the theory of proveit.core_expr_types.tuples

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
from proveit.core_expr_types import merge_series_conditions, merge_series_equiv, x_0_to_jmi
from proveit.logic import And
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([x_0_to_jmi], Conditional(merge_series_equiv, And(merge_series_conditions))))
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(x_{0}, x_{1}, \ldots, x_{j - i}\right) \mapsto \left\{\begin{array}{c} \begin{array}{l} \left(x_{0}, x_{1}, \ldots, x_{j - i}\right) =  \\ \left(f\left(i\right), f\left(i + 1\right), \ldots, f\left(j\right)\right) \end{array} \end{array} \textrm{ if } \left(x_{0} = f\left(i + 0\right)\right) \land  \left(x_{1} = f\left(i + 1\right)\right) \land  \ldots \land  \left(x_{j - i} = f\left(i + \left(j - i\right)\right)\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: 8
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 21
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10
8ExprTuple11
9ExprTuple12
10ExprRangelambda_map: 13
start_index: 15
end_index: 16
11ExprRangelambda_map: 14
start_index: 15
end_index: 16
12ExprRangelambda_map: 17
start_index: 36
end_index: 23
13Lambdaparameter: 37
body: 18
14Lambdaparameter: 37
body: 25
15Literal
16Operationoperator: 34
operands: 19
17Lambdaparameter: 37
body: 20
18Operationoperator: 21
operands: 22
19ExprTuple23, 24
20Operationoperator: 31
operand: 37
21Literal
22ExprTuple25, 26
23Variable
24Operationoperator: 27
operand: 36
25IndexedVarvariable: 29
index: 37
26Operationoperator: 31
operand: 33
27Literal
28ExprTuple36
29Variable
30ExprTuple37
31Variable
32ExprTuple33
33Operationoperator: 34
operands: 35
34Literal
35ExprTuple36, 37
36Variable
37Variable