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
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(general_forall_st_Qx__Px_implies_Rx, Implies(general_exists_Py_st_Qy, general_exists_Rz_st_Qz).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_{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), \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)
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: 6
2Operationoperator: 17
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 27
body: 9
7Operationoperator: 11
operand: 15
8Operationoperator: 11
operand: 16
9Conditionalvalue: 13
condition: 14
10ExprTuple15
11Literal
12ExprTuple16
13Operationoperator: 17
operands: 18
14Operationoperator: 31
operands: 27
15Lambdaparameters: 29
body: 19
16Lambdaparameters: 32
body: 20
17Literal
18ExprTuple21, 22
19Conditionalvalue: 23
condition: 24
20Conditionalvalue: 25
condition: 26
21Operationoperator: 28
operands: 27
22Operationoperator: 30
operands: 27
23Operationoperator: 28
operands: 29
24Operationoperator: 31
operands: 29
25Operationoperator: 30
operands: 32
26Operationoperator: 31
operands: 32
27ExprTuple33
28Variable
29ExprTuple34
30Variable
31Variable
32ExprTuple35
33ExprRangelambda_map: 36
start_index: 39
end_index: 40
34ExprRangelambda_map: 37
start_index: 39
end_index: 40
35ExprRangelambda_map: 38
start_index: 39
end_index: 40
36Lambdaparameter: 48
body: 41
37Lambdaparameter: 48
body: 42
38Lambdaparameter: 48
body: 43
39Literal
40Variable
41IndexedVarvariable: 44
index: 48
42IndexedVarvariable: 45
index: 48
43IndexedVarvariable: 46
index: 48
44Variable
45Variable
46Variable
47ExprTuple48
48Variable