logo

Expression of type Lambda

from the theory of proveit.numbers.addition.subtraction

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, b, d, i, j, k
from proveit.core_expr_types import a_1_to_i, c_1_to_j, e_1_to_k
from proveit.logic import And, Equals, Forall, InSet
from proveit.numbers import Add, Complex, Natural, Neg
In [2]:
# build up the expression from sub-expressions
expr = Lambda([i, j, k], Conditional(Forall(instance_param_or_params = [a_1_to_i, b, c_1_to_j, d, e_1_to_k], instance_expr = Equals(Add(a_1_to_i, Neg(b), c_1_to_j, d, e_1_to_k), Add(a_1_to_i, c_1_to_j, e_1_to_k)), domain = Complex), And(InSet(i, Natural), InSet(j, Natural), InSet(k, Natural))))
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())
\left(i, j, k\right) \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i}, b, c_{1}, c_{2}, \ldots, c_{j}, d, e_{1}, e_{2}, \ldots, e_{k} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i} - b+ c_{1} +  c_{2} +  \ldots +  c_{j} + d+ e_{1} +  e_{2} +  \ldots +  e_{k}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}+ c_{1} +  c_{2} +  \ldots +  c_{j}+ e_{1} +  e_{2} +  \ldots +  e_{k}\right)\right) \textrm{ if } i \in \mathbb{N} ,  j \in \mathbb{N} ,  k \in \mathbb{N}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameters: 1
body: 2
1ExprTuple50, 52, 55
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 22
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10, 11
8Lambdaparameters: 12
body: 13
9Operationoperator: 58
operands: 14
10Operationoperator: 58
operands: 15
11Operationoperator: 58
operands: 16
12ExprTuple40, 60, 41, 45, 42
13Conditionalvalue: 17
condition: 18
14ExprTuple50, 19
15ExprTuple52, 19
16ExprTuple55, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 22
operands: 23
19Literal
20Literal
21ExprTuple24, 25
22Literal
23ExprTuple26, 27, 28, 29, 30
24Operationoperator: 32
operands: 31
25Operationoperator: 32
operands: 33
26ExprRangelambda_map: 34
start_index: 54
end_index: 50
27Operationoperator: 58
operands: 35
28ExprRangelambda_map: 36
start_index: 54
end_index: 52
29Operationoperator: 58
operands: 37
30ExprRangelambda_map: 38
start_index: 54
end_index: 55
31ExprTuple40, 39, 41, 45, 42
32Literal
33ExprTuple40, 41, 42
34Lambdaparameter: 69
body: 43
35ExprTuple60, 64
36Lambdaparameter: 69
body: 44
37ExprTuple45, 64
38Lambdaparameter: 69
body: 46
39Operationoperator: 47
operand: 60
40ExprRangelambda_map: 49
start_index: 54
end_index: 50
41ExprRangelambda_map: 51
start_index: 54
end_index: 52
42ExprRangelambda_map: 53
start_index: 54
end_index: 55
43Operationoperator: 58
operands: 56
44Operationoperator: 58
operands: 57
45Variable
46Operationoperator: 58
operands: 59
47Literal
48ExprTuple60
49Lambdaparameter: 69
body: 61
50Variable
51Lambdaparameter: 69
body: 62
52Variable
53Lambdaparameter: 69
body: 63
54Literal
55Variable
56ExprTuple61, 64
57ExprTuple62, 64
58Literal
59ExprTuple63, 64
60Variable
61IndexedVarvariable: 65
index: 69
62IndexedVarvariable: 66
index: 69
63IndexedVarvariable: 67
index: 69
64Literal
65Variable
66Variable
67Variable
68ExprTuple69
69Variable