logo

Expression of type ExprTuple

from the theory of proveit.logic.booleans.quantification.existence

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 A, B, Conditional, ExprTuple, Lambda, P, Q
from proveit.logic import Implies, SubsetEq
from proveit.logic.booleans.quantification import general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([P, Q, A, B], Conditional(Implies(general_exists_in_A_Px_st_Qx, general_exists_in_B_Py_st_Qy).with_wrapping_at(2), SubsetEq(A, B))))
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(P, Q, A, B\right) \mapsto \left\{\begin{array}{c} \begin{array}{l} \left[\exists_{x_{1}, x_{2}, \ldots, x_{n} \in A~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~P\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right] \Rightarrow  \\ \left[\exists_{y_{1}, y_{2}, \ldots, y_{n} \in B~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right] \end{array} \end{array} \textrm{ if } A \subseteq B\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
2ExprTuple24, 34, 47, 49
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple47, 49
10Operationoperator: 13
operand: 15
11Operationoperator: 13
operand: 16
12ExprTuple15
13Literal
14ExprTuple16
15Lambdaparameters: 32
body: 17
16Lambdaparameters: 35
body: 18
17Conditionalvalue: 19
condition: 20
18Conditionalvalue: 21
condition: 22
19Operationoperator: 24
operands: 32
20Operationoperator: 25
operands: 23
21Operationoperator: 24
operands: 35
22Operationoperator: 25
operands: 26
23ExprTuple27, 28
24Variable
25Literal
26ExprTuple29, 30
27ExprRangelambda_map: 31
start_index: 45
end_index: 46
28Operationoperator: 34
operands: 32
29ExprRangelambda_map: 33
start_index: 45
end_index: 46
30Operationoperator: 34
operands: 35
31Lambdaparameter: 54
body: 36
32ExprTuple37
33Lambdaparameter: 54
body: 38
34Variable
35ExprTuple39
36Operationoperator: 42
operands: 40
37ExprRangelambda_map: 41
start_index: 45
end_index: 46
38Operationoperator: 42
operands: 43
39ExprRangelambda_map: 44
start_index: 45
end_index: 46
40ExprTuple48, 47
41Lambdaparameter: 54
body: 48
42Literal
43ExprTuple50, 49
44Lambdaparameter: 54
body: 50
45Literal
46Variable
47Variable
48IndexedVarvariable: 51
index: 54
49Variable
50IndexedVarvariable: 52
index: 54
51Variable
52Variable
53ExprTuple54
54Variable