logo

Expression of type ExprTuple

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, ExprTuple, 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 = ExprTuple(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())
\left(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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 41
body: 3
2ExprTuple41
3Conditionalvalue: 4
condition: 5
4Operationoperator: 16
operand: 8
5Operationoperator: 29
operands: 7
6ExprTuple8
7ExprTuple41, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple35, 36
11Operationoperator: 12
operands: 13
12Literal
13ExprTuple14, 15
14Operationoperator: 16
operand: 20
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20
18Literal
19ExprTuple21, 22
20Lambdaparameters: 37
body: 23
21Operationoperator: 24
operand: 28
22Operationoperator: 25
operand: 28
23Conditionalvalue: 27
condition: 34
24Literal
25Literal
26ExprTuple28
27Operationoperator: 29
operands: 30
28Lambdaparameters: 37
body: 31
29Literal
30ExprTuple33, 32
31Conditionalvalue: 33
condition: 34
32Literal
33Operationoperator: 35
operands: 37
34Operationoperator: 36
operands: 37
35Variable
36Variable
37ExprTuple38
38ExprRangelambda_map: 39
start_index: 40
end_index: 41
39Lambdaparameter: 45
body: 42
40Literal
41Variable
42IndexedVarvariable: 43
index: 45
43Variable
44ExprTuple45
45Variable