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 Conditional, ExprTuple, Lambda, Q, R, 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 Equals, Exists, Forall, InSet
from proveit.logic.sets import general_intersectall_Ryn
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [y_1_to_n]
sub_expr2 = [S_1_to_n]
expr = ExprTuple(Lambda([S_1_to_n, Q, R, x], Conditional(Equals(InSet(x, general_intersectall_Ryn), Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(x, R__y_1_to_n), domains = sub_expr2, condition = Q__y_1_to_n)).with_wrapping_at(1), Exists(instance_param_or_params = sub_expr1, instance_expr = Q__y_1_to_n, domains = sub_expr2))))
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(S_{1}, S_{2}, \ldots, S_{n}, Q, R, x\right) \mapsto \left\{\begin{array}{c} \begin{array}{l} \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]\right) \\  = \left[\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] \end{array} \end{array} \textrm{ if } \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)\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple4, 39, 35, 31
3Conditionalvalue: 5
condition: 6
4ExprRangelambda_map: 7
start_index: 46
end_index: 47
5Operationoperator: 8
operands: 9
6Operationoperator: 10
operand: 14
7Lambdaparameter: 53
body: 48
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14
12Operationoperator: 43
operands: 15
13Operationoperator: 16
operand: 20
14Lambdaparameters: 40
body: 18
15ExprTuple31, 19
16Literal
17ExprTuple20
18Conditionalvalue: 37
condition: 21
19Operationoperator: 22
operand: 26
20Lambdaparameters: 40
body: 24
21Operationoperator: 33
operands: 25
22Literal
23ExprTuple26
24Conditionalvalue: 27
condition: 30
25ExprTuple36
26Lambdaparameters: 40
body: 28
27Operationoperator: 43
operands: 29
28Conditionalvalue: 32
condition: 30
29ExprTuple31, 32
30Operationoperator: 33
operands: 34
31Variable
32Operationoperator: 35
operands: 40
33Literal
34ExprTuple36, 37
35Variable
36ExprRangelambda_map: 38
start_index: 46
end_index: 47
37Operationoperator: 39
operands: 40
38Lambdaparameter: 53
body: 41
39Variable
40ExprTuple42
41Operationoperator: 43
operands: 44
42ExprRangelambda_map: 45
start_index: 46
end_index: 47
43Literal
44ExprTuple49, 48
45Lambdaparameter: 53
body: 49
46Literal
47Variable
48IndexedVarvariable: 50
index: 53
49IndexedVarvariable: 51
index: 53
50Variable
51Variable
52ExprTuple53
53Variable