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, Conditional, Lambda, X, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import And, Disjoint, Forall, Iff, InSet, Set
from proveit.numbers import Natural
In [2]:
# build up the expression from sub-expressions
expr = Lambda(m, Conditional(Forall(instance_param_or_params = [A_1_to_m, B], instance_expr = 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)), InSet(m, Natural)))
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())
m \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{m}, B}~\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) \textrm{ if } m \in \mathbb{N}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 38
body: 2
1ExprTuple38
2Conditionalvalue: 3
condition: 4
3Operationoperator: 19
operand: 7
4Operationoperator: 28
operands: 6
5ExprTuple7
6ExprTuple38, 8
7Lambdaparameters: 14
body: 9
8Literal
9Operationoperator: 10
operands: 11
10Literal
11ExprTuple12, 13
12Operationoperator: 26
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple35, 30
15Literal
16ExprTuple17, 18
17Operationoperator: 26
operands: 34
18Operationoperator: 19
operand: 21
19Literal
20ExprTuple21
21Lambdaparameter: 31
body: 23
22ExprTuple31
23Conditionalvalue: 24
condition: 25
24Operationoperator: 26
operands: 27
25Operationoperator: 28
operands: 29
26Literal
27ExprTuple31, 30
28Literal
29ExprTuple31, 32
30Variable
31Variable
32Operationoperator: 33
operands: 34
33Literal
34ExprTuple35
35ExprRangelambda_map: 36
start_index: 37
end_index: 38
36Lambdaparameter: 42
body: 39
37Literal
38Variable
39IndexedVarvariable: 40
index: 42
40Variable
41ExprTuple42
42Variable