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 matrix_simultaneous_diagonalization_as_outer_prods
In [2]:
# check that the built expression is the same as the stored expression
assert matrix_simultaneous_diagonalization_as_outer_prods.expr == stored_expr
assert matrix_simultaneous_diagonalization_as_outer_prods.expr._style_id == stored_expr._style_id
print("Passed sanity check: matrix_simultaneous_diagonalization_as_outer_prods matches stored_expr")
Passed sanity check: matrix_simultaneous_diagonalization_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_{A, B \in \mathbb{C}^{n \times n}~|~A^{\dagger} = A, B^{\dagger} = B}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\left[A, B\right] = \vec{0}\left(\mathbb{C}^{n \times n}\right)\right) \Leftrightarrow  \\ \left[\begin{array}{l}\exists_{v_{1}, v_{2}, \ldots, v_{n}~|~\left\{v_{1}, v_{2}, \ldots, v_{n}\right\} \in \textrm{O.N.Bases}\left(\mathbb{C}^{n}\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 \left(\lvert v_{i} \rangle \thinspace \langle v_{i} \rvert\right)\right)\right)\right) \land  \\ \left(B = \left(\sum_{i=1}^{n} \left(b_{i} \cdot \left(\lvert v_{i} \rangle \thinspace \langle v_{i} \rvert\right)\right)\right)\right) \end{array}\right)\end{array}\right]\end{array}\right] \end{array} \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: 7
operand: 2
1ExprTuple2
2Lambdaparameter: 125
body: 4
3ExprTuple125
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 110
operands: 9
7Literal
8ExprTuple10
9ExprTuple125, 11
10Lambdaparameters: 36
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 69
operands: 17
15Literal
16ExprTuple18, 19
17ExprTuple20, 21, 22, 23
18Operationoperator: 80
operands: 24
19Operationoperator: 48
operand: 32
20Operationoperator: 110
operands: 26
21Operationoperator: 110
operands: 27
22Operationoperator: 80
operands: 28
23Operationoperator: 80
operands: 29
24ExprTuple30, 31
25ExprTuple32
26ExprTuple84, 43
27ExprTuple86, 43
28ExprTuple33, 84
29ExprTuple34, 86
30Operationoperator: 35
operands: 36
31Operationoperator: 37
operand: 43
32Lambdaparameters: 57
body: 39
33Operationoperator: 41
operand: 84
34Operationoperator: 41
operand: 86
35Literal
36ExprTuple84, 86
37Literal
38ExprTuple43
39Conditionalvalue: 44
condition: 45
40ExprTuple84
41Literal
42ExprTuple86
43Operationoperator: 46
operands: 47
44Operationoperator: 48
operand: 51
45Operationoperator: 110
operands: 50
46Literal
47NamedExprsfield: 99
rows: 125
columns: 125
48Literal
49ExprTuple51
50ExprTuple52, 53
51Lambdaparameters: 54
body: 55
52Operationoperator: 56
operands: 57
53Operationoperator: 58
operand: 65
54ExprTuple60, 61
55Conditionalvalue: 62
condition: 63
56Literal
57ExprTuple64
58Literal
59ExprTuple65
60ExprRangelambda_map: 66
start_index: 124
end_index: 125
61ExprRangelambda_map: 67
start_index: 124
end_index: 125
62Operationoperator: 69
operands: 68
63Operationoperator: 69
operands: 70
64ExprRangelambda_map: 71
start_index: 124
end_index: 125
65Operationoperator: 72
operands: 73
66Lambdaparameter: 106
body: 97
67Lambdaparameter: 106
body: 98
68ExprTuple74, 75
69Literal
70ExprTuple76, 77
71Lambdaparameter: 106
body: 78
72Literal
73ExprTuple99, 125
74Operationoperator: 80
operands: 79
75Operationoperator: 80
operands: 81
76ExprRangelambda_map: 82
start_index: 124
end_index: 125
77ExprRangelambda_map: 83
start_index: 124
end_index: 125
78IndexedVarvariable: 130
index: 106
79ExprTuple84, 85
80Literal
81ExprTuple86, 87
82Lambdaparameter: 106
body: 88
83Lambdaparameter: 106
body: 89
84Variable
85Operationoperator: 91
operand: 95
86Variable
87Operationoperator: 91
operand: 96
88Operationoperator: 110
operands: 93
89Operationoperator: 110
operands: 94
90ExprTuple95
91Literal
92ExprTuple96
93ExprTuple97, 99
94ExprTuple98, 99
95Lambdaparameter: 132
body: 100
96Lambdaparameter: 132
body: 101
97IndexedVarvariable: 116
index: 106
98IndexedVarvariable: 117
index: 106
99Literal
100Conditionalvalue: 103
condition: 105
101Conditionalvalue: 104
condition: 105
102ExprTuple106
103Operationoperator: 108
operands: 107
104Operationoperator: 108
operands: 109
105Operationoperator: 110
operands: 111
106Variable
107ExprTuple112, 114
108Literal
109ExprTuple113, 114
110Literal
111ExprTuple132, 115
112IndexedVarvariable: 116
index: 132
113IndexedVarvariable: 117
index: 132
114Operationoperator: 118
operands: 119
115Operationoperator: 120
operands: 121
116Variable
117Variable
118Literal
119ExprTuple122, 123
120Literal
121ExprTuple124, 125
122Operationoperator: 126
operand: 129
123Operationoperator: 127
operand: 129
124Literal
125Variable
126Literal
127Literal
128ExprTuple129
129IndexedVarvariable: 130
index: 132
130Variable
131ExprTuple132
132Variable