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.sets.enumeration import true_for_each_then_true_for_all_conditioned
In [2]:
# check that the built expression is the same as the stored expression
assert true_for_each_then_true_for_all_conditioned.expr == stored_expr
assert true_for_each_then_true_for_all_conditioned.expr._style_id == stored_expr._style_id
print("Passed sanity check: true_for_each_then_true_for_all_conditioned matches stored_expr")
Passed sanity check: true_for_each_then_true_for_all_conditioned 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_{a_{1}, a_{2}, \ldots, a_{n}}~\left[\forall_{P, Q~|~\left(Q\left(a_{1}\right) \Rightarrow P\left(a_{1}\right)\right), \left(Q\left(a_{2}\right) \Rightarrow P\left(a_{2}\right)\right), \ldots, \left(Q\left(a_{n}\right) \Rightarrow P\left(a_{n}\right)\right)}~\left[\forall_{x \in \left\{a_{1}, a_{2}, \ldots, a_{n}\right\}~|~Q\left(x\right)}~P\left(x\right)\right]\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: 18
operand: 2
1ExprTuple2
2Lambdaparameter: 49
body: 4
3ExprTuple49
4Conditionalvalue: 5
condition: 6
5Operationoperator: 18
operand: 9
6Operationoperator: 36
operands: 8
7ExprTuple9
8ExprTuple49, 10
9Lambdaparameters: 45
body: 11
10Literal
11Operationoperator: 18
operand: 13
12ExprTuple13
13Lambdaparameters: 14
body: 15
14ExprTuple40, 39
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operand: 21
17Operationoperator: 28
operands: 20
18Literal
19ExprTuple21
20ExprTuple22
21Lambdaparameter: 43
body: 23
22ExprRangelambda_map: 24
start_index: 48
end_index: 49
23Conditionalvalue: 25
condition: 26
24Lambdaparameter: 53
body: 27
25Operationoperator: 40
operand: 43
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operands: 31
28Literal
29ExprTuple32, 33
30Literal
31ExprTuple34, 35
32Operationoperator: 36
operands: 37
33Operationoperator: 39
operand: 43
34Operationoperator: 39
operand: 50
35Operationoperator: 40
operand: 50
36Literal
37ExprTuple43, 42
38ExprTuple43
39Variable
40Variable
41ExprTuple50
42Operationoperator: 44
operands: 45
43Variable
44Literal
45ExprTuple46
46ExprRangelambda_map: 47
start_index: 48
end_index: 49
47Lambdaparameter: 53
body: 50
48Literal
49Variable
50IndexedVarvariable: 51
index: 53
51Variable
52ExprTuple53
53Variable