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_spectral_decomposition_as_outer_prods
In [2]:
# check that the built expression is the same as the stored expression
assert matrix_spectral_decomposition_as_outer_prods.expr == stored_expr
assert matrix_spectral_decomposition_as_outer_prods.expr._style_id == stored_expr._style_id
print("Passed sanity check: matrix_spectral_decomposition_as_outer_prods matches stored_expr")
Passed sanity check: matrix_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[\forall_{M \in \mathbb{C}^{n \times n}}~\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(\mathbb{C}^{n}\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]
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: 100
body: 4
3ExprTuple100
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 10
6Operationoperator: 85
operands: 9
7Literal
8ExprTuple10
9ExprTuple100, 11
10Lambdaparameter: 64
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 85
operands: 17
15Literal
16ExprTuple18, 19
17ExprTuple64, 20
18Operationoperator: 56
operands: 21
19Operationoperator: 39
operand: 27
20Operationoperator: 23
operands: 24
21ExprTuple25, 26
22ExprTuple27
23Literal
24NamedExprsfield: 81
rows: 100
columns: 100
25Operationoperator: 93
operands: 28
26Operationoperator: 93
operands: 29
27Lambdaparameters: 30
body: 31
28ExprTuple32, 64
29ExprTuple64, 32
30ExprTuple33
31Conditionalvalue: 34
condition: 35
32Operationoperator: 36
operand: 64
33ExprRangelambda_map: 38
start_index: 99
end_index: 100
34Operationoperator: 39
operand: 42
35Operationoperator: 85
operands: 41
36Literal
37ExprTuple64
38Lambdaparameter: 91
body: 82
39Literal
40ExprTuple42
41ExprTuple43, 44
42Lambdaparameters: 45
body: 46
43Operationoperator: 60
operand: 53
44Operationoperator: 48
operand: 54
45ExprTuple50
46Conditionalvalue: 51
condition: 52
47ExprTuple53
48Literal
49ExprTuple54
50ExprRangelambda_map: 55
start_index: 99
end_index: 100
51Operationoperator: 56
operands: 57
52Operationoperator: 58
operands: 59
53Operationoperator: 60
operands: 61
54Operationoperator: 62
operands: 63
55Lambdaparameter: 91
body: 80
56Literal
57ExprTuple64, 65
58Literal
59ExprTuple66
60Literal
61ExprTuple67
62Literal
63ExprTuple81, 100
64Variable
65Operationoperator: 68
operand: 72
66ExprRangelambda_map: 70
start_index: 99
end_index: 100
67ExprRangelambda_map: 71
start_index: 99
end_index: 100
68Literal
69ExprTuple72
70Lambdaparameter: 91
body: 73
71Lambdaparameter: 91
body: 74
72Lambdaparameter: 107
body: 75
73Operationoperator: 85
operands: 76
74Operationoperator: 101
operand: 82
75Conditionalvalue: 78
condition: 79
76ExprTuple80, 81
77ExprTuple82
78Operationoperator: 83
operands: 84
79Operationoperator: 85
operands: 86
80IndexedVarvariable: 92
index: 91
81Literal
82IndexedVarvariable: 105
index: 91
83Literal
84ExprTuple88, 89
85Literal
86ExprTuple107, 90
87ExprTuple91
88IndexedVarvariable: 92
index: 107
89Operationoperator: 93
operands: 94
90Operationoperator: 95
operands: 96
91Variable
92Variable
93Literal
94ExprTuple97, 98
95Literal
96ExprTuple99, 100
97Operationoperator: 101
operand: 104
98Operationoperator: 102
operand: 104
99Literal
100Variable
101Literal
102Literal
103ExprTuple104
104IndexedVarvariable: 105
index: 107
105Variable
106ExprTuple107
107Variable