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, b, f, i, j, k, l
from proveit.core_expr_types.tuples import shift_equiv_both
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, b], instance_expr = Forall(instance_param_or_params = [i, j, k, l], instance_expr = shift_equiv_both, conditions = [InSet(subtract(Add(j, one), i), Natural), Equals(Add(i, a), Add(k, b)), Equals(Add(j, a), Add(l, b))]), 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, b \in \mathbb{Z}}~\left[\forall_{i, j, k, l~|~\left(\left(j + 1\right) - i\right) \in \mathbb{N}, \left(i + a\right) = \left(k + b\right), \left(j + a\right) = \left(l + b\right)}~\left(\left(f\left(i + a\right), f\left(\left(i + 1\right) + a\right), \ldots, f\left(j + a\right)\right) = \left(f\left(k + b\right), f\left(\left(k + 1\right) + b\right), \ldots, f\left(l + b\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: 54
body: 2
1ExprTuple54
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple71, 73
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 23
operands: 11
9Literal
10ExprTuple12
11ExprTuple13, 14
12Lambdaparameters: 15
body: 16
13Operationoperator: 32
operands: 17
14Operationoperator: 32
operands: 18
15ExprTuple70, 68, 58, 59
16Conditionalvalue: 19
condition: 20
17ExprTuple71, 21
18ExprTuple73, 21
19Operationoperator: 35
operands: 22
20Operationoperator: 23
operands: 24
21Literal
22ExprTuple25, 26
23Literal
24ExprTuple27, 28, 29
25ExprTuple30
26ExprTuple31
27Operationoperator: 32
operands: 33
28Operationoperator: 35
operands: 34
29Operationoperator: 35
operands: 36
30ExprRangelambda_map: 37
start_index: 70
end_index: 68
31ExprRangelambda_map: 38
start_index: 58
end_index: 59
32Literal
33ExprTuple39, 40
34ExprTuple41, 42
35Literal
36ExprTuple43, 44
37Lambdaparameter: 72
body: 45
38Lambdaparameter: 72
body: 47
39Operationoperator: 66
operands: 48
40Literal
41Operationoperator: 66
operands: 49
42Operationoperator: 66
operands: 50
43Operationoperator: 66
operands: 51
44Operationoperator: 66
operands: 52
45Operationoperator: 54
operand: 60
46ExprTuple72
47Operationoperator: 54
operand: 61
48ExprTuple56, 57
49ExprTuple70, 71
50ExprTuple58, 73
51ExprTuple68, 71
52ExprTuple59, 73
53ExprTuple60
54Variable
55ExprTuple61
56Operationoperator: 66
operands: 62
57Operationoperator: 63
operand: 70
58Variable
59Variable
60Operationoperator: 66
operands: 65
61Operationoperator: 66
operands: 67
62ExprTuple68, 69
63Literal
64ExprTuple70
65ExprTuple72, 71
66Literal
67ExprTuple72, 73
68Variable
69Literal
70Variable
71Variable
72Variable
73Variable