logo

Expression of type Lambda

from the theory of proveit.logic.sets.disjointness

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import B, Lambda, X
from proveit.core_expr_types import A_1_to_m
from proveit.logic import And, Disjoint, Forall, Iff, Set
In [2]:
# build up the expression from sub-expressions
expr = Lambda([A_1_to_m, B], Iff(Disjoint(A_1_to_m, B), And(Disjoint(A_1_to_m), Forall(instance_param_or_params = [X], instance_expr = Disjoint(X, B), domain = Set(A_1_to_m)))).with_wrapping_at(2))
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(A_{1}, A_{2}, \ldots, A_{m}, B\right) \mapsto \left(\begin{array}{c} \begin{array}{l} \textrm{disjoint}\left(A_{1}, A_{2}, \ldots, A_{m}, B\right) \Leftrightarrow  \\ \left(\textrm{disjoint}\left(A_{1}, A_{2}, \ldots, A_{m}\right) \land \left[\forall_{X \in \left\{A_{1}, A_{2}, \ldots, A_{m}\right\}}~\textrm{disjoint}\left(X, B\right)\right]\right) \end{array} \end{array}\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 6
body: 1
1Operationoperator: 2
operands: 3
2Literal
3ExprTuple4, 5
4Operationoperator: 18
operands: 6
5Operationoperator: 7
operands: 8
6ExprTuple27, 22
7Literal
8ExprTuple9, 10
9Operationoperator: 18
operands: 26
10Operationoperator: 11
operand: 13
11Literal
12ExprTuple13
13Lambdaparameter: 23
body: 15
14ExprTuple23
15Conditionalvalue: 16
condition: 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple23, 22
20Literal
21ExprTuple23, 24
22Variable
23Variable
24Operationoperator: 25
operands: 26
25Literal
26ExprTuple27
27ExprRangelambda_map: 28
start_index: 29
end_index: 30
28Lambdaparameter: 34
body: 31
29Literal
30Variable
31IndexedVarvariable: 32
index: 34
32Variable
33ExprTuple34
34Variable