logo

Expression of type ExprTuple

from the theory of proveit.linear_algebra.inner_products

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, M, i, n
from proveit.core_expr_types import a_1_to_n, a_i, x_1_to_n, x_i
from proveit.linear_algebra import Hspace, OrthoNormBases, OrthoProj, ScalarMult, Span, VecSum
from proveit.logic import Equals, Exists, InSet, Set
from proveit.numbers import Complex, Interval, one
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([x_1_to_n], Conditional(Exists(instance_param_or_params = [a_1_to_n], instance_expr = Equals(M, VecSum(index_or_indices = [i], summand = ScalarMult(a_i, OrthoProj(Hspace, Span(Set(x_i)))), domain = Interval(one, n))), domain = Complex).with_wrapping(), InSet(Set(x_1_to_n), OrthoNormBases(Hspace)))))
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(\left(x_{1}, x_{2}, \ldots, x_{n}\right) \mapsto \left\{\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{n} \in \mathbb{C}}~\\
\left(M = \left(\sum_{i=1}^{n} \left(a_{i} \cdot \textrm{OrthoProj}\left(\mathcal{H}, \textrm{Span}\left(\left\{x_{i}\right\}\right)\right)\right)\right)\right)\end{array} \textrm{ if } \left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{O.N.Bases}\left(\mathcal{H}\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
0ExprTuple1
1Lambdaparameters: 13
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 43
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 11
body: 12
9Operationoperator: 62
operands: 13
10Operationoperator: 14
operand: 55
11ExprTuple16
12Conditionalvalue: 17
condition: 18
13ExprTuple19
14Literal
15ExprTuple55
16ExprRangelambda_map: 20
start_index: 57
end_index: 58
17Operationoperator: 21
operands: 22
18Operationoperator: 23
operands: 24
19ExprRangelambda_map: 25
start_index: 57
end_index: 58
20Lambdaparameter: 49
body: 39
21Literal
22ExprTuple26, 27
23Literal
24ExprTuple28
25Lambdaparameter: 49
body: 29
26Variable
27Operationoperator: 30
operand: 33
28ExprRangelambda_map: 32
start_index: 57
end_index: 58
29IndexedVarvariable: 65
index: 49
30Literal
31ExprTuple33
32Lambdaparameter: 49
body: 34
33Lambdaparameter: 67
body: 35
34Operationoperator: 43
operands: 36
35Conditionalvalue: 37
condition: 38
36ExprTuple39, 40
37Operationoperator: 41
operands: 42
38Operationoperator: 43
operands: 44
39IndexedVarvariable: 50
index: 49
40Literal
41Literal
42ExprTuple46, 47
43Literal
44ExprTuple67, 48
45ExprTuple49
46IndexedVarvariable: 50
index: 67
47Operationoperator: 51
operands: 52
48Operationoperator: 53
operands: 54
49Variable
50Variable
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple57, 58
55Variable
56Operationoperator: 59
operand: 61
57Literal
58Variable
59Literal
60ExprTuple61
61Operationoperator: 62
operand: 64
62Literal
63ExprTuple64
64IndexedVarvariable: 65
index: 67
65Variable
66ExprTuple67
67Variable