logo

Expression of type Forall

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, 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 = 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))
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())
\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)
In [5]:
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 [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 13
operand: 2
1ExprTuple2
2Lambdaparameters: 8
body: 3
3Operationoperator: 4
operands: 5
4Literal
5ExprTuple6, 7
6Operationoperator: 20
operands: 8
7Operationoperator: 9
operands: 10
8ExprTuple29, 24
9Literal
10ExprTuple11, 12
11Operationoperator: 20
operands: 28
12Operationoperator: 13
operand: 15
13Literal
14ExprTuple15
15Lambdaparameter: 25
body: 17
16ExprTuple25
17Conditionalvalue: 18
condition: 19
18Operationoperator: 20
operands: 21
19Operationoperator: 22
operands: 23
20Literal
21ExprTuple25, 24
22Literal
23ExprTuple25, 26
24Variable
25Variable
26Operationoperator: 27
operands: 28
27Literal
28ExprTuple29
29ExprRangelambda_map: 30
start_index: 31
end_index: 32
30Lambdaparameter: 36
body: 33
31Literal
32Variable
33IndexedVarvariable: 34
index: 36
34Variable
35ExprTuple36
36Variable