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 Q__x_1_to_n, R__x_1_to_n, S_1_to_n, f__x_1_to_n, x_1_to_n
from proveit.logic import Forall, SetOfAll, SubsetEq
from proveit.logic.sets import general_comprehension_fyn
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [x_1_to_n]
sub_expr2 = [S_1_to_n]
expr = ExprTuple(Forall(instance_param_or_params = sub_expr1, instance_expr = Q__x_1_to_n, domains = sub_expr2, condition = R__x_1_to_n), SubsetEq(SetOfAll(instance_param_or_params = sub_expr1, instance_element = f__x_1_to_n, domains = sub_expr2, condition = R__x_1_to_n), general_comprehension_fyn).with_wrapping_at(2))
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(\forall_{\left(x_{1} \in S_{1}\right), \left(x_{2} \in S_{2}\right), \ldots, \left(x_{n} \in S_{n}\right)~|~R\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right), \begin{array}{c} \begin{array}{l} \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)} \subseteq  \\ \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)} \end{array} \end{array}\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: 7
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7
5Literal
6ExprTuple8, 9
7Lambdaparameters: 33
body: 10
8Operationoperator: 12
operand: 15
9Operationoperator: 12
operand: 16
10Conditionalvalue: 14
condition: 20
11ExprTuple15
12Literal
13ExprTuple16
14Operationoperator: 35
operands: 33
15Lambdaparameters: 33
body: 17
16Lambdaparameters: 36
body: 18
17Conditionalvalue: 19
condition: 20
18Conditionalvalue: 21
condition: 22
19Operationoperator: 24
operands: 33
20Operationoperator: 25
operands: 23
21Operationoperator: 24
operands: 36
22Operationoperator: 25
operands: 26
23ExprTuple27, 28
24Variable
25Literal
26ExprTuple29, 30
27ExprRangelambda_map: 31
start_index: 46
end_index: 47
28Operationoperator: 32
operands: 33
29ExprRangelambda_map: 34
start_index: 46
end_index: 47
30Operationoperator: 35
operands: 36
31Lambdaparameter: 55
body: 37
32Variable
33ExprTuple38
34Lambdaparameter: 55
body: 39
35Variable
36ExprTuple40
37Operationoperator: 43
operands: 41
38ExprRangelambda_map: 42
start_index: 46
end_index: 47
39Operationoperator: 43
operands: 44
40ExprRangelambda_map: 45
start_index: 46
end_index: 47
41ExprTuple48, 49
42Lambdaparameter: 55
body: 48
43Literal
44ExprTuple50, 49
45Lambdaparameter: 55
body: 50
46Literal
47Variable
48IndexedVarvariable: 51
index: 55
49IndexedVarvariable: 52
index: 55
50IndexedVarvariable: 53
index: 55
51Variable
52Variable
53Variable
54ExprTuple55
55Variable