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, Function, Lambda, f, i, j
from proveit.core_expr_types import f_i_to_j
from proveit.logic import Equals
from proveit.numbers import Add, eight, five, four, one, seven, six, three, two
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Add(i, eight)
expr = ExprTuple(Lambda([f, i, j], Conditional(Equals([f_i_to_j], [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)]), Function(f, [Add(i, seven)]), Function(f, [sub_expr1])]), Equals(j, 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(f, i, j\right) \mapsto \left\{\left(f\left(i\right), f\left(i + 1\right), \ldots, f\left(j\right)\right) = \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), f\left(i + 7\right), f\left(i + 8\right)\right) \textrm{ if } j = \left(i + 8\right)\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
1Lambdaparameters: 2
body: 3
2ExprTuple41, 60, 22
3Conditionalvalue: 4
condition: 5
4Operationoperator: 7
operands: 6
5Operationoperator: 7
operands: 8
6ExprTuple9, 10
7Literal
8ExprTuple22, 40
9ExprTuple11
10ExprTuple12, 13, 14, 15, 16, 17, 18, 19, 20
11ExprRangelambda_map: 21
start_index: 60
end_index: 22
12Operationoperator: 41
operand: 60
13Operationoperator: 41
operand: 33
14Operationoperator: 41
operand: 34
15Operationoperator: 41
operand: 35
16Operationoperator: 41
operand: 36
17Operationoperator: 41
operand: 37
18Operationoperator: 41
operand: 38
19Operationoperator: 41
operand: 39
20Operationoperator: 41
operand: 40
21Lambdaparameter: 52
body: 32
22Variable
23ExprTuple60
24ExprTuple33
25ExprTuple34
26ExprTuple35
27ExprTuple36
28ExprTuple37
29ExprTuple38
30ExprTuple39
31ExprTuple40
32Operationoperator: 41
operand: 52
33Operationoperator: 50
operands: 43
34Operationoperator: 50
operands: 44
35Operationoperator: 50
operands: 45
36Operationoperator: 50
operands: 46
37Operationoperator: 50
operands: 47
38Operationoperator: 50
operands: 48
39Operationoperator: 50
operands: 49
40Operationoperator: 50
operands: 51
41Variable
42ExprTuple52
43ExprTuple60, 53
44ExprTuple60, 54
45ExprTuple60, 55
46ExprTuple60, 56
47ExprTuple60, 57
48ExprTuple60, 58
49ExprTuple60, 59
50Literal
51ExprTuple60, 61
52Variable
53Literal
54Literal
55Literal
56Literal
57Literal
58Literal
59Literal
60Variable
61Literal