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.core_expr_types.conditionals import condition_merger_reduction
In [2]:
# check that the built expression is the same as the stored expression
assert condition_merger_reduction.expr == stored_expr
assert condition_merger_reduction.expr._style_id == stored_expr._style_id
print("Passed sanity check: condition_merger_reduction matches stored_expr")
Passed sanity check: condition_merger_reduction matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{m, n \in \mathbb{N}}~\left[\forall_{a, Q_{1}, Q_{2}, \ldots, Q_{m}, R_{1}, R_{2}, \ldots, R_{n}}~\left(\begin{array}{c} \begin{array}{l} \left\{a \textrm{ if } Q_{1} \land  Q_{2} \land  \ldots \land  Q_{m} ,  R_{1} \land  R_{2} \land  \ldots \land  R_{n}\right.. \\  = \left\{a \textrm{ if } Q_{1} ,  Q_{2} ,  \ldots ,  Q_{m}, R_{1} ,  R_{2} ,  \ldots ,  R_{n}\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: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple36, 39
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 31
operands: 9
7Literal
8ExprTuple10
9ExprTuple11, 12
10Lambdaparameters: 13
body: 14
11Operationoperator: 16
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple24, 33, 34
14Operationoperator: 18
operands: 19
15ExprTuple36, 20
16Literal
17ExprTuple39, 20
18Literal
19ExprTuple21, 22
20Literal
21Conditionalvalue: 24
condition: 23
22Conditionalvalue: 24
condition: 25
23Operationoperator: 31
operands: 26
24Variable
25Operationoperator: 31
operands: 27
26ExprTuple28, 29
27ExprTuple33, 34
28Operationoperator: 31
operands: 30
29Operationoperator: 31
operands: 32
30ExprTuple33
31Literal
32ExprTuple34
33ExprRangelambda_map: 35
start_index: 38
end_index: 36
34ExprRangelambda_map: 37
start_index: 38
end_index: 39
35Lambdaparameter: 45
body: 40
36Variable
37Lambdaparameter: 45
body: 41
38Literal
39Variable
40IndexedVarvariable: 42
index: 45
41IndexedVarvariable: 43
index: 45
42Variable
43Variable
44ExprTuple45
45Variable