logo

Expression of type ExprTuple

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, ExprTuple, 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 = ExprTuple(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())
\left(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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 39
body: 3
2ExprTuple39
3Conditionalvalue: 4
condition: 5
4Operationoperator: 20
operand: 8
5Operationoperator: 29
operands: 7
6ExprTuple8
7ExprTuple39, 9
8Lambdaparameters: 15
body: 10
9Literal
10Operationoperator: 11
operands: 12
11Literal
12ExprTuple13, 14
13Operationoperator: 27
operands: 15
14Operationoperator: 16
operands: 17
15ExprTuple36, 31
16Literal
17ExprTuple18, 19
18Operationoperator: 27
operands: 35
19Operationoperator: 20
operand: 22
20Literal
21ExprTuple22
22Lambdaparameter: 32
body: 24
23ExprTuple32
24Conditionalvalue: 25
condition: 26
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operands: 30
27Literal
28ExprTuple32, 31
29Literal
30ExprTuple32, 33
31Variable
32Variable
33Operationoperator: 34
operands: 35
34Literal
35ExprTuple36
36ExprRangelambda_map: 37
start_index: 38
end_index: 39
37Lambdaparameter: 43
body: 40
38Literal
39Variable
40IndexedVarvariable: 41
index: 43
41Variable
42ExprTuple43
43Variable