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