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 Conditional, Lambda, a, 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(a, Conditional(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))]), InSet(a, 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())
a \mapsto \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) \textrm{ if } a \in \mathbb{Z}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 63
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 23
operands: 6
4Literal
5ExprTuple7
6ExprTuple63, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple61, 59, 48, 49
10Conditionalvalue: 11
condition: 12
11Operationoperator: 26
operands: 13
12Operationoperator: 14
operands: 15
13ExprTuple16, 17
14Literal
15ExprTuple18, 19, 20
16ExprTuple21
17ExprTuple22
18Operationoperator: 23
operands: 24
19Operationoperator: 26
operands: 25
20Operationoperator: 26
operands: 27
21ExprRangelambda_map: 28
start_index: 51
end_index: 29
22ExprRangelambda_map: 30
start_index: 31
end_index: 32
23Literal
24ExprTuple33, 34
25ExprTuple48, 35
26Literal
27ExprTuple49, 36
28Lambdaparameter: 68
body: 37
29Operationoperator: 65
operand: 59
30Lambdaparameter: 68
body: 39
31Operationoperator: 65
operand: 48
32Operationoperator: 65
operand: 49
33Operationoperator: 57
operands: 42
34Literal
35Operationoperator: 57
operands: 43
36Operationoperator: 57
operands: 44
37Operationoperator: 46
operand: 62
38ExprTuple59
39Operationoperator: 46
operand: 53
40ExprTuple48
41ExprTuple49
42ExprTuple50, 51
43ExprTuple61, 52
44ExprTuple59, 52
45ExprTuple62
46Variable
47ExprTuple53
48Variable
49Variable
50Operationoperator: 57
operands: 54
51Operationoperator: 65
operand: 61
52Operationoperator: 65
operand: 63
53Operationoperator: 57
operands: 58
54ExprTuple59, 60
55ExprTuple61
56ExprTuple63
57Literal
58ExprTuple62, 63
59Variable
60Operationoperator: 65
operand: 67
61Variable
62Operationoperator: 65
operand: 68
63Variable
64ExprTuple67
65Literal
66ExprTuple68
67Literal
68Variable