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 ExprTuple, Lambda, a, b, f, i, j, k, l
from proveit.core_expr_types.tuples import shift_equiv_both
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Add, Integer, Natural, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(f, Forall(instance_param_or_params = [a, b], instance_expr = 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))]), domain = 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(f \mapsto \left[\forall_{a, b \in \mathbb{Z}}~\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)\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
1Lambdaparameter: 55
body: 3
2ExprTuple55
3Operationoperator: 10
operand: 5
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple72, 74
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 24
operands: 12
10Literal
11ExprTuple13
12ExprTuple14, 15
13Lambdaparameters: 16
body: 17
14Operationoperator: 33
operands: 18
15Operationoperator: 33
operands: 19
16ExprTuple71, 69, 59, 60
17Conditionalvalue: 20
condition: 21
18ExprTuple72, 22
19ExprTuple74, 22
20Operationoperator: 36
operands: 23
21Operationoperator: 24
operands: 25
22Literal
23ExprTuple26, 27
24Literal
25ExprTuple28, 29, 30
26ExprTuple31
27ExprTuple32
28Operationoperator: 33
operands: 34
29Operationoperator: 36
operands: 35
30Operationoperator: 36
operands: 37
31ExprRangelambda_map: 38
start_index: 71
end_index: 69
32ExprRangelambda_map: 39
start_index: 59
end_index: 60
33Literal
34ExprTuple40, 41
35ExprTuple42, 43
36Literal
37ExprTuple44, 45
38Lambdaparameter: 73
body: 46
39Lambdaparameter: 73
body: 48
40Operationoperator: 67
operands: 49
41Literal
42Operationoperator: 67
operands: 50
43Operationoperator: 67
operands: 51
44Operationoperator: 67
operands: 52
45Operationoperator: 67
operands: 53
46Operationoperator: 55
operand: 61
47ExprTuple73
48Operationoperator: 55
operand: 62
49ExprTuple57, 58
50ExprTuple71, 72
51ExprTuple59, 74
52ExprTuple69, 72
53ExprTuple60, 74
54ExprTuple61
55Variable
56ExprTuple62
57Operationoperator: 67
operands: 63
58Operationoperator: 64
operand: 71
59Variable
60Variable
61Operationoperator: 67
operands: 66
62Operationoperator: 67
operands: 68
63ExprTuple69, 70
64Literal
65ExprTuple71
66ExprTuple73, 72
67Literal
68ExprTuple73, 74
69Variable
70Literal
71Variable
72Variable
73Variable
74Variable