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 basic_comprehension
In [2]:
# check that the built expression is the same as the stored expression
assert basic_comprehension.expr == stored_expr
assert basic_comprehension.expr._style_id == stored_expr._style_id
print("Passed sanity check: basic_comprehension matches stored_expr")
Passed sanity check: 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, x}~\left(\left(x \in \left\{y~|~Q\left(y\right)\right\}_{y \in S}\right) = \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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple31, 29, 20
5Operationoperator: 6
operands: 7
6Literal
7ExprTuple8, 9
8Operationoperator: 27
operands: 10
9Operationoperator: 23
operands: 11
10ExprTuple20, 12
11ExprTuple13, 14
12Operationoperator: 15
operand: 19
13Operationoperator: 27
operands: 17
14Operationoperator: 29
operand: 20
15Literal
16ExprTuple19
17ExprTuple20, 31
18ExprTuple20
19Lambdaparameter: 32
body: 21
20Variable
21Conditionalvalue: 32
condition: 22
22Operationoperator: 23
operands: 24
23Literal
24ExprTuple25, 26
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operand: 32
27Literal
28ExprTuple32, 31
29Variable
30ExprTuple32
31Variable
32Variable