logo

Expression of type ExprTuple

from the theory of proveit.numbers.numerals.decimals

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, Function, f, i
from proveit.numbers import Add, five, four, one, six, three, two
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Function(f, [i]), Function(f, [Add(i, one)]), Function(f, [Add(i, two)]), Function(f, [Add(i, three)]), Function(f, [Add(i, four)]), Function(f, [Add(i, five)]), Function(f, [Add(i, six)]))
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(f\left(i\right), f\left(i + 1\right), f\left(i + 2\right), f\left(i + 3\right), f\left(i + 4\right), f\left(i + 5\right), f\left(i + 6\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, 5, 6, 7
1Operationoperator: 14
operand: 34
2Operationoperator: 14
operand: 16
3Operationoperator: 14
operand: 17
4Operationoperator: 14
operand: 18
5Operationoperator: 14
operand: 19
6Operationoperator: 14
operand: 20
7Operationoperator: 14
operand: 21
8ExprTuple34
9ExprTuple16
10ExprTuple17
11ExprTuple18
12ExprTuple19
13ExprTuple20
14Variable
15ExprTuple21
16Operationoperator: 27
operands: 22
17Operationoperator: 27
operands: 23
18Operationoperator: 27
operands: 24
19Operationoperator: 27
operands: 25
20Operationoperator: 27
operands: 26
21Operationoperator: 27
operands: 28
22ExprTuple34, 29
23ExprTuple34, 30
24ExprTuple34, 31
25ExprTuple34, 32
26ExprTuple34, 33
27Literal
28ExprTuple34, 35
29Literal
30Literal
31Literal
32Literal
33Literal
34Variable
35Literal