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, x
from proveit.core_expr_types import Q__y_1_to_n, S_1_to_n, f__y_1_to_n, y_1_to_n
from proveit.logic import Equals, Exists, InSet
from proveit.logic.sets import general_comprehension_fyn
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(InSet(x, general_comprehension_fyn), Exists(instance_param_or_params = [y_1_to_n], instance_expr = Equals(x, f__y_1_to_n), domains = [S_1_to_n], condition = Q__y_1_to_n))
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 \in \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)}, \exists_{\left(y_{1} \in S_{1}\right), \left(y_{2} \in S_{2}\right), \ldots, \left(y_{n} \in S_{n}\right)~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~\left(x = f\left(y_{1}, y_{2}, \ldots, y_{n}\right)\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: 29
operands: 3
2Operationoperator: 4
operand: 7
3ExprTuple17, 6
4Literal
5ExprTuple7
6Operationoperator: 8
operand: 11
7Lambdaparameters: 26
body: 10
8Literal
9ExprTuple11
10Conditionalvalue: 12
condition: 16
11Lambdaparameters: 26
body: 13
12Operationoperator: 14
operands: 15
13Conditionalvalue: 18
condition: 16
14Literal
15ExprTuple17, 18
16Operationoperator: 19
operands: 20
17Variable
18Operationoperator: 21
operands: 26
19Literal
20ExprTuple22, 23
21Variable
22ExprRangelambda_map: 24
start_index: 32
end_index: 33
23Operationoperator: 25
operands: 26
24Lambdaparameter: 39
body: 27
25Variable
26ExprTuple28
27Operationoperator: 29
operands: 30
28ExprRangelambda_map: 31
start_index: 32
end_index: 33
29Literal
30ExprTuple35, 34
31Lambdaparameter: 39
body: 35
32Literal
33Variable
34IndexedVarvariable: 36
index: 39
35IndexedVarvariable: 37
index: 39
36Variable
37Variable
38ExprTuple39
39Variable