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 qmult_ket_bra_is_op
In [2]:
# check that the built expression is the same as the stored expression
assert qmult_ket_bra_is_op.expr == stored_expr
assert qmult_ket_bra_is_op.expr._style_id == stored_expr._style_id
print("Passed sanity check: qmult_ket_bra_is_op matches stored_expr")
Passed sanity check: qmult_ket_bra_is_op 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}~\left[\forall_{\lvert \psi \rangle \in \mathcal{H}}~\left[\forall_{\varphi~|~\lvert \varphi \rangle \in X}~\left(\left(\lvert \psi \rangle \thinspace \langle \varphi \rvert\right) \in \mathcal{L}\left(X, \mathcal{H}\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: 11
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple32, 31
4Operationoperator: 11
operand: 6
5ExprTuple6
6Lambdaparameter: 29
body: 8
7ExprTuple29
8Conditionalvalue: 9
condition: 10
9Operationoperator: 11
operand: 14
10Operationoperator: 19
operands: 13
11Literal
12ExprTuple14
13ExprTuple29, 32
14Lambdaparameter: 35
body: 15
15Conditionalvalue: 16
condition: 17
16Operationoperator: 19
operands: 18
17Operationoperator: 19
operands: 20
18ExprTuple21, 22
19Literal
20ExprTuple23, 31
21Operationoperator: 24
operands: 25
22Operationoperator: 26
operands: 27
23Operationoperator: 28
operand: 35
24Literal
25ExprTuple29, 30
26Literal
27ExprTuple31, 32
28Literal
29Variable
30Operationoperator: 33
operand: 35
31Variable
32Variable
33Literal
34ExprTuple35
35Variable