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 schmidt_decomposition
In [2]:
# check that the built expression is the same as the stored expression
assert schmidt_decomposition.expr == stored_expr
assert schmidt_decomposition.expr._style_id == stored_expr._style_id
print("Passed sanity check: schmidt_decomposition matches stored_expr")
Passed sanity check: schmidt_decomposition matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{m, n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{\lvert \psi \rangle \in \mathbb{C}^{m} {\otimes} \mathbb{C}^{n}}~\\
\left[\begin{array}{l}\exists_{a_{1}, a_{2}, \ldots, a_{m}~|~\left\{\left\{\lvert a_{1} \rangle, \lvert a_{2} \rangle, \ldots, \lvert a_{m} \rangle\right\}\right\} \in \textrm{O.N.Bases}\left(\mathbb{C}^{m}\right)}~\\
\left[\begin{array}{l}\exists_{b_{1}, b_{2}, \ldots, b_{n}~|~\left\{\left\{\lvert b_{1} \rangle, \lvert b_{2} \rangle, \ldots, \lvert b_{n} \rangle\right\}\right\} \in \textrm{O.N.Bases}\left(\mathbb{C}^{n}\right)}~\\
\left[\begin{array}{l}\exists_{\lambda_{1}, \lambda_{2}, \ldots, \lambda_{{\rm Min}\left(m, n\right)} \in \mathbb{R}^{\ge 0}}~\\
\left(\lvert \psi \rangle = \left(\sum_{i=1}^{{\rm Min}\left(m, n\right)} \left(\lambda_{i} \cdot \left(\lvert a_{i} \rangle \thinspace \lvert b_{i} \rangle\right)\right)\right)\right)\end{array}\right]\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: 6
operand: 2
1ExprTuple2
2Lambdaparameters: 120
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 70
operands: 8
6Literal
7ExprTuple9
8ExprTuple10, 11
9Lambdaparameter: 77
body: 13
10Operationoperator: 100
operands: 14
11Operationoperator: 100
operands: 15
12ExprTuple77
13Conditionalvalue: 16
condition: 17
14ExprTuple123, 18
15ExprTuple124, 18
16Operationoperator: 46
operand: 21
17Operationoperator: 100
operands: 20
18Literal
19ExprTuple21
20ExprTuple77, 22
21Lambdaparameters: 23
body: 24
22Operationoperator: 25
operands: 26
23ExprTuple27
24Conditionalvalue: 28
condition: 29
25Literal
26ExprTuple44, 65
27ExprRangelambda_map: 30
start_index: 114
end_index: 123
28Operationoperator: 46
operand: 33
29Operationoperator: 100
operands: 32
30Lambdaparameter: 106
body: 82
31ExprTuple33
32ExprTuple34, 35
33Lambdaparameters: 36
body: 37
34Operationoperator: 72
operand: 43
35Operationoperator: 58
operand: 44
36ExprTuple40
37Conditionalvalue: 41
condition: 42
38ExprTuple43
39ExprTuple44
40ExprRangelambda_map: 45
start_index: 114
end_index: 124
41Operationoperator: 46
operand: 51
42Operationoperator: 100
operands: 48
43Operationoperator: 72
operands: 49
44Operationoperator: 74
operands: 50
45Lambdaparameter: 106
body: 97
46Literal
47ExprTuple51
48ExprTuple52, 53
49ExprTuple54
50ExprTuple81, 123
51Lambdaparameters: 55
body: 56
52Operationoperator: 72
operand: 64
53Operationoperator: 58
operand: 65
54ExprRangelambda_map: 60
start_index: 114
end_index: 123
55ExprTuple61
56Conditionalvalue: 62
condition: 63
57ExprTuple64
58Literal
59ExprTuple65
60Lambdaparameter: 106
body: 66
61ExprRangelambda_map: 67
start_index: 114
end_index: 115
62Operationoperator: 68
operands: 69
63Operationoperator: 70
operands: 71
64Operationoperator: 72
operands: 73
65Operationoperator: 74
operands: 75
66Operationoperator: 117
operand: 82
67Lambdaparameter: 106
body: 95
68Literal
69ExprTuple77, 78
70Literal
71ExprTuple79
72Literal
73ExprTuple80
74Literal
75ExprTuple81, 124
76ExprTuple82
77Variable
78Operationoperator: 83
operand: 87
79ExprRangelambda_map: 85
start_index: 114
end_index: 115
80ExprRangelambda_map: 86
start_index: 114
end_index: 124
81Literal
82IndexedVarvariable: 125
index: 106
83Literal
84ExprTuple87
85Lambdaparameter: 106
body: 88
86Lambdaparameter: 106
body: 89
87Lambdaparameter: 128
body: 90
88Operationoperator: 100
operands: 91
89Operationoperator: 117
operand: 97
90Conditionalvalue: 93
condition: 94
91ExprTuple95, 96
92ExprTuple97
93Operationoperator: 98
operands: 99
94Operationoperator: 100
operands: 101
95IndexedVarvariable: 107
index: 106
96Literal
97IndexedVarvariable: 126
index: 106
98Literal
99ExprTuple103, 104
100Literal
101ExprTuple128, 105
102ExprTuple106
103IndexedVarvariable: 107
index: 128
104Operationoperator: 108
operands: 109
105Operationoperator: 110
operands: 111
106Variable
107Variable
108Literal
109ExprTuple112, 113
110Literal
111ExprTuple114, 115
112Operationoperator: 117
operand: 121
113Operationoperator: 117
operand: 122
114Literal
115Operationoperator: 119
operands: 120
116ExprTuple121
117Literal
118ExprTuple122
119Literal
120ExprTuple123, 124
121IndexedVarvariable: 125
index: 128
122IndexedVarvariable: 126
index: 128
123Variable
124Variable
125Variable
126Variable
127ExprTuple128
128Variable