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