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 ExprTuple, Lambda, P, Q, R
from proveit.logic import Implies
from proveit.logic.booleans.quantification import general_exists_Py_st_Qy, general_exists_Rz_st_Qz, general_forall_st_Qx__Px_implies_Rx
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([P, Q, R], Implies(general_forall_st_Qx__Px_implies_Rx, Implies(general_exists_Py_st_Qy, general_exists_Rz_st_Qz).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(P, Q, R\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \left[\forall_{x_{1}, x_{2}, \ldots, x_{n}~|~Q\left(x_{1}, x_{2}, \ldots, x_{n}\right)}~\left(P\left(x_{1}, x_{2}, \ldots, x_{n}\right) \Rightarrow R\left(x_{1}, x_{2}, \ldots, x_{n}\right)\right)\right] \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left[\exists_{y_{1}, y_{2}, \ldots, y_{n}~|~Q\left(y_{1}, y_{2}, \ldots, y_{n}\right)}~P\left(y_{1}, y_{2}, \ldots, y_{n}\right)\right] \Rightarrow  \\ \left[\exists_{z_{1}, z_{2}, \ldots, z_{n}~|~Q\left(z_{1}, z_{2}, \ldots, z_{n}\right)}~R\left(z_{1}, z_{2}, \ldots, z_{n}\right)\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
2ExprTuple32, 35, 34
3Operationoperator: 21
operands: 4
4ExprTuple5, 6
5Operationoperator: 7
operand: 10
6Operationoperator: 21
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12
10Lambdaparameters: 31
body: 13
11Operationoperator: 15
operand: 19
12Operationoperator: 15
operand: 20
13Conditionalvalue: 17
condition: 18
14ExprTuple19
15Literal
16ExprTuple20
17Operationoperator: 21
operands: 22
18Operationoperator: 35
operands: 31
19Lambdaparameters: 33
body: 23
20Lambdaparameters: 36
body: 24
21Literal
22ExprTuple25, 26
23Conditionalvalue: 27
condition: 28
24Conditionalvalue: 29
condition: 30
25Operationoperator: 32
operands: 31
26Operationoperator: 34
operands: 31
27Operationoperator: 32
operands: 33
28Operationoperator: 35
operands: 33
29Operationoperator: 34
operands: 36
30Operationoperator: 35
operands: 36
31ExprTuple37
32Variable
33ExprTuple38
34Variable
35Variable
36ExprTuple39
37ExprRangelambda_map: 40
start_index: 43
end_index: 44
38ExprRangelambda_map: 41
start_index: 43
end_index: 44
39ExprRangelambda_map: 42
start_index: 43
end_index: 44
40Lambdaparameter: 52
body: 45
41Lambdaparameter: 52
body: 46
42Lambdaparameter: 52
body: 47
43Literal
44Variable
45IndexedVarvariable: 48
index: 52
46IndexedVarvariable: 49
index: 52
47IndexedVarvariable: 50
index: 52
48Variable
49Variable
50Variable
51ExprTuple52
52Variable