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 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(a, Conditional(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))]), 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: 59
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 24
operands: 7
5Literal
6ExprTuple8
7ExprTuple59, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple57, 55, 33, 35
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: 57
end_index: 55
23ExprRangelambda_map: 30
start_index: 33
end_index: 35
24Literal
25ExprTuple31, 32
26ExprTuple33, 34
27Literal
28ExprTuple35, 36
29Lambdaparameter: 58
body: 37
30Lambdaparameter: 58
body: 38
31Operationoperator: 53
operands: 39
32Literal
33Variable
34Operationoperator: 53
operands: 40
35Variable
36Operationoperator: 53
operands: 41
37Operationoperator: 43
operand: 58
38Operationoperator: 43
operand: 48
39ExprTuple45, 46
40ExprTuple57, 47
41ExprTuple55, 47
42ExprTuple58
43Variable
44ExprTuple48
45Operationoperator: 53
operands: 49
46Operationoperator: 51
operand: 57
47Operationoperator: 51
operand: 59
48Operationoperator: 53
operands: 54
49ExprTuple55, 56
50ExprTuple57
51Literal
52ExprTuple59
53Literal
54ExprTuple58, 59
55Variable
56Literal
57Variable
58Variable
59Variable