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 neg_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 = neg_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: 59
body: 2
1ExprTuple59
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple75, 77
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
15ExprTuple74, 72, 63, 64
16Conditionalvalue: 19
condition: 20
17ExprTuple75, 21
18ExprTuple77, 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: 62
end_index: 38
31ExprRangelambda_map: 39
start_index: 40
end_index: 41
32Literal
33ExprTuple42, 43
34ExprTuple44, 45
35Literal
36ExprTuple46, 47
37Lambdaparameter: 80
body: 48
38Operationoperator: 78
operand: 72
39Lambdaparameter: 80
body: 50
40Operationoperator: 78
operand: 63
41Operationoperator: 78
operand: 64
42Operationoperator: 70
operands: 53
43Literal
44Operationoperator: 70
operands: 54
45Operationoperator: 70
operands: 55
46Operationoperator: 70
operands: 56
47Operationoperator: 70
operands: 57
48Operationoperator: 59
operand: 65
49ExprTuple72
50Operationoperator: 59
operand: 66
51ExprTuple63
52ExprTuple64
53ExprTuple61, 62
54ExprTuple74, 75
55ExprTuple63, 77
56ExprTuple72, 75
57ExprTuple64, 77
58ExprTuple65
59Variable
60ExprTuple66
61Operationoperator: 70
operands: 67
62Operationoperator: 78
operand: 74
63Variable
64Variable
65Operationoperator: 70
operands: 69
66Operationoperator: 70
operands: 71
67ExprTuple72, 73
68ExprTuple74
69ExprTuple76, 75
70Literal
71ExprTuple76, 77
72Variable
73Literal
74Variable
75Variable
76Operationoperator: 78
operand: 80
77Variable
78Literal
79ExprTuple80
80Variable