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.logic import Boolean, Implies, InSet, Not, 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(ExprRange(sub_expr1, Not(sub_expr2), one, 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), (\lnot A_{1}) \lor  (\lnot A_{2}) \lor  \ldots \lor  (\lnot 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: 31
body: 10
6Lambdaparameter: 31
body: 11
7Literal
8ExprTuple12
9Lambdaparameter: 31
body: 13
10Operationoperator: 15
operands: 14
11Operationoperator: 15
operands: 16
12ExprRangelambda_map: 17
start_index: 18
end_index: 19
13Operationoperator: 20
operands: 21
14ExprTuple28, 22
15Literal
16ExprTuple24, 22
17Lambdaparameter: 31
body: 23
18Literal
19Variable
20Literal
21ExprTuple28, 24
22Literal
23Operationoperator: 25
operand: 28
24IndexedVarvariable: 27
index: 31
25Literal
26ExprTuple28
27Variable
28IndexedVarvariable: 29
index: 31
29Variable
30ExprTuple31
31Variable