logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.logic.booleans.quantification.existence import existential_implication
In [2]:
# check that the built expression is the same as the stored expression
assert existential_implication.expr == stored_expr
assert existential_implication.expr._style_id == stored_expr._style_id
print("Passed sanity check: existential_implication matches stored_expr")
Passed sanity check: existential_implication matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{n \in \mathbb{N}^+}~\left[\forall_{P, Q, R}~\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 [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 17
operand: 2
1ExprTuple2
2Lambdaparameter: 54
body: 4
3ExprTuple54
4Conditionalvalue: 5
condition: 6
5Operationoperator: 17
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple54, 11
10Lambdaparameters: 12
body: 13
11Literal
12ExprTuple42, 45, 44
13Operationoperator: 31
operands: 14
14ExprTuple15, 16
15Operationoperator: 17
operand: 20
16Operationoperator: 31
operands: 19
17Literal
18ExprTuple20
19ExprTuple21, 22
20Lambdaparameters: 41
body: 23
21Operationoperator: 25
operand: 29
22Operationoperator: 25
operand: 30
23Conditionalvalue: 27
condition: 28
24ExprTuple29
25Literal
26ExprTuple30
27Operationoperator: 31
operands: 32
28Operationoperator: 45
operands: 41
29Lambdaparameters: 43
body: 33
30Lambdaparameters: 46
body: 34
31Literal
32ExprTuple35, 36
33Conditionalvalue: 37
condition: 38
34Conditionalvalue: 39
condition: 40
35Operationoperator: 42
operands: 41
36Operationoperator: 44
operands: 41
37Operationoperator: 42
operands: 43
38Operationoperator: 45
operands: 43
39Operationoperator: 44
operands: 46
40Operationoperator: 45
operands: 46
41ExprTuple47
42Variable
43ExprTuple48
44Variable
45Variable
46ExprTuple49
47ExprRangelambda_map: 50
start_index: 53
end_index: 54
48ExprRangelambda_map: 51
start_index: 53
end_index: 54
49ExprRangelambda_map: 52
start_index: 53
end_index: 54
50Lambdaparameter: 62
body: 55
51Lambdaparameter: 62
body: 56
52Lambdaparameter: 62
body: 57
53Literal
54Variable
55IndexedVarvariable: 58
index: 62
56IndexedVarvariable: 59
index: 62
57IndexedVarvariable: 60
index: 62
58Variable
59Variable
60Variable
61ExprTuple62
62Variable