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 Conditional, Function, Lambda, Q, f, i, j, k
from proveit.core_expr_types import a_1_to_i, b_1_to_j, c_1_to_k
from proveit.logic import And, Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Mult, Natural, NaturalPos, 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([i, j, k], Conditional(Forall(instance_param_or_params = [f, Q], instance_expr = 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)), And(InSet(i, Natural), InSet(j, NaturalPos), 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_{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[\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) \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
1ExprTuple68, 79, 72
2Conditionalvalue: 3
condition: 4
3Operationoperator: 23
operand: 7
4Operationoperator: 36
operands: 6
5ExprTuple7
6ExprTuple8, 9, 10
7Lambdaparameters: 11
body: 12
8Operationoperator: 54
operands: 13
9Operationoperator: 54
operands: 14
10Operationoperator: 54
operands: 15
11ExprTuple69, 66
12Operationoperator: 16
operands: 17
13ExprTuple68, 19
14ExprTuple79, 18
15ExprTuple72, 19
16Literal
17ExprTuple20, 21
18Literal
19Literal
20Operationoperator: 23
operand: 25
21Operationoperator: 23
operand: 26
22ExprTuple25
23Literal
24ExprTuple26
25Lambdaparameters: 70
body: 27
26Lambdaparameters: 28
body: 29
27Conditionalvalue: 30
condition: 62
28ExprTuple63, 65
29Conditionalvalue: 31
condition: 32
30Operationoperator: 54
operands: 33
31Operationoperator: 34
operands: 35
32Operationoperator: 36
operands: 37
33ExprTuple64, 58
34Literal
35ExprTuple38, 39
36Literal
37ExprTuple40, 41
38Operationoperator: 60
operands: 42
39Operationoperator: 50
operand: 47
40ExprRangelambda_map: 44
start_index: 78
end_index: 68
41ExprRangelambda_map: 45
start_index: 78
end_index: 72
42ExprTuple63, 46, 65
43ExprTuple47
44Lambdaparameter: 84
body: 48
45Lambdaparameter: 84
body: 49
46Operationoperator: 50
operand: 56
47Lambdaparameters: 70
body: 52
48Operationoperator: 54
operands: 53
49Operationoperator: 54
operands: 55
50Literal
51ExprTuple56
52Conditionalvalue: 57
condition: 62
53ExprTuple73, 58
54Literal
55ExprTuple75, 58
56Lambdaparameters: 70
body: 59
57Operationoperator: 60
operands: 61
58Literal
59Conditionalvalue: 64
condition: 62
60Literal
61ExprTuple63, 64, 65
62Operationoperator: 66
operands: 70
63ExprRangelambda_map: 67
start_index: 78
end_index: 68
64Operationoperator: 69
operands: 70
65ExprRangelambda_map: 71
start_index: 78
end_index: 72
66Variable
67Lambdaparameter: 84
body: 73
68Variable
69Variable
70ExprTuple74
71Lambdaparameter: 84
body: 75
72Variable
73IndexedVarvariable: 76
index: 84
74ExprRangelambda_map: 77
start_index: 78
end_index: 79
75IndexedVarvariable: 80
index: 84
76Variable
77Lambdaparameter: 84
body: 81
78Literal
79Variable
80Variable
81IndexedVarvariable: 82
index: 84
82Variable
83ExprTuple84
84Variable