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, Lambda, Q, R, f
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, Implies, 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(Lambda([f, Q, R, S_1_to_n], Implies(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)).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(\left(f, Q, R, S_{1}, S_{2}, \ldots, S_{n}\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \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)\right] \Rightarrow  \\ \left(\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) \end{array} \end{array}\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
2ExprTuple31, 42, 39, 4
3Operationoperator: 5
operands: 6
4ExprRangelambda_map: 7
start_index: 53
end_index: 54
5Literal
6ExprTuple8, 9
7Lambdaparameter: 62
body: 56
8Operationoperator: 10
operand: 14
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14
12Literal
13ExprTuple15, 16
14Lambdaparameters: 40
body: 17
15Operationoperator: 19
operand: 22
16Operationoperator: 19
operand: 23
17Conditionalvalue: 21
condition: 27
18ExprTuple22
19Literal
20ExprTuple23
21Operationoperator: 42
operands: 40
22Lambdaparameters: 40
body: 24
23Lambdaparameters: 43
body: 25
24Conditionalvalue: 26
condition: 27
25Conditionalvalue: 28
condition: 29
26Operationoperator: 31
operands: 40
27Operationoperator: 32
operands: 30
28Operationoperator: 31
operands: 43
29Operationoperator: 32
operands: 33
30ExprTuple34, 35
31Variable
32Literal
33ExprTuple36, 37
34ExprRangelambda_map: 38
start_index: 53
end_index: 54
35Operationoperator: 39
operands: 40
36ExprRangelambda_map: 41
start_index: 53
end_index: 54
37Operationoperator: 42
operands: 43
38Lambdaparameter: 62
body: 44
39Variable
40ExprTuple45
41Lambdaparameter: 62
body: 46
42Variable
43ExprTuple47
44Operationoperator: 50
operands: 48
45ExprRangelambda_map: 49
start_index: 53
end_index: 54
46Operationoperator: 50
operands: 51
47ExprRangelambda_map: 52
start_index: 53
end_index: 54
48ExprTuple55, 56
49Lambdaparameter: 62
body: 55
50Literal
51ExprTuple57, 56
52Lambdaparameter: 62
body: 57
53Literal
54Variable
55IndexedVarvariable: 58
index: 62
56IndexedVarvariable: 59
index: 62
57IndexedVarvariable: 60
index: 62
58Variable
59Variable
60Variable
61ExprTuple62
62Variable