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, 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(a, Conditional(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))]), InSet(a, 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(a \mapsto \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) \textrm{ if } a \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
1Lambdaparameter: 64
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 24
operands: 7
5Literal
6ExprTuple8
7ExprTuple64, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple62, 60, 49, 50
11Conditionalvalue: 12
condition: 13
12Operationoperator: 27
operands: 14
13Operationoperator: 15
operands: 16
14ExprTuple17, 18
15Literal
16ExprTuple19, 20, 21
17ExprTuple22
18ExprTuple23
19Operationoperator: 24
operands: 25
20Operationoperator: 27
operands: 26
21Operationoperator: 27
operands: 28
22ExprRangelambda_map: 29
start_index: 52
end_index: 30
23ExprRangelambda_map: 31
start_index: 32
end_index: 33
24Literal
25ExprTuple34, 35
26ExprTuple49, 36
27Literal
28ExprTuple50, 37
29Lambdaparameter: 69
body: 38
30Operationoperator: 66
operand: 60
31Lambdaparameter: 69
body: 40
32Operationoperator: 66
operand: 49
33Operationoperator: 66
operand: 50
34Operationoperator: 58
operands: 43
35Literal
36Operationoperator: 58
operands: 44
37Operationoperator: 58
operands: 45
38Operationoperator: 47
operand: 63
39ExprTuple60
40Operationoperator: 47
operand: 54
41ExprTuple49
42ExprTuple50
43ExprTuple51, 52
44ExprTuple62, 53
45ExprTuple60, 53
46ExprTuple63
47Variable
48ExprTuple54
49Variable
50Variable
51Operationoperator: 58
operands: 55
52Operationoperator: 66
operand: 62
53Operationoperator: 66
operand: 64
54Operationoperator: 58
operands: 59
55ExprTuple60, 61
56ExprTuple62
57ExprTuple64
58Literal
59ExprTuple63, 64
60Variable
61Operationoperator: 66
operand: 68
62Variable
63Operationoperator: 66
operand: 69
64Variable
65ExprTuple68
66Literal
67ExprTuple69
68Literal
69Variable