logo

Expression of type Lambda

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 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 = 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())
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]
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 46
body: 2
1ExprTuple46
2Operationoperator: 8
operand: 4
3ExprTuple4
4Lambdaparameter: 62
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 27
operands: 10
8Literal
9ExprTuple11
10ExprTuple62, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple60, 58, 36, 38
14Conditionalvalue: 15
condition: 16
15Operationoperator: 30
operands: 17
16Operationoperator: 18
operands: 19
17ExprTuple20, 21
18Literal
19ExprTuple22, 23, 24
20ExprTuple25
21ExprTuple26
22Operationoperator: 27
operands: 28
23Operationoperator: 30
operands: 29
24Operationoperator: 30
operands: 31
25ExprRangelambda_map: 32
start_index: 60
end_index: 58
26ExprRangelambda_map: 33
start_index: 36
end_index: 38
27Literal
28ExprTuple34, 35
29ExprTuple36, 37
30Literal
31ExprTuple38, 39
32Lambdaparameter: 61
body: 40
33Lambdaparameter: 61
body: 41
34Operationoperator: 56
operands: 42
35Literal
36Variable
37Operationoperator: 56
operands: 43
38Variable
39Operationoperator: 56
operands: 44
40Operationoperator: 46
operand: 61
41Operationoperator: 46
operand: 51
42ExprTuple48, 49
43ExprTuple60, 50
44ExprTuple58, 50
45ExprTuple61
46Variable
47ExprTuple51
48Operationoperator: 56
operands: 52
49Operationoperator: 54
operand: 60
50Operationoperator: 54
operand: 62
51Operationoperator: 56
operands: 57
52ExprTuple58, 59
53ExprTuple60
54Literal
55ExprTuple62
56Literal
57ExprTuple61, 62
58Variable
59Literal
60Variable
61Variable
62Variable