logo

Expression of type ExprTuple

from the theory of proveit.logic.sets.intersection

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, R__y_1_to_n, S_1_to_n, y_1_to_n
from proveit.logic import Forall, InSet
from proveit.logic.sets import general_intersectall_Ryn
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(InSet(x, general_intersectall_Ryn), Forall(instance_param_or_params = [y_1_to_n], instance_expr = InSet(x, R__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[\bigcap_{\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)}~R\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right], \forall_{\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 \in R\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: 28
operands: 3
2Operationoperator: 4
operand: 7
3ExprTuple16, 6
4Literal
5ExprTuple7
6Operationoperator: 8
operand: 11
7Lambdaparameters: 25
body: 10
8Literal
9ExprTuple11
10Conditionalvalue: 12
condition: 15
11Lambdaparameters: 25
body: 13
12Operationoperator: 28
operands: 14
13Conditionalvalue: 17
condition: 15
14ExprTuple16, 17
15Operationoperator: 18
operands: 19
16Variable
17Operationoperator: 20
operands: 25
18Literal
19ExprTuple21, 22
20Variable
21ExprRangelambda_map: 23
start_index: 31
end_index: 32
22Operationoperator: 24
operands: 25
23Lambdaparameter: 38
body: 26
24Variable
25ExprTuple27
26Operationoperator: 28
operands: 29
27ExprRangelambda_map: 30
start_index: 31
end_index: 32
28Literal
29ExprTuple34, 33
30Lambdaparameter: 38
body: 34
31Literal
32Variable
33IndexedVarvariable: 35
index: 38
34IndexedVarvariable: 36
index: 38
35Variable
36Variable
37ExprTuple38
38Variable