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_all_then_true_for_each
In [2]:
# check that the built expression is the same as the stored expression
assert true_for_all_then_true_for_each.expr == stored_expr
assert true_for_all_then_true_for_each.expr._style_id == stored_expr._style_id
print("Passed sanity check: true_for_all_then_true_for_each matches stored_expr")
Passed sanity check: true_for_all_then_true_for_each 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~|~\forall_{x \in \left\{a_{1}, a_{2}, \ldots, a_{n}\right\}}~P\left(x\right)}~\left(P\left(a_{1}\right) \land  P\left(a_{2}\right) \land  \ldots \land  P\left(a_{n}\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: 20
operand: 2
1ExprTuple2
2Lambdaparameter: 41
body: 4
3ExprTuple41
4Conditionalvalue: 5
condition: 6
5Operationoperator: 20
operand: 9
6Operationoperator: 32
operands: 8
7ExprTuple9
8ExprTuple41, 10
9Lambdaparameters: 37
body: 11
10Literal
11Operationoperator: 20
operand: 13
12ExprTuple13
13Lambdaparameter: 30
body: 15
14ExprTuple30
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operand: 23
18Literal
19ExprTuple22
20Literal
21ExprTuple23
22ExprRangelambda_map: 24
start_index: 40
end_index: 41
23Lambdaparameter: 34
body: 25
24Lambdaparameter: 45
body: 26
25Conditionalvalue: 27
condition: 28
26Operationoperator: 30
operand: 42
27Operationoperator: 30
operand: 34
28Operationoperator: 32
operands: 33
29ExprTuple42
30Variable
31ExprTuple34
32Literal
33ExprTuple34, 35
34Variable
35Operationoperator: 36
operands: 37
36Literal
37ExprTuple38
38ExprRangelambda_map: 39
start_index: 40
end_index: 41
39Lambdaparameter: 45
body: 42
40Literal
41Variable
42IndexedVarvariable: 43
index: 45
43Variable
44ExprTuple45
45Variable