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