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 And, Equals, InSet
from proveit.numbers import Natural, one, subtract
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([i, j, k, l], Conditional(neg_shift_equiv, And(InSet(subtract(subtract(j, one), i), Natural), Equals(k, subtract(i, a)), Equals(l, subtract(j, a))))))
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(\left(i, j, k, l\right) \mapsto \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) \textrm{ if } \left(\left(j - 1\right) - i\right) \in \mathbb{N} ,  k = \left(i - a\right) ,  l = \left(j - a\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
1Lambdaparameters: 2
body: 3
2ExprTuple54, 52, 41, 42
3Conditionalvalue: 4
condition: 5
4Operationoperator: 19
operands: 6
5Operationoperator: 7
operands: 8
6ExprTuple9, 10
7Literal
8ExprTuple11, 12, 13
9ExprTuple14
10ExprTuple15
11Operationoperator: 16
operands: 17
12Operationoperator: 19
operands: 18
13Operationoperator: 19
operands: 20
14ExprRangelambda_map: 21
start_index: 44
end_index: 22
15ExprRangelambda_map: 23
start_index: 24
end_index: 25
16Literal
17ExprTuple26, 27
18ExprTuple41, 28
19Literal
20ExprTuple42, 29
21Lambdaparameter: 61
body: 30
22Operationoperator: 58
operand: 52
23Lambdaparameter: 61
body: 32
24Operationoperator: 58
operand: 41
25Operationoperator: 58
operand: 42
26Operationoperator: 50
operands: 35
27Literal
28Operationoperator: 50
operands: 36
29Operationoperator: 50
operands: 37
30Operationoperator: 39
operand: 55
31ExprTuple52
32Operationoperator: 39
operand: 46
33ExprTuple41
34ExprTuple42
35ExprTuple43, 44
36ExprTuple54, 45
37ExprTuple52, 45
38ExprTuple55
39Variable
40ExprTuple46
41Variable
42Variable
43Operationoperator: 50
operands: 47
44Operationoperator: 58
operand: 54
45Operationoperator: 58
operand: 56
46Operationoperator: 50
operands: 51
47ExprTuple52, 53
48ExprTuple54
49ExprTuple56
50Literal
51ExprTuple55, 56
52Variable
53Operationoperator: 58
operand: 60
54Variable
55Operationoperator: 58
operand: 61
56Variable
57ExprTuple60
58Literal
59ExprTuple61
60Literal
61Variable