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 neg_shift_equiv
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import 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 = neg_shift_equiv, conditions = [InSet(subtract(subtract(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: 50
body: 2
1ExprTuple50
2Operationoperator: 8
operand: 4
3ExprTuple4
4Lambdaparameter: 67
body: 5
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operand: 11
7Operationoperator: 27
operands: 10
8Literal
9ExprTuple11
10ExprTuple67, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple65, 63, 52, 53
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: 55
end_index: 33
26ExprRangelambda_map: 34
start_index: 35
end_index: 36
27Literal
28ExprTuple37, 38
29ExprTuple52, 39
30Literal
31ExprTuple53, 40
32Lambdaparameter: 72
body: 41
33Operationoperator: 69
operand: 63
34Lambdaparameter: 72
body: 43
35Operationoperator: 69
operand: 52
36Operationoperator: 69
operand: 53
37Operationoperator: 61
operands: 46
38Literal
39Operationoperator: 61
operands: 47
40Operationoperator: 61
operands: 48
41Operationoperator: 50
operand: 66
42ExprTuple63
43Operationoperator: 50
operand: 57
44ExprTuple52
45ExprTuple53
46ExprTuple54, 55
47ExprTuple65, 56
48ExprTuple63, 56
49ExprTuple66
50Variable
51ExprTuple57
52Variable
53Variable
54Operationoperator: 61
operands: 58
55Operationoperator: 69
operand: 65
56Operationoperator: 69
operand: 67
57Operationoperator: 61
operands: 62
58ExprTuple63, 64
59ExprTuple65
60ExprTuple67
61Literal
62ExprTuple66, 67
63Variable
64Operationoperator: 69
operand: 71
65Variable
66Operationoperator: 69
operand: 72
67Variable
68ExprTuple71
69Literal
70ExprTuple72
71Literal
72Variable