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 ExprRange, ExprTuple, IndexedVar, Variable, a, b, c, d, k, m, n
from proveit.core_expr_types import b_1_to_n
from proveit.logic import Equals, InSet
from proveit.numbers import Add, Digits, one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(ExprRange(sub_expr1, InSet(IndexedVar(a, sub_expr1), Digits), one, m), ExprRange(sub_expr1, InSet(IndexedVar(b, sub_expr1), Digits), one, n), InSet(c, Digits), ExprRange(sub_expr1, InSet(IndexedVar(d, sub_expr1), Digits), one, k), Equals(Add(b_1_to_n), c))
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{N}^{\leq 9}\right), \left(a_{2} \in \mathbb{N}^{\leq 9}\right), \ldots, \left(a_{m} \in \mathbb{N}^{\leq 9}\right),\left(b_{1} \in \mathbb{N}^{\leq 9}\right), \left(b_{2} \in \mathbb{N}^{\leq 9}\right), \ldots, \left(b_{n} \in \mathbb{N}^{\leq 9}\right), c \in \mathbb{N}^{\leq 9},\left(d_{1} \in \mathbb{N}^{\leq 9}\right), \left(d_{2} \in \mathbb{N}^{\leq 9}\right), \ldots, \left(d_{k} \in \mathbb{N}^{\leq 9}\right), \left(b_{1} +  b_{2} +  \ldots +  b_{n}\right) = c\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
1ExprRangelambda_map: 6
start_index: 32
end_index: 7
2ExprRangelambda_map: 8
start_index: 32
end_index: 33
3Operationoperator: 21
operands: 9
4ExprRangelambda_map: 10
start_index: 32
end_index: 11
5Operationoperator: 12
operands: 13
6Lambdaparameter: 37
body: 14
7Variable
8Lambdaparameter: 37
body: 15
9ExprTuple18, 27
10Lambdaparameter: 37
body: 16
11Variable
12Literal
13ExprTuple17, 18
14Operationoperator: 21
operands: 19
15Operationoperator: 21
operands: 20
16Operationoperator: 21
operands: 22
17Operationoperator: 23
operands: 24
18Variable
19ExprTuple25, 27
20ExprTuple34, 27
21Literal
22ExprTuple26, 27
23Literal
24ExprTuple28
25IndexedVarvariable: 29
index: 37
26IndexedVarvariable: 30
index: 37
27Literal
28ExprRangelambda_map: 31
start_index: 32
end_index: 33
29Variable
30Variable
31Lambdaparameter: 37
body: 34
32Literal
33Variable
34IndexedVarvariable: 35
index: 37
35Variable
36ExprTuple37
37Variable