logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.QPE

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit import ExprTuple, Lambda, m
from proveit.physics.quantum.QPE import _m_domain, _phase_est_circuit
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(m, _phase_est_circuit), _m_domain)
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\left(m \mapsto \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{\lvert + \rangle} & \multigate{4}{\textrm{QPE}\left(U, t\right)} & \meter & \multiqout{3}{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} & \ghost{\textrm{QPE}\left(U, t\right)} & \measure{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} \qw & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert u \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & { /^{s} } \qw & \qout{\lvert u \rangle}
} \end{array}\right), \{0~\ldotp \ldotp~2^{t} - 1\}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Lambdaparameter: 91
body: 4
2Operationoperator: 74
operands: 5
3ExprTuple91
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10, 11, 12, 13
8Literal
9Operationoperator: 88
operands: 14
10ExprTuple15, 16
11ExprTuple17, 18
12ExprTuple19, 20
13ExprTuple21, 22
14ExprTuple23, 24
15ExprRangelambda_map: 25
start_index: 92
end_index: 93
16ExprRangelambda_map: 26
start_index: 92
end_index: 94
17ExprRangelambda_map: 27
start_index: 92
end_index: 93
18ExprRangelambda_map: 27
start_index: 81
end_index: 82
19ExprRangelambda_map: 28
start_index: 92
end_index: 93
20ExprRangelambda_map: 29
start_index: 92
end_index: 94
21ExprRangelambda_map: 30
start_index: 92
end_index: 93
22ExprRangelambda_map: 31
start_index: 92
end_index: 94
23Operationoperator: 32
operands: 33
24Operationoperator: 34
operand: 92
25Lambdaparameter: 80
body: 36
26Lambdaparameter: 80
body: 37
27Lambdaparameter: 80
body: 38
28Lambdaparameter: 80
body: 39
29Lambdaparameter: 80
body: 40
30Lambdaparameter: 80
body: 41
31Lambdaparameter: 80
body: 43
32Literal
33ExprTuple44, 93
34Literal
35ExprTuple92
36Operationoperator: 66
operands: 45
37Operationoperator: 52
operands: 46
38Operationoperator: 52
operands: 47
39Operationoperator: 48
operands: 49
40Operationoperator: 67
operands: 50
41Operationoperator: 52
operands: 51
42ExprTuple80
43Operationoperator: 52
operands: 53
44Literal
45NamedExprsstate: 54
46NamedExprselement: 55
targets: 63
47NamedExprselement: 56
targets: 57
48Literal
49NamedExprsbasis: 58
50NamedExprsoperation: 59
51NamedExprselement: 60
targets: 61
52Literal
53NamedExprselement: 62
targets: 63
54Operationoperator: 64
operand: 76
55Operationoperator: 66
operands: 73
56Operationoperator: 67
operands: 68
57Operationoperator: 74
operands: 69
58Literal
59Literal
60Operationoperator: 72
operands: 70
61Operationoperator: 74
operands: 71
62Operationoperator: 72
operands: 73
63Operationoperator: 74
operands: 75
64Literal
65ExprTuple76
66Literal
67Literal
68NamedExprsoperation: 77
part: 80
69ExprTuple92, 82
70NamedExprsstate: 78
part: 80
71ExprTuple92, 93
72Literal
73NamedExprsstate: 79
part: 80
74Literal
75ExprTuple81, 82
76Literal
77Operationoperator: 83
operands: 84
78Operationoperator: 85
operands: 86
79Literal
80Variable
81Operationoperator: 88
operands: 87
82Operationoperator: 88
operands: 89
83Literal
84ExprTuple90, 93
85Literal
86ExprTuple91, 93
87ExprTuple93, 92
88Literal
89ExprTuple93, 94
90Literal
91Variable
92Literal
93Literal
94Literal