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.comprehension import unfold_basic_comprehension
In [2]:
# check that the built expression is the same as the stored expression
assert unfold_basic_comprehension.expr == stored_expr
assert unfold_basic_comprehension.expr._style_id == stored_expr._style_id
print("Passed sanity check: unfold_basic_comprehension matches stored_expr")
Passed sanity check: unfold_basic_comprehension matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{S, Q}~\left[\forall_{x \in \left\{y~|~Q\left(y\right)\right\}_{y \in S}}~\left(\left(x \in S\right) \land Q\left(x\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: 5
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple32, 30
4Operationoperator: 5
operand: 7
5Literal
6ExprTuple7
7Lambdaparameter: 20
body: 8
8Conditionalvalue: 9
condition: 10
9Operationoperator: 24
operands: 11
10Operationoperator: 28
operands: 12
11ExprTuple13, 14
12ExprTuple20, 15
13Operationoperator: 28
operands: 16
14Operationoperator: 30
operand: 20
15Operationoperator: 18
operand: 21
16ExprTuple20, 32
17ExprTuple20
18Literal
19ExprTuple21
20Variable
21Lambdaparameter: 33
body: 22
22Conditionalvalue: 33
condition: 23
23Operationoperator: 24
operands: 25
24Literal
25ExprTuple26, 27
26Operationoperator: 28
operands: 29
27Operationoperator: 30
operand: 33
28Literal
29ExprTuple33, 32
30Variable
31ExprTuple33
32Variable
33Variable