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_axiom_expr # Load the stored axiom expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.algebra import qmult_ket_bra
In [2]:
# check that the built expression is the same as the stored expression
assert qmult_ket_bra.expr == stored_expr
assert qmult_ket_bra.expr._style_id == stored_expr._style_id
print("Passed sanity check: qmult_ket_bra matches stored_expr")
Passed sanity check: qmult_ket_bra 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}, X \underset{{\scriptscriptstyle c}}{\in} \textrm{HilbertSpaces}}~\left[\forall_{\lvert \psi \rangle \in X}~\left[\forall_{\varphi~|~\lvert \varphi \rangle \in \mathcal{H}}~\left(\left(\lvert \psi \rangle \thinspace \langle \varphi \rvert\right) = \left[\lvert v \rangle \mapsto \left\{\left(\langle \varphi \rvert \thinspace \lvert v \rangle\right) \cdot \lvert \psi \rangle \textrm{ if } \lvert v \rangle \in \mathcal{H}\right..\right]\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: 21
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple47, 25
4Conditionalvalue: 5
condition: 6
5Operationoperator: 21
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple11, 12
10Lambdaparameter: 46
body: 14
11Operationoperator: 16
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple46
14Conditionalvalue: 18
condition: 19
15ExprTuple47, 20
16Literal
17ExprTuple25, 20
18Operationoperator: 21
operand: 24
19Operationoperator: 43
operands: 23
20Literal
21Literal
22ExprTuple24
23ExprTuple46, 25
24Lambdaparameter: 54
body: 26
25Variable
26Conditionalvalue: 27
condition: 28
27Operationoperator: 29
operands: 30
28Operationoperator: 43
operands: 31
29Literal
30ExprTuple32, 33
31ExprTuple34, 47
32Operationoperator: 48
operands: 35
33Lambdaparameter: 51
body: 37
34Operationoperator: 38
operand: 54
35ExprTuple46, 50
36ExprTuple51
37Conditionalvalue: 39
condition: 40
38Literal
39Operationoperator: 41
operands: 42
40Operationoperator: 43
operands: 44
41Literal
42ExprTuple45, 46
43Literal
44ExprTuple51, 47
45Operationoperator: 48
operands: 49
46Variable
47Variable
48Literal
49ExprTuple50, 51
50Operationoperator: 52
operand: 54
51Variable
52Literal
53ExprTuple54
54Variable