# 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.
# import Expression classes needed to build the expression
from proveit import 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 = Forall(instance_param_or_params = [f], instance_expr = 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())

\forall_{f}~\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]

In [5]:
stored_expr.style_options()

namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()

core typesub-expressionsexpression
0Operationoperator: 10
operand: 2
1ExprTuple2
2Lambdaparameter: 48
body: 4
3ExprTuple48
4Operationoperator: 10
operand: 6
5ExprTuple6
6Lambdaparameter: 64
body: 7
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operand: 13
9Operationoperator: 29
operands: 12
10Literal
11ExprTuple13
12ExprTuple64, 14
13Lambdaparameters: 15
body: 16
14Literal
15ExprTuple62, 60, 38, 40
16Conditionalvalue: 17
condition: 18
17Operationoperator: 32
operands: 19
18Operationoperator: 20
operands: 21
19ExprTuple22, 23
20Literal
21ExprTuple24, 25, 26
22ExprTuple27
23ExprTuple28
24Operationoperator: 29
operands: 30
25Operationoperator: 32
operands: 31
26Operationoperator: 32
operands: 33
27ExprRangelambda_map: 34
start_index: 62
end_index: 60
28ExprRangelambda_map: 35
start_index: 38
end_index: 40
29Literal
30ExprTuple36, 37
31ExprTuple38, 39
32Literal
33ExprTuple40, 41
34Lambdaparameter: 63
body: 42
35Lambdaparameter: 63
body: 43
36Operationoperator: 58
operands: 44
37Literal
38Variable
39Operationoperator: 58
operands: 45
40Variable
41Operationoperator: 58
operands: 46
42Operationoperator: 48
operand: 63
43Operationoperator: 48
operand: 53
44ExprTuple50, 51
45ExprTuple62, 52
46ExprTuple60, 52
47ExprTuple63
48Variable
49ExprTuple53
50Operationoperator: 58
operands: 54
51Operationoperator: 56
operand: 62
52Operationoperator: 56
operand: 64
53Operationoperator: 58
operands: 59
54ExprTuple60, 61
55ExprTuple62
56Literal
57ExprTuple64
58Literal
59ExprTuple63, 64
60Variable
61Literal
62Variable
63Variable
64Variable