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 neg_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 = neg_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: 60
body: 3
2ExprTuple60
3Operationoperator: 10
operand: 5
4ExprTuple5
5Lambdaparameters: 6
body: 7
6ExprTuple76, 78
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
16ExprTuple75, 73, 64, 65
17Conditionalvalue: 20
condition: 21
18ExprTuple76, 22
19ExprTuple78, 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: 63
end_index: 39
32ExprRangelambda_map: 40
start_index: 41
end_index: 42
33Literal
34ExprTuple43, 44
35ExprTuple45, 46
36Literal
37ExprTuple47, 48
38Lambdaparameter: 81
body: 49
39Operationoperator: 79
operand: 73
40Lambdaparameter: 81
body: 51
41Operationoperator: 79
operand: 64
42Operationoperator: 79
operand: 65
43Operationoperator: 71
operands: 54
44Literal
45Operationoperator: 71
operands: 55
46Operationoperator: 71
operands: 56
47Operationoperator: 71
operands: 57
48Operationoperator: 71
operands: 58
49Operationoperator: 60
operand: 66
50ExprTuple73
51Operationoperator: 60
operand: 67
52ExprTuple64
53ExprTuple65
54ExprTuple62, 63
55ExprTuple75, 76
56ExprTuple64, 78
57ExprTuple73, 76
58ExprTuple65, 78
59ExprTuple66
60Variable
61ExprTuple67
62Operationoperator: 71
operands: 68
63Operationoperator: 79
operand: 75
64Variable
65Variable
66Operationoperator: 71
operands: 70
67Operationoperator: 71
operands: 72
68ExprTuple73, 74
69ExprTuple75
70ExprTuple77, 76
71Literal
72ExprTuple77, 78
73Variable
74Literal
75Variable
76Variable
77Operationoperator: 79
operand: 81
78Variable
79Literal
80ExprTuple81
81Variable