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.linear_algebra.inner_products import simultaneous_diagonalization_as_ortho_projectors
In [2]:
# check that the built expression is the same as the stored expression
assert simultaneous_diagonalization_as_ortho_projectors.expr == stored_expr
assert simultaneous_diagonalization_as_ortho_projectors.expr._style_id == stored_expr._style_id
print("Passed sanity check: simultaneous_diagonalization_as_ortho_projectors matches stored_expr")
Passed sanity check: simultaneous_diagonalization_as_ortho_projectors 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[\begin{array}{l}\forall_{A, B \in \mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)~|~A^{\dagger} = A, B^{\dagger} = B}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\left[A, B\right] = \vec{0}\left(\mathcal{L}\left(\mathcal{H}, \mathcal{H}\right)\right)\right) \Leftrightarrow  \\ \left[\begin{array}{l}\exists_{x_{1}, x_{2}, \ldots, x_{n}~|~\left\{x_{1}, x_{2}, \ldots, x_{n}\right\} \in \textrm{O.N.Bases}\left(\mathcal{H}\right)}~\\
\left[\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{n}, b_{1}, b_{2}, \ldots, b_{n} \in \mathbb{C}}~\\
\left(\begin{array}{c} \left(A = \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) \land  \\ \left(B = \left(\sum_{i=1}^{n} \left(b_{i} \cdot \textrm{OrthoProj}\left(\mathcal{H}, \textrm{Span}\left(\left\{x_{i}\right\}\right)\right)\right)\right)\right) \end{array}\right)\end{array}\right]\end{array}\right] \end{array} \end{array}\right)\end{array}\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: 135
body: 4
3ExprTuple135
4Conditionalvalue: 5
condition: 6
5Operationoperator: 14
operand: 9
6Operationoperator: 120
operands: 8
7ExprTuple9
8ExprTuple135, 10
9Lambdaparameter: 132
body: 11
10Literal
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operand: 17
13Operationoperator: 81
operands: 16
14Literal
15ExprTuple17
16ExprTuple18, 19
17Lambdaparameters: 50
body: 20
18Operationoperator: 21
operands: 22
19Operationoperator: 90
operands: 23
20Conditionalvalue: 24
condition: 25
21Literal
22ExprTuple132, 26
23ExprTuple27, 135
24Operationoperator: 28
operands: 29
25Operationoperator: 81
operands: 30
26Literal
27Operationoperator: 31
operand: 132
28Literal
29ExprTuple32, 33
30ExprTuple34, 35, 36, 37
31Literal
32Operationoperator: 90
operands: 38
33Operationoperator: 62
operand: 46
34Operationoperator: 120
operands: 40
35Operationoperator: 120
operands: 41
36Operationoperator: 90
operands: 42
37Operationoperator: 90
operands: 43
38ExprTuple44, 45
39ExprTuple46
40ExprTuple94, 57
41ExprTuple96, 57
42ExprTuple47, 94
43ExprTuple48, 96
44Operationoperator: 49
operands: 50
45Operationoperator: 51
operand: 57
46Lambdaparameters: 70
body: 53
47Operationoperator: 55
operand: 94
48Operationoperator: 55
operand: 96
49Literal
50ExprTuple94, 96
51Literal
52ExprTuple57
53Conditionalvalue: 58
condition: 59
54ExprTuple94
55Literal
56ExprTuple96
57Operationoperator: 60
operands: 61
58Operationoperator: 62
operand: 65
59Operationoperator: 120
operands: 64
60Literal
61ExprTuple132, 132
62Literal
63ExprTuple65
64ExprTuple66, 67
65Lambdaparameters: 68
body: 69
66Operationoperator: 139
operands: 70
67Operationoperator: 71
operand: 132
68ExprTuple73, 74
69Conditionalvalue: 75
condition: 76
70ExprTuple77
71Literal
72ExprTuple132
73ExprRangelambda_map: 78
start_index: 134
end_index: 135
74ExprRangelambda_map: 79
start_index: 134
end_index: 135
75Operationoperator: 81
operands: 80
76Operationoperator: 81
operands: 82
77ExprRangelambda_map: 83
start_index: 134
end_index: 135
78Lambdaparameter: 116
body: 107
79Lambdaparameter: 116
body: 108
80ExprTuple84, 85
81Literal
82ExprTuple86, 87
83Lambdaparameter: 116
body: 88
84Operationoperator: 90
operands: 89
85Operationoperator: 90
operands: 91
86ExprRangelambda_map: 92
start_index: 134
end_index: 135
87ExprRangelambda_map: 93
start_index: 134
end_index: 135
88IndexedVarvariable: 142
index: 116
89ExprTuple94, 95
90Literal
91ExprTuple96, 97
92Lambdaparameter: 116
body: 98
93Lambdaparameter: 116
body: 99
94Variable
95Operationoperator: 101
operand: 105
96Variable
97Operationoperator: 101
operand: 106
98Operationoperator: 120
operands: 103
99Operationoperator: 120
operands: 104
100ExprTuple105
101Literal
102ExprTuple106
103ExprTuple107, 109
104ExprTuple108, 109
105Lambdaparameter: 144
body: 110
106Lambdaparameter: 144
body: 111
107IndexedVarvariable: 126
index: 116
108IndexedVarvariable: 127
index: 116
109Literal
110Conditionalvalue: 113
condition: 115
111Conditionalvalue: 114
condition: 115
112ExprTuple116
113Operationoperator: 118
operands: 117
114Operationoperator: 118
operands: 119
115Operationoperator: 120
operands: 121
116Variable
117ExprTuple122, 124
118Literal
119ExprTuple123, 124
120Literal
121ExprTuple144, 125
122IndexedVarvariable: 126
index: 144
123IndexedVarvariable: 127
index: 144
124Operationoperator: 128
operands: 129
125Operationoperator: 130
operands: 131
126Variable
127Variable
128Literal
129ExprTuple132, 133
130Literal
131ExprTuple134, 135
132Variable
133Operationoperator: 136
operand: 138
134Literal
135Variable
136Literal
137ExprTuple138
138Operationoperator: 139
operand: 141
139Literal
140ExprTuple141
141IndexedVarvariable: 142
index: 144
142Variable
143ExprTuple144
144Variable