logo

Expression of type Implies

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.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 = 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())
\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}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()(2)('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operand: 9
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9
7Literal
8ExprTuple10, 11
9Lambdaparameters: 35
body: 12
10Operationoperator: 14
operand: 17
11Operationoperator: 14
operand: 18
12Conditionalvalue: 16
condition: 22
13ExprTuple17
14Literal
15ExprTuple18
16Operationoperator: 37
operands: 35
17Lambdaparameters: 35
body: 19
18Lambdaparameters: 38
body: 20
19Conditionalvalue: 21
condition: 22
20Conditionalvalue: 23
condition: 24
21Operationoperator: 26
operands: 35
22Operationoperator: 27
operands: 25
23Operationoperator: 26
operands: 38
24Operationoperator: 27
operands: 28
25ExprTuple29, 30
26Variable
27Literal
28ExprTuple31, 32
29ExprRangelambda_map: 33
start_index: 48
end_index: 49
30Operationoperator: 34
operands: 35
31ExprRangelambda_map: 36
start_index: 48
end_index: 49
32Operationoperator: 37
operands: 38
33Lambdaparameter: 57
body: 39
34Variable
35ExprTuple40
36Lambdaparameter: 57
body: 41
37Variable
38ExprTuple42
39Operationoperator: 45
operands: 43
40ExprRangelambda_map: 44
start_index: 48
end_index: 49
41Operationoperator: 45
operands: 46
42ExprRangelambda_map: 47
start_index: 48
end_index: 49
43ExprTuple50, 51
44Lambdaparameter: 57
body: 50
45Literal
46ExprTuple52, 51
47Lambdaparameter: 57
body: 52
48Literal
49Variable
50IndexedVarvariable: 53
index: 57
51IndexedVarvariable: 54
index: 57
52IndexedVarvariable: 55
index: 57
53Variable
54Variable
55Variable
56ExprTuple57
57Variable