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 shift_equiv
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], instance_expr = Forall(instance_param_or_params = [i, j, k, l], instance_expr = shift_equiv, conditions = [InSet(subtract(Add(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: 47
body: 3
2ExprTuple47
3Operationoperator: 9
operand: 5
4ExprTuple5
5Lambdaparameter: 63
body: 6
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 28
operands: 11
9Literal
10ExprTuple12
11ExprTuple63, 13
12Lambdaparameters: 14
body: 15
13Literal
14ExprTuple61, 59, 37, 39
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: 61
end_index: 59
27ExprRangelambda_map: 34
start_index: 37
end_index: 39
28Literal
29ExprTuple35, 36
30ExprTuple37, 38
31Literal
32ExprTuple39, 40
33Lambdaparameter: 62
body: 41
34Lambdaparameter: 62
body: 42
35Operationoperator: 57
operands: 43
36Literal
37Variable
38Operationoperator: 57
operands: 44
39Variable
40Operationoperator: 57
operands: 45
41Operationoperator: 47
operand: 62
42Operationoperator: 47
operand: 52
43ExprTuple49, 50
44ExprTuple61, 51
45ExprTuple59, 51
46ExprTuple62
47Variable
48ExprTuple52
49Operationoperator: 57
operands: 53
50Operationoperator: 55
operand: 61
51Operationoperator: 55
operand: 63
52Operationoperator: 57
operands: 58
53ExprTuple59, 60
54ExprTuple61
55Literal
56ExprTuple63
57Literal
58ExprTuple62, 63
59Variable
60Literal
61Variable
62Variable
63Variable