logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.algebra import spectral_decomposition_as_outer_prods
In [2]:
# check that the built expression is the same as the stored expression
assert spectral_decomposition_as_outer_prods.expr == stored_expr
assert spectral_decomposition_as_outer_prods.expr._style_id == stored_expr._style_id
print("Passed sanity check: spectral_decomposition_as_outer_prods matches stored_expr")
Passed sanity check: spectral_decomposition_as_outer_prods matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{\mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}~|~\textrm{Dim}\left(\mathcal{H}\right) = n}~\\
\left[\forall_{M \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)}~\left(\begin{array}{c} \begin{array}{l} \left(\left(M^{\dagger} \thinspace M\right) = \left(M \thinspace M^{\dagger}\right)\right) \Leftrightarrow  \\ \left[\begin{array}{l}\exists_{v_{1}, v_{2}, \ldots, v_{n}~|~\left\{\left\{\lvert v_{1} \rangle, \lvert v_{2} \rangle, \ldots, \lvert v_{n} \rangle\right\}\right\} \in \textrm{O.N.Bases}\left(\mathcal{H}\right)}~\\
\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 \left(\lvert v_{i} \rangle \thinspace \langle v_{i} \rvert\right)\right)\right)\right)\end{array}\right]\end{array}\right] \end{array} \end{array}\right)\right]\end{array}\right]
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 14
operand: 2
1ExprTuple2
2Lambdaparameter: 112
body: 4
3ExprTuple112
4Conditionalvalue: 5
condition: 6
5Operationoperator: 14
operand: 9
6Operationoperator: 97
operands: 8
7ExprTuple9
8ExprTuple112, 10
9Lambdaparameter: 68
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 17
13Operationoperator: 72
operands: 16
14Literal
15ExprTuple17
16ExprTuple18, 19
17Lambdaparameter: 76
body: 20
18Operationoperator: 21
operands: 22
19Operationoperator: 70
operands: 23
20Conditionalvalue: 24
condition: 25
21Literal
22ExprTuple68, 26
23ExprTuple27, 112
24Operationoperator: 28
operands: 29
25Operationoperator: 97
operands: 30
26Literal
27Operationoperator: 31
operand: 68
28Literal
29ExprTuple32, 33
30ExprTuple76, 34
31Literal
32Operationoperator: 70
operands: 35
33Operationoperator: 53
operand: 41
34Operationoperator: 37
operands: 38
35ExprTuple39, 40
36ExprTuple41
37Literal
38ExprTuple68, 68
39Operationoperator: 105
operands: 42
40Operationoperator: 105
operands: 43
41Lambdaparameters: 44
body: 45
42ExprTuple46, 76
43ExprTuple76, 46
44ExprTuple47
45Conditionalvalue: 48
condition: 49
46Operationoperator: 50
operand: 76
47ExprRangelambda_map: 52
start_index: 111
end_index: 112
48Operationoperator: 53
operand: 56
49Operationoperator: 97
operands: 55
50Literal
51ExprTuple76
52Lambdaparameter: 103
body: 94
53Literal
54ExprTuple56
55ExprTuple57, 58
56Lambdaparameters: 59
body: 60
57Operationoperator: 74
operand: 67
58Operationoperator: 62
operand: 68
59ExprTuple64
60Conditionalvalue: 65
condition: 66
61ExprTuple67
62Literal
63ExprTuple68
64ExprRangelambda_map: 69
start_index: 111
end_index: 112
65Operationoperator: 70
operands: 71
66Operationoperator: 72
operands: 73
67Operationoperator: 74
operands: 75
68Variable
69Lambdaparameter: 103
body: 92
70Literal
71ExprTuple76, 77
72Literal
73ExprTuple78
74Literal
75ExprTuple79
76Variable
77Operationoperator: 80
operand: 84
78ExprRangelambda_map: 82
start_index: 111
end_index: 112
79ExprRangelambda_map: 83
start_index: 111
end_index: 112
80Literal
81ExprTuple84
82Lambdaparameter: 103
body: 85
83Lambdaparameter: 103
body: 86
84Lambdaparameter: 119
body: 87
85Operationoperator: 97
operands: 88
86Operationoperator: 113
operand: 94
87Conditionalvalue: 90
condition: 91
88ExprTuple92, 93
89ExprTuple94
90Operationoperator: 95
operands: 96
91Operationoperator: 97
operands: 98
92IndexedVarvariable: 104
index: 103
93Literal
94IndexedVarvariable: 117
index: 103
95Literal
96ExprTuple100, 101
97Literal
98ExprTuple119, 102
99ExprTuple103
100IndexedVarvariable: 104
index: 119
101Operationoperator: 105
operands: 106
102Operationoperator: 107
operands: 108
103Variable
104Variable
105Literal
106ExprTuple109, 110
107Literal
108ExprTuple111, 112
109Operationoperator: 113
operand: 116
110Operationoperator: 114
operand: 116
111Literal
112Variable
113Literal
114Literal
115ExprTuple116
116IndexedVarvariable: 117
index: 119
117Variable
118ExprTuple119
119Variable