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, Q, f, j
from proveit.core_expr_types import Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, NaturalPos
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
expr = Lambda(j, Conditional(Forall(instance_param_or_params = [f, Q], instance_expr = Implies(Forall(instance_param_or_params = [b_1_to_j], instance_expr = InSet(f__b_1_to_j, Complex), condition = Q__b_1_to_j), Equals(vec_summation_b1toj_fQ, summation_b1toj_fQ)).with_wrapping_at(2)), InSet(j, 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())
j \mapsto \left\{\forall_{f, Q}~\left(\begin{array}{c} \begin{array}{l} \left[\forall_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(f\left(b_{1}, b_{2}, \ldots, b_{j}\right) \in \mathbb{C}\right)\right] \Rightarrow  \\ \left(\left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right] = \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]\right) \end{array} \end{array}\right) \textrm{ if } j \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: 40
body: 2
1ExprTuple40
2Conditionalvalue: 3
condition: 4
3Operationoperator: 15
operand: 7
4Operationoperator: 28
operands: 6
5ExprTuple7
6ExprTuple40, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple34, 35
10Operationoperator: 11
operands: 12
11Literal
12ExprTuple13, 14
13Operationoperator: 15
operand: 19
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19
17Literal
18ExprTuple20, 21
19Lambdaparameters: 36
body: 22
20Operationoperator: 23
operand: 27
21Operationoperator: 24
operand: 27
22Conditionalvalue: 26
condition: 33
23Literal
24Literal
25ExprTuple27
26Operationoperator: 28
operands: 29
27Lambdaparameters: 36
body: 30
28Literal
29ExprTuple32, 31
30Conditionalvalue: 32
condition: 33
31Literal
32Operationoperator: 34
operands: 36
33Operationoperator: 35
operands: 36
34Variable
35Variable
36ExprTuple37
37ExprRangelambda_map: 38
start_index: 39
end_index: 40
38Lambdaparameter: 44
body: 41
39Literal
40Variable
41IndexedVarvariable: 42
index: 44
42Variable
43ExprTuple44
44Variable