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(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), InSet(x, 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(\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), 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)}\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: 3
operand: 6
2Operationoperator: 29
operands: 5
3Literal
4ExprTuple6
5ExprTuple16, 7
6Lambdaparameters: 26
body: 8
7Operationoperator: 9
operand: 12
8Conditionalvalue: 11
condition: 18
9Literal
10ExprTuple12
11Operationoperator: 13
operands: 14
12Lambdaparameters: 26
body: 15
13Literal
14ExprTuple16, 17
15Conditionalvalue: 17
condition: 18
16Variable
17Operationoperator: 19
operands: 26
18Operationoperator: 20
operands: 21
19Variable
20Literal
21ExprTuple22, 23
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