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