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 Conditional, ExprTuple, Lambda, a, n
from proveit.core_expr_types import b_1_to_n
from proveit.logic import Forall, InSet
from proveit.numbers import DecimalSequence, Digits, Natural, NaturalPos, greater, zero
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(n, Conditional(Forall(instance_param_or_params = [a, b_1_to_n], instance_expr = InSet(DecimalSequence(a, b_1_to_n), NaturalPos), domain = Digits, condition = greater(a, zero)), InSet(n, Natural))))
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(n \mapsto \left\{\forall_{a, b_{1}, b_{2}, \ldots, b_{n} \in \mathbb{N}^{\leq 9}~|~a > 0}~\left(\texttt{\#}(a ~ b_{1}, b_{2}, \ldots, b_{n}) \in \mathbb{N}^+\right) \textrm{ if } n \in \mathbb{N}\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 34
body: 3
2ExprTuple34
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 35
operands: 8
6Literal
7ExprTuple9
8ExprTuple34, 10
9Lambdaparameters: 23
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 35
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20, 21
17Operationoperator: 22
operands: 23
18Literal
19Operationoperator: 35
operands: 24
20ExprRangelambda_map: 25
start_index: 33
end_index: 34
21Operationoperator: 26
operands: 27
22Literal
23ExprTuple31, 28
24ExprTuple31, 38
25Lambdaparameter: 41
body: 29
26Literal
27ExprTuple30, 31
28ExprRangelambda_map: 32
start_index: 33
end_index: 34
29Operationoperator: 35
operands: 36
30Literal
31Variable
32Lambdaparameter: 41
body: 37
33Literal
34Variable
35Literal
36ExprTuple37, 38
37IndexedVarvariable: 39
index: 41
38Literal
39Variable
40ExprTuple41
41Variable