logo

Expression of type ExprTuple

from the theory of proveit.core_expr_types.tuples

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, b, i, j, k, l
from proveit.core_expr_types.tuples import shift_equiv_both
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Integer, Natural, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([a, b], Conditional(Forall(instance_param_or_params = [i, j, k, l], instance_expr = shift_equiv_both, conditions = [InSet(subtract(Add(j, one), i), Natural), Equals(Add(i, a), Add(k, b)), Equals(Add(j, a), Add(l, b))]), And(InSet(a, Integer), InSet(b, Integer)))))
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, b\right) \mapsto \left\{\forall_{i, j, k, l~|~\left(\left(j + 1\right) - i\right) \in \mathbb{N}, \left(i + a\right) = \left(k + b\right), \left(j + a\right) = \left(l + b\right)}~\left(\left(f\left(i + a\right), f\left(\left(i + 1\right) + a\right), \ldots, f\left(j + a\right)\right) = \left(f\left(k + b\right), f\left(\left(k + 1\right) + b\right), \ldots, f\left(l + b\right)\right)\right) \textrm{ if } a \in \mathbb{Z} ,  b \in \mathbb{Z}\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
2ExprTuple68, 70
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 20
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameters: 12
body: 13
10Operationoperator: 29
operands: 14
11Operationoperator: 29
operands: 15
12ExprTuple67, 65, 55, 56
13Conditionalvalue: 16
condition: 17
14ExprTuple68, 18
15ExprTuple70, 18
16Operationoperator: 32
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22ExprTuple27
23ExprTuple28
24Operationoperator: 29
operands: 30
25Operationoperator: 32
operands: 31
26Operationoperator: 32
operands: 33
27ExprRangelambda_map: 34
start_index: 67
end_index: 65
28ExprRangelambda_map: 35
start_index: 55
end_index: 56
29Literal
30ExprTuple36, 37
31ExprTuple38, 39
32Literal
33ExprTuple40, 41
34Lambdaparameter: 69
body: 42
35Lambdaparameter: 69
body: 44
36Operationoperator: 63
operands: 45
37Literal
38Operationoperator: 63
operands: 46
39Operationoperator: 63
operands: 47
40Operationoperator: 63
operands: 48
41Operationoperator: 63
operands: 49
42Operationoperator: 51
operand: 57
43ExprTuple69
44Operationoperator: 51
operand: 58
45ExprTuple53, 54
46ExprTuple67, 68
47ExprTuple55, 70
48ExprTuple65, 68
49ExprTuple56, 70
50ExprTuple57
51Variable
52ExprTuple58
53Operationoperator: 63
operands: 59
54Operationoperator: 60
operand: 67
55Variable
56Variable
57Operationoperator: 63
operands: 62
58Operationoperator: 63
operands: 64
59ExprTuple65, 66
60Literal
61ExprTuple67
62ExprTuple69, 68
63Literal
64ExprTuple69, 70
65Variable
66Literal
67Variable
68Variable
69Variable
70Variable