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_norm_bases_form_unitary_matrix
In [2]:
# check that the built expression is the same as the stored expression
assert ortho_norm_bases_form_unitary_matrix.expr == stored_expr
assert ortho_norm_bases_form_unitary_matrix.expr._style_id == stored_expr._style_id
print("Passed sanity check: ortho_norm_bases_form_unitary_matrix matches stored_expr")
Passed sanity check: ortho_norm_bases_form_unitary_matrix 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[\begin{array}{l}\forall_{v_{1}, v_{2}, \ldots, v_{n}, w_{1}, w_{2}, \ldots, w_{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\{\left\{\lvert w_{1} \rangle, \lvert w_{2} \rangle, \ldots, \lvert w_{n} \rangle\right\}\right\} \in \textrm{O.N.Bases}\left(\mathbb{C}^{n}\right)}~\\
\left(\left(\sum_{i=1}^{n} \left(\lvert v_{i} \rangle \thinspace \langle w_{i} \rvert\right)\right) \in \textrm{U}\left(n\right)\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
2Lambdaparameter: 71
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 48
operands: 8
6Literal
7ExprTuple9
8ExprTuple71, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple13, 14
12Conditionalvalue: 15
condition: 16
13ExprRangelambda_map: 17
start_index: 70
end_index: 71
14ExprRangelambda_map: 18
start_index: 70
end_index: 71
15Operationoperator: 48
operands: 19
16Operationoperator: 20
operands: 21
17Lambdaparameter: 84
body: 79
18Lambdaparameter: 84
body: 80
19ExprTuple22, 23
20Literal
21ExprTuple24, 25
22Operationoperator: 26
operand: 32
23Operationoperator: 28
operand: 71
24Operationoperator: 48
operands: 30
25Operationoperator: 48
operands: 31
26Literal
27ExprTuple32
28Literal
29ExprTuple71
30ExprTuple33, 35
31ExprTuple34, 35
32Lambdaparameter: 78
body: 36
33Operationoperator: 51
operand: 43
34Operationoperator: 51
operand: 44
35Operationoperator: 39
operand: 45
36Conditionalvalue: 41
condition: 42
37ExprTuple43
38ExprTuple44
39Literal
40ExprTuple45
41Operationoperator: 46
operands: 47
42Operationoperator: 48
operands: 49
43Operationoperator: 51
operands: 50
44Operationoperator: 51
operands: 52
45Operationoperator: 53
operands: 54
46Literal
47ExprTuple55, 56
48Literal
49ExprTuple78, 57
50ExprTuple58
51Literal
52ExprTuple59
53Literal
54ExprTuple60, 71
55Operationoperator: 76
operand: 68
56Operationoperator: 62
operand: 69
57Operationoperator: 64
operands: 65
58ExprRangelambda_map: 66
start_index: 70
end_index: 71
59ExprRangelambda_map: 67
start_index: 70
end_index: 71
60Literal
61ExprTuple68
62Literal
63ExprTuple69
64Literal
65ExprTuple70, 71
66Lambdaparameter: 84
body: 72
67Lambdaparameter: 84
body: 73
68IndexedVarvariable: 81
index: 78
69IndexedVarvariable: 82
index: 78
70Literal
71Variable
72Operationoperator: 76
operand: 79
73Operationoperator: 76
operand: 80
74ExprTuple78
75ExprTuple79
76Literal
77ExprTuple80
78Variable
79IndexedVarvariable: 81
index: 84
80IndexedVarvariable: 82
index: 84
81Variable
82Variable
83ExprTuple84
84Variable