logo

Expression of type Lambda

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, 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 = 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(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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 7
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 20
operands: 4
3Operationoperator: 5
operands: 6
4ExprTuple7, 8
5Literal
6ExprTuple9
7ExprTuple10
8ExprTuple11
9ExprRangelambda_map: 12
start_index: 14
end_index: 15
10ExprRangelambda_map: 13
start_index: 14
end_index: 15
11ExprRangelambda_map: 16
start_index: 35
end_index: 22
12Lambdaparameter: 36
body: 17
13Lambdaparameter: 36
body: 24
14Literal
15Operationoperator: 33
operands: 18
16Lambdaparameter: 36
body: 19
17Operationoperator: 20
operands: 21
18ExprTuple22, 23
19Operationoperator: 30
operand: 36
20Literal
21ExprTuple24, 25
22Variable
23Operationoperator: 26
operand: 35
24IndexedVarvariable: 28
index: 36
25Operationoperator: 30
operand: 32
26Literal
27ExprTuple35
28Variable
29ExprTuple36
30Variable
31ExprTuple32
32Operationoperator: 33
operands: 34
33Literal
34ExprTuple35, 36
35Variable
36Variable