logo

Expression of type ExprTuple

from the theory of proveit.numbers

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 ExprTuple, a, b, c, d, x, y
from proveit.numbers import Add, Mult
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Add(c, y)
sub_expr2 = Mult(Add(d, b), Add(b, c))
expr = ExprTuple(Add(sub_expr2, Mult(Add(x, d), sub_expr1)), Add(sub_expr2, Mult(Add(x, a), sub_expr1)))
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(\left(d + b\right) \cdot \left(b + c\right)\right) + \left(\left(x + d\right) \cdot \left(c + y\right)\right), \left(\left(d + b\right) \cdot \left(b + c\right)\right) + \left(\left(x + a\right) \cdot \left(c + y\right)\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
1Operationoperator: 21
operands: 3
2Operationoperator: 21
operands: 4
3ExprTuple6, 5
4ExprTuple6, 7
5Operationoperator: 10
operands: 8
6Operationoperator: 10
operands: 9
7Operationoperator: 10
operands: 11
8ExprTuple12, 16
9ExprTuple13, 14
10Literal
11ExprTuple15, 16
12Operationoperator: 21
operands: 17
13Operationoperator: 21
operands: 18
14Operationoperator: 21
operands: 19
15Operationoperator: 21
operands: 20
16Operationoperator: 21
operands: 22
17ExprTuple25, 23
18ExprTuple23, 24
19ExprTuple24, 27
20ExprTuple25, 26
21Literal
22ExprTuple27, 28
23Variable
24Variable
25Variable
26Variable
27Variable
28Variable