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 output_prod_operator_repr
In [2]:
# check that the built expression is the same as the stored expression
assert output_prod_operator_repr.expr == stored_expr
assert output_prod_operator_repr.expr._style_id == stored_expr._style_id
print("Passed sanity check: output_prod_operator_repr matches stored_expr")
Passed sanity check: output_prod_operator_repr matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{V, W \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left[\forall_{A \in \mathcal{L}\left(V, W\right)}~\left[\forall_{m, n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{v_{1}, v_{2}, \ldots, v_{m}~|~\left\{\lvert v_{1} \rangle, \lvert v_{2} \rangle, \ldots, \lvert v_{m} \rangle\right\} \in \textrm{O.N.Bases}\left(V\right)}~\\
\left[\begin{array}{l}\forall_{w_{1}, w_{2}, \ldots, w_{n}~|~\left\{\lvert w_{1} \rangle, \lvert w_{2} \rangle, \ldots, \lvert w_{n} \rangle\right\} \in \textrm{O.N.Bases}\left(W\right)}~\\
\left(A = \left(\sum_{i=1}^{m} \left(\sum_{j=1}^{n} \left(\langle w_{j} \rvert \thinspace A \thinspace \lvert v_{i} \rangle \thinspace \lvert w_{j} \rangle \thinspace \langle v_{i} \rvert\right)\right)\right)\right)\end{array}\right]\end{array}\right]\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: 44
operand: 2
1ExprTuple2
2Lambdaparameters: 26
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 44
operand: 8
5Operationoperator: 30
operands: 7
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameter: 102
body: 12
9Operationoperator: 14
operands: 13
10Operationoperator: 14
operands: 15
11ExprTuple102
12Conditionalvalue: 16
condition: 17
13ExprTuple58, 18
14Literal
15ExprTuple76, 18
16Operationoperator: 44
operand: 21
17Operationoperator: 99
operands: 20
18Literal
19ExprTuple21
20ExprTuple102, 22
21Lambdaparameters: 23
body: 24
22Operationoperator: 25
operands: 26
23ExprTuple95, 116
24Conditionalvalue: 27
condition: 28
25Literal
26ExprTuple58, 76
27Operationoperator: 44
operand: 32
28Operationoperator: 30
operands: 31
29ExprTuple32
30Literal
31ExprTuple33, 34
32Lambdaparameters: 35
body: 36
33Operationoperator: 99
operands: 37
34Operationoperator: 99
operands: 38
35ExprTuple39
36Conditionalvalue: 40
condition: 41
37ExprTuple95, 42
38ExprTuple116, 42
39ExprRangelambda_map: 43
start_index: 115
end_index: 95
40Operationoperator: 44
operand: 47
41Operationoperator: 99
operands: 46
42Literal
43Lambdaparameter: 96
body: 77
44Literal
45ExprTuple47
46ExprTuple48, 49
47Lambdaparameters: 50
body: 51
48Operationoperator: 69
operands: 52
49Operationoperator: 71
operand: 58
50ExprTuple54
51Conditionalvalue: 55
condition: 56
52ExprTuple57
53ExprTuple58
54ExprRangelambda_map: 59
start_index: 115
end_index: 116
55Operationoperator: 60
operands: 61
56Operationoperator: 99
operands: 62
57ExprRangelambda_map: 63
start_index: 115
end_index: 95
58Variable
59Lambdaparameter: 96
body: 89
60Literal
61ExprTuple102, 64
62ExprTuple65, 66
63Lambdaparameter: 96
body: 67
64Operationoperator: 83
operand: 74
65Operationoperator: 69
operands: 70
66Operationoperator: 71
operand: 76
67Operationoperator: 107
operand: 77
68ExprTuple74
69Literal
70ExprTuple75
71Literal
72ExprTuple76
73ExprTuple77
74Lambdaparameter: 122
body: 78
75ExprRangelambda_map: 79
start_index: 115
end_index: 116
76Variable
77IndexedVarvariable: 119
index: 96
78Conditionalvalue: 80
condition: 81
79Lambdaparameter: 96
body: 82
80Operationoperator: 83
operand: 87
81Operationoperator: 99
operands: 85
82Operationoperator: 107
operand: 89
83Literal
84ExprTuple87
85ExprTuple122, 88
86ExprTuple89
87Lambdaparameter: 121
body: 90
88Operationoperator: 111
operands: 91
89IndexedVarvariable: 117
index: 96
90Conditionalvalue: 93
condition: 94
91ExprTuple115, 95
92ExprTuple96
93Operationoperator: 97
operands: 98
94Operationoperator: 99
operands: 100
95Variable
96Variable
97Literal
98ExprTuple101, 102, 103, 104, 105
99Literal
100ExprTuple121, 106
101Operationoperator: 109
operand: 113
102Variable
103Operationoperator: 107
operand: 114
104Operationoperator: 107
operand: 113
105Operationoperator: 109
operand: 114
106Operationoperator: 111
operands: 112
107Literal
108ExprTuple113
109Literal
110ExprTuple114
111Literal
112ExprTuple115, 116
113IndexedVarvariable: 117
index: 121
114IndexedVarvariable: 119
index: 122
115Literal
116Variable
117Variable
118ExprTuple121
119Variable
120ExprTuple122
121Variable
122Variable