logo

Expression of type Implies

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.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 = 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())
\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}
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: 18
operands: 1
1ExprTuple2, 3
2Operationoperator: 4
operand: 7
3Operationoperator: 18
operands: 6
4Literal
5ExprTuple7
6ExprTuple8, 9
7Lambdaparameters: 28
body: 10
8Operationoperator: 12
operand: 16
9Operationoperator: 12
operand: 17
10Conditionalvalue: 14
condition: 15
11ExprTuple16
12Literal
13ExprTuple17
14Operationoperator: 18
operands: 19
15Operationoperator: 32
operands: 28
16Lambdaparameters: 30
body: 20
17Lambdaparameters: 33
body: 21
18Literal
19ExprTuple22, 23
20Conditionalvalue: 24
condition: 25
21Conditionalvalue: 26
condition: 27
22Operationoperator: 29
operands: 28
23Operationoperator: 31
operands: 28
24Operationoperator: 29
operands: 30
25Operationoperator: 32
operands: 30
26Operationoperator: 31
operands: 33
27Operationoperator: 32
operands: 33
28ExprTuple34
29Variable
30ExprTuple35
31Variable
32Variable
33ExprTuple36
34ExprRangelambda_map: 37
start_index: 40
end_index: 41
35ExprRangelambda_map: 38
start_index: 40
end_index: 41
36ExprRangelambda_map: 39
start_index: 40
end_index: 41
37Lambdaparameter: 49
body: 42
38Lambdaparameter: 49
body: 43
39Lambdaparameter: 49
body: 44
40Literal
41Variable
42IndexedVarvariable: 45
index: 49
43IndexedVarvariable: 46
index: 49
44IndexedVarvariable: 47
index: 49
45Variable
46Variable
47Variable
48ExprTuple49
49Variable