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 Lambda, Q, f, j, n
from proveit.core_expr_types import x_1_to_n
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Forall
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([f, Q], Forall(instance_param_or_params = [n, j], instance_expr = Forall(instance_param_or_params = [x_1_to_n], instance_expr = Equals(vec_summation_b1toj_fQ, summation_b1toj_fQ), domain = Complex), domain = 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())
\left(f, Q\right) \mapsto \left[\forall_{n, j \in \mathbb{N}^+}~\left[\forall_{x_{1}, x_{2}, \ldots, x_{n} \in \mathbb{C}}~\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)\right]\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
1ExprTuple45, 46
2Operationoperator: 9
operand: 4
3ExprTuple4
4Lambdaparameters: 5
body: 6
5ExprTuple35, 52
6Conditionalvalue: 7
condition: 8
7Operationoperator: 9
operand: 12
8Operationoperator: 26
operands: 11
9Literal
10ExprTuple12
11ExprTuple13, 14
12Lambdaparameters: 15
body: 16
13Operationoperator: 39
operands: 17
14Operationoperator: 39
operands: 18
15ExprTuple19
16Conditionalvalue: 20
condition: 21
17ExprTuple35, 22
18ExprTuple52, 22
19ExprRangelambda_map: 23
start_index: 51
end_index: 35
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operands: 27
22Literal
23Lambdaparameter: 56
body: 43
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple30
28Operationoperator: 31
operand: 36
29Operationoperator: 32
operand: 36
30ExprRangelambda_map: 34
start_index: 51
end_index: 35
31Literal
32Literal
33ExprTuple36
34Lambdaparameter: 56
body: 37
35Variable
36Lambdaparameters: 47
body: 38
37Operationoperator: 39
operands: 40
38Conditionalvalue: 41
condition: 42
39Literal
40ExprTuple43, 44
41Operationoperator: 45
operands: 47
42Operationoperator: 46
operands: 47
43IndexedVarvariable: 48
index: 56
44Literal
45Variable
46Variable
47ExprTuple49
48Variable
49ExprRangelambda_map: 50
start_index: 51
end_index: 52
50Lambdaparameter: 56
body: 53
51Literal
52Variable
53IndexedVarvariable: 54
index: 56
54Variable
55ExprTuple56
56Variable