logo

Expression of type ExprTuple

from the theory of proveit.logic.booleans.disjunction

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 A, B, ExprRange, ExprTuple, IndexedVar, Variable, m
from proveit.core_expr_types import A_1_to_m
from proveit.logic import Boolean, Implies, InSet, Or
from proveit.numbers import one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = IndexedVar(A, sub_expr1)
sub_expr3 = IndexedVar(B, sub_expr1)
expr = ExprTuple(ExprRange(sub_expr1, InSet(sub_expr2, Boolean), one, m), ExprRange(sub_expr1, InSet(sub_expr3, Boolean), one, m), Or(A_1_to_m), ExprRange(sub_expr1, Implies(sub_expr2, sub_expr3), one, m))
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(\left(A_{1} \in \mathbb{B}\right), \left(A_{2} \in \mathbb{B}\right), \ldots, \left(A_{m} \in \mathbb{B}\right),\left(B_{1} \in \mathbb{B}\right), \left(B_{2} \in \mathbb{B}\right), \ldots, \left(B_{m} \in \mathbb{B}\right), A_{1} \lor  A_{2} \lor  \ldots \lor  A_{m},\left(A_{1} \Rightarrow B_{1}\right), \left(A_{2} \Rightarrow B_{2}\right), \ldots, \left(A_{m} \Rightarrow B_{m}\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2, 3, 4
1ExprRangelambda_map: 5
start_index: 18
end_index: 19
2ExprRangelambda_map: 6
start_index: 18
end_index: 19
3Operationoperator: 7
operands: 8
4ExprRangelambda_map: 9
start_index: 18
end_index: 19
5Lambdaparameter: 28
body: 10
6Lambdaparameter: 28
body: 11
7Literal
8ExprTuple12
9Lambdaparameter: 28
body: 13
10Operationoperator: 15
operands: 14
11Operationoperator: 15
operands: 16
12ExprRangelambda_map: 17
start_index: 18
end_index: 19
13Operationoperator: 20
operands: 21
14ExprTuple23, 22
15Literal
16ExprTuple24, 22
17Lambdaparameter: 28
body: 23
18Literal
19Variable
20Literal
21ExprTuple23, 24
22Literal
23IndexedVarvariable: 25
index: 28
24IndexedVarvariable: 26
index: 28
25Variable
26Variable
27ExprTuple28
28Variable