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 completeness_relation
In [2]:
# check that the built expression is the same as the stored expression
assert completeness_relation.expr == stored_expr
assert completeness_relation.expr._style_id == stored_expr._style_id
print("Passed sanity check: completeness_relation matches stored_expr")
Passed sanity check: completeness_relation 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_{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(\mathcal{H}\right)}~\\
\left(\left(\sum_{i=1}^{n} \left(\lvert x_{i} \rangle \thinspace \langle x_{i} \rvert\right)\right) = I_{\mathcal{H}}\right)\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: 15
operand: 2
1ExprTuple2
2Lambdaparameter: 42
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 15
operand: 9
5Operationoperator: 7
operands: 8
6ExprTuple9
7Literal
8ExprTuple42, 10
9Lambdaparameter: 65
body: 12
10Literal
11ExprTuple65
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 18
14Operationoperator: 50
operands: 17
15Literal
16ExprTuple18
17ExprTuple65, 19
18Lambdaparameters: 20
body: 21
19Literal
20ExprTuple22
21Conditionalvalue: 23
condition: 24
22ExprRangelambda_map: 25
start_index: 64
end_index: 65
23Operationoperator: 26
operands: 27
24Operationoperator: 50
operands: 28
25Lambdaparameter: 66
body: 56
26Literal
27ExprTuple29, 30
28ExprTuple31, 32
29Operationoperator: 33
operand: 40
30Operationoperator: 35
operand: 42
31Operationoperator: 36
operands: 37
32Operationoperator: 38
operand: 42
33Literal
34ExprTuple40
35Literal
36Literal
37ExprTuple41
38Literal
39ExprTuple42
40Lambdaparameter: 69
body: 43
41ExprRangelambda_map: 44
start_index: 64
end_index: 65
42Variable
43Conditionalvalue: 45
condition: 46
44Lambdaparameter: 66
body: 47
45Operationoperator: 48
operands: 49
46Operationoperator: 50
operands: 51
47Operationoperator: 57
operand: 56
48Literal
49ExprTuple53, 54
50Literal
51ExprTuple69, 55
52ExprTuple56
53Operationoperator: 57
operand: 63
54Operationoperator: 58
operand: 63
55Operationoperator: 60
operands: 61
56IndexedVarvariable: 67
index: 66
57Literal
58Literal
59ExprTuple63
60Literal
61ExprTuple64, 65
62ExprTuple66
63IndexedVarvariable: 67
index: 69
64Literal
65Variable
66Variable
67Variable
68ExprTuple69
69Variable