logo

Expression of type Lambda

from the theory of proveit.numbers.multiplication

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 Function, Lambda, Q, f
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Sum
from proveit.numbers.summation import summation_b1toj_fQ
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [b_1_to_j]
sub_expr2 = Function(f, sub_expr1)
sub_expr3 = Function(Q, sub_expr1)
expr = Lambda([f, Q], Implies(Forall(instance_param_or_params = sub_expr1, instance_expr = InSet(sub_expr2, Complex), condition = sub_expr3), Forall(instance_param_or_params = [a_1_to_i, c_1_to_k], instance_expr = Equals(Mult(a_1_to_i, summation_b1toj_fQ, c_1_to_k), Sum(index_or_indices = sub_expr1, summand = Mult(a_1_to_i, sub_expr2, c_1_to_k), condition = sub_expr3)).with_wrapping_at(2), domain = Complex).with_wrapping()).with_wrapping_at(2))
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(\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[\begin{array}{l}\forall_{a_{1}, a_{2}, \ldots, a_{i}, c_{1}, c_{2}, \ldots, c_{k} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot \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]\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right) =  \\ \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(a_{1} \cdot  a_{2} \cdot  \ldots \cdot  a_{i} \cdot f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{k}\right)\right] \end{array} \end{array}\right)\end{array}\right] \end{array} \end{array}\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
1ExprTuple54, 51
2Operationoperator: 3
operands: 4
3Literal
4ExprTuple5, 6
5Operationoperator: 8
operand: 10
6Operationoperator: 8
operand: 11
7ExprTuple10
8Literal
9ExprTuple11
10Lambdaparameters: 55
body: 12
11Lambdaparameters: 13
body: 14
12Conditionalvalue: 15
condition: 47
13ExprTuple48, 50
14Conditionalvalue: 16
condition: 17
15Operationoperator: 39
operands: 18
16Operationoperator: 19
operands: 20
17Operationoperator: 21
operands: 22
18ExprTuple49, 43
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple25, 26
23Operationoperator: 45
operands: 27
24Operationoperator: 35
operand: 32
25ExprRangelambda_map: 29
start_index: 63
end_index: 53
26ExprRangelambda_map: 30
start_index: 63
end_index: 57
27ExprTuple48, 31, 50
28ExprTuple32
29Lambdaparameter: 69
body: 33
30Lambdaparameter: 69
body: 34
31Operationoperator: 35
operand: 41
32Lambdaparameters: 55
body: 37
33Operationoperator: 39
operands: 38
34Operationoperator: 39
operands: 40
35Literal
36ExprTuple41
37Conditionalvalue: 42
condition: 47
38ExprTuple58, 43
39Literal
40ExprTuple60, 43
41Lambdaparameters: 55
body: 44
42Operationoperator: 45
operands: 46
43Literal
44Conditionalvalue: 49
condition: 47
45Literal
46ExprTuple48, 49, 50
47Operationoperator: 51
operands: 55
48ExprRangelambda_map: 52
start_index: 63
end_index: 53
49Operationoperator: 54
operands: 55
50ExprRangelambda_map: 56
start_index: 63
end_index: 57
51Variable
52Lambdaparameter: 69
body: 58
53Variable
54Variable
55ExprTuple59
56Lambdaparameter: 69
body: 60
57Variable
58IndexedVarvariable: 61
index: 69
59ExprRangelambda_map: 62
start_index: 63
end_index: 64
60IndexedVarvariable: 65
index: 69
61Variable
62Lambdaparameter: 69
body: 66
63Literal
64Variable
65Variable
66IndexedVarvariable: 67
index: 69
67Variable
68ExprTuple69
69Variable