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.functions.injections import membership_folding
In [2]:
# check that the built expression is the same as the stored expression
assert membership_folding.expr == stored_expr
assert membership_folding.expr._style_id == stored_expr._style_id
print("Passed sanity check: membership_folding matches stored_expr")
Passed sanity check: membership_folding matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{A, B}~\left[\forall_{f \in \left[A \rightarrow B\right]~|~\forall_{a, b \in A~|~a \neq b}~\left(f\left(a\right) \neq f\left(b\right)\right)}~\left(f \in \left[A \xrightarrow[]{\text{1-to-1}} B\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: 17
operand: 2
1ExprTuple2
2Lambdaparameters: 22
body: 3
3Operationoperator: 17
operand: 5
4ExprTuple5
5Lambdaparameter: 36
body: 7
6ExprTuple36
7Conditionalvalue: 8
condition: 9
8Operationoperator: 39
operands: 10
9Operationoperator: 28
operands: 11
10ExprTuple36, 12
11ExprTuple13, 14
12Operationoperator: 15
operands: 22
13Operationoperator: 39
operands: 16
14Operationoperator: 17
operand: 20
15Literal
16ExprTuple36, 19
17Literal
18ExprTuple20
19Operationoperator: 21
operands: 22
20Lambdaparameters: 42
body: 23
21Literal
22ExprTuple43, 24
23Conditionalvalue: 25
condition: 26
24Variable
25Operationoperator: 41
operands: 27
26Operationoperator: 28
operands: 29
27ExprTuple30, 31
28Literal
29ExprTuple32, 33, 34
30Operationoperator: 36
operand: 44
31Operationoperator: 36
operand: 45
32Operationoperator: 39
operands: 38
33Operationoperator: 39
operands: 40
34Operationoperator: 41
operands: 42
35ExprTuple44
36Variable
37ExprTuple45
38ExprTuple44, 43
39Literal
40ExprTuple45, 43
41Literal
42ExprTuple44, 45
43Variable
44Variable
45Variable