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 ortho_projector_from_completion
In [2]:
# check that the built expression is the same as the stored expression
assert ortho_projector_from_completion.expr == stored_expr
assert ortho_projector_from_completion.expr._style_id == stored_expr._style_id
print("Passed sanity check: ortho_projector_from_completion matches stored_expr")
Passed sanity check: ortho_projector_from_completion matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{\mathcal{H} \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left[\forall_{X~|~X \subseteq \mathcal{H}}~\left[\forall_{n \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{x_{1}, x_{2}, \ldots, x_{n}~|~\left\{\lvert x_{1} \rangle, \lvert x_{2} \rangle, \ldots, \lvert x_{n} \rangle\right\} \in \textrm{O.N.Bases}\left(X\right)}~\\
\left(\textrm{OrthoProj}\left(\mathcal{H}, X\right) = \left(\sum_{i=1}^{n} \left(\lvert x_{i} \rangle \thinspace \langle x_{i} \rvert\right)\right)\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: 23
operand: 2
1ExprTuple2
2Lambdaparameter: 49
body: 4
3ExprTuple49
4Conditionalvalue: 5
condition: 6
5Operationoperator: 23
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple49, 11
10Lambdaparameter: 52
body: 12
11Literal
12Conditionalvalue: 13
condition: 14
13Operationoperator: 23
operand: 18
14Operationoperator: 16
operands: 17
15ExprTuple18
16Literal
17ExprTuple52, 49
18Lambdaparameter: 75
body: 20
19ExprTuple75
20Conditionalvalue: 21
condition: 22
21Operationoperator: 23
operand: 26
22Operationoperator: 60
operands: 25
23Literal
24ExprTuple26
25ExprTuple75, 27
26Lambdaparameters: 28
body: 29
27Literal
28ExprTuple30
29Conditionalvalue: 31
condition: 32
30ExprRangelambda_map: 33
start_index: 74
end_index: 75
31Operationoperator: 34
operands: 35
32Operationoperator: 60
operands: 36
33Lambdaparameter: 76
body: 66
34Literal
35ExprTuple37, 38
36ExprTuple39, 40
37Operationoperator: 41
operands: 42
38Operationoperator: 43
operand: 50
39Operationoperator: 45
operands: 46
40Operationoperator: 47
operand: 52
41Literal
42ExprTuple49, 52
43Literal
44ExprTuple50
45Literal
46ExprTuple51
47Literal
48ExprTuple52
49Variable
50Lambdaparameter: 79
body: 53
51ExprRangelambda_map: 54
start_index: 74
end_index: 75
52Variable
53Conditionalvalue: 55
condition: 56
54Lambdaparameter: 76
body: 57
55Operationoperator: 58
operands: 59
56Operationoperator: 60
operands: 61
57Operationoperator: 67
operand: 66
58Literal
59ExprTuple63, 64
60Literal
61ExprTuple79, 65
62ExprTuple66
63Operationoperator: 67
operand: 73
64Operationoperator: 68
operand: 73
65Operationoperator: 70
operands: 71
66IndexedVarvariable: 77
index: 76
67Literal
68Literal
69ExprTuple73
70Literal
71ExprTuple74, 75
72ExprTuple76
73IndexedVarvariable: 77
index: 79
74Literal
75Variable
76Variable
77Variable
78ExprTuple79
79Variable