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.circuits import qubit_meas_bijection
In [2]:
# check that the built expression is the same as the stored expression
assert qubit_meas_bijection.expr == stored_expr
assert qubit_meas_bijection.expr._style_id == stored_expr._style_id
print("Passed sanity check: qubit_meas_bijection matches stored_expr")
Passed sanity check: qubit_meas_bijection matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{\lvert \psi \rangle \in \mathbb{C}^{2}~|~\left \|\lvert \psi \rangle\right \| = 1}~\left(\begin{array}{c} \begin{array}{l} \left[b \mapsto \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{\lvert \psi \rangle} & \meter & \qout{\lvert b \rangle}
} \end{array}\right)\right] \in  \\ \left[\left\{0, 1\right\} \xrightarrow[\text{onto}]{\text{1-to-1}} \left\{\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{\lvert \psi \rangle} & \meter & \qout{\lvert b \rangle}
} \end{array}\right\}_{b \in \left\{0, 1\right\}}\right] \end{array} \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: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 55
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 36
operands: 7
6Operationoperator: 8
operands: 9
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Lambdaparameter: 60
body: 32
11Operationoperator: 14
operands: 15
12Operationoperator: 36
operands: 16
13Operationoperator: 17
operands: 18
14Literal
15ExprTuple41, 19
16ExprTuple55, 20
17Literal
18ExprTuple21, 54
19Operationoperator: 22
operand: 28
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operand: 55
22Literal
23ExprTuple28
24Literal
25ExprTuple29, 30
26Literal
27ExprTuple55
28Lambdaparameter: 60
body: 31
29Literal
30Literal
31Conditionalvalue: 32
condition: 33
32Operationoperator: 34
operands: 35
33Operationoperator: 36
operands: 37
34Literal
35ExprTuple38, 39, 40
36Literal
37ExprTuple60, 41
38ExprTuple42
39ExprTuple43
40ExprTuple44
41Operationoperator: 45
operands: 46
42Operationoperator: 47
operands: 48
43Operationoperator: 49
operands: 50
44Operationoperator: 51
operands: 52
45Literal
46ExprTuple53, 54
47Literal
48NamedExprsstate: 55
49Literal
50NamedExprsbasis: 56
51Literal
52NamedExprsstate: 57
53Literal
54Literal
55Variable
56Literal
57Operationoperator: 58
operand: 60
58Literal
59ExprTuple60
60Variable