logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.comprehension

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 ExprTuple
from proveit.core_expr_types import R__x_1_to_n, S_1_to_n, f__x_1_to_n, x_1_to_n
from proveit.logic import SetOfAll
from proveit.logic.sets import general_comprehension_fyn
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(SetOfAll(instance_param_or_params = [x_1_to_n], instance_element = f__x_1_to_n, domains = [S_1_to_n], condition = R__x_1_to_n), general_comprehension_fyn)
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\{f\left(x_{1}, x_{2}, \ldots, x_{n}\right)~|~R\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right\}_{\left(x_{1} \in S_{1}\right), \left(x_{2} \in S_{2}\right), \ldots, \left(x_{n} \in S_{n}\right)}, \left\{f\left(y_{1}, y_{2}, \ldots, y_{n}\right)~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right\}_{\left(y_{1} \in S_{1}\right), \left(y_{2} \in S_{2}\right), \ldots, \left(y_{n} \in S_{n}\right)}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 4
operand: 6
2Operationoperator: 4
operand: 7
3ExprTuple6
4Literal
5ExprTuple7
6Lambdaparameters: 24
body: 8
7Lambdaparameters: 27
body: 9
8Conditionalvalue: 10
condition: 11
9Conditionalvalue: 12
condition: 13
10Operationoperator: 15
operands: 24
11Operationoperator: 16
operands: 14
12Operationoperator: 15
operands: 27
13Operationoperator: 16
operands: 17
14ExprTuple18, 19
15Variable
16Literal
17ExprTuple20, 21
18ExprRangelambda_map: 22
start_index: 37
end_index: 38
19Operationoperator: 23
operands: 24
20ExprRangelambda_map: 25
start_index: 37
end_index: 38
21Operationoperator: 26
operands: 27
22Lambdaparameter: 46
body: 28
23Variable
24ExprTuple29
25Lambdaparameter: 46
body: 30
26Variable
27ExprTuple31
28Operationoperator: 34
operands: 32
29ExprRangelambda_map: 33
start_index: 37
end_index: 38
30Operationoperator: 34
operands: 35
31ExprRangelambda_map: 36
start_index: 37
end_index: 38
32ExprTuple39, 40
33Lambdaparameter: 46
body: 39
34Literal
35ExprTuple41, 40
36Lambdaparameter: 46
body: 41
37Literal
38Variable
39IndexedVarvariable: 42
index: 46
40IndexedVarvariable: 43
index: 46
41IndexedVarvariable: 44
index: 46
42Variable
43Variable
44Variable
45ExprTuple46
46Variable