logo

Expression of type Lambda

from the theory of proveit.linear_algebra.addition

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, i
from proveit.core_expr_types import a_1_to_i
from proveit.linear_algebra import VecAdd
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Add, Complex, NaturalPos
In [2]:
# build up the expression from sub-expressions
expr = Lambda(i, Conditional(Forall(instance_param_or_params = [a_1_to_i], instance_expr = Equals(VecAdd(a_1_to_i), Add(a_1_to_i)), domain = Complex), InSet(i, NaturalPos)))
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())
i \mapsto \left\{\forall_{a_{1}, a_{2}, \ldots, a_{i} \in \mathbb{C}}~\left(\left(a_{1} +  a_{2} +  \ldots +  a_{i}\right) = \left(a_{1} +  a_{2} +  \ldots +  a_{i}\right)\right) \textrm{ if } i \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
0Lambdaparameter: 28
body: 2
1ExprTuple28
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 29
operands: 7
5Literal
6ExprTuple8
7ExprTuple28, 9
8Lambdaparameters: 22
body: 10
9Literal
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19
17Operationoperator: 20
operands: 22
18Operationoperator: 21
operands: 22
19ExprRangelambda_map: 23
start_index: 27
end_index: 28
20Literal
21Literal
22ExprTuple24
23Lambdaparameter: 35
body: 25
24ExprRangelambda_map: 26
start_index: 27
end_index: 28
25Operationoperator: 29
operands: 30
26Lambdaparameter: 35
body: 31
27Literal
28Variable
29Literal
30ExprTuple31, 32
31IndexedVarvariable: 33
index: 35
32Literal
33Variable
34ExprTuple35
35Variable