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
from proveit.physics.quantum.QPE import _Omega, _sample_space
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(_Omega, _sample_space)
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(\Omega, \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\}_{m \in \{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
1Literal
2Operationoperator: 3
operand: 5
3Literal
4ExprTuple5
5Lambdaparameter: 99
body: 7
6ExprTuple99
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14, 15, 16, 17
12Literal
13ExprTuple99, 18
14ExprTuple19, 20
15ExprTuple21, 22
16ExprTuple23, 24
17ExprTuple25, 26
18Operationoperator: 81
operands: 27
19ExprRangelambda_map: 28
start_index: 100
end_index: 101
20ExprRangelambda_map: 29
start_index: 100
end_index: 102
21ExprRangelambda_map: 30
start_index: 100
end_index: 101
22ExprRangelambda_map: 30
start_index: 89
end_index: 90
23ExprRangelambda_map: 31
start_index: 100
end_index: 101
24ExprRangelambda_map: 32
start_index: 100
end_index: 102
25ExprRangelambda_map: 33
start_index: 100
end_index: 101
26ExprRangelambda_map: 34
start_index: 100
end_index: 102
27ExprTuple35, 36
28Lambdaparameter: 88
body: 37
29Lambdaparameter: 88
body: 38
30Lambdaparameter: 88
body: 39
31Lambdaparameter: 88
body: 40
32Lambdaparameter: 88
body: 41
33Lambdaparameter: 88
body: 42
34Lambdaparameter: 88
body: 44
35Literal
36Operationoperator: 96
operands: 45
37Operationoperator: 73
operands: 46
38Operationoperator: 53
operands: 47
39Operationoperator: 53
operands: 48
40Operationoperator: 49
operands: 50
41Operationoperator: 74
operands: 51
42Operationoperator: 53
operands: 52
43ExprTuple88
44Operationoperator: 53
operands: 54
45ExprTuple55, 56
46NamedExprsstate: 57
47NamedExprselement: 58
targets: 66
48NamedExprselement: 59
targets: 60
49Literal
50NamedExprsbasis: 61
51NamedExprsoperation: 62
52NamedExprselement: 63
targets: 64
53Literal
54NamedExprselement: 65
targets: 66
55Operationoperator: 67
operands: 68
56Operationoperator: 69
operand: 100
57Operationoperator: 71
operand: 84
58Operationoperator: 73
operands: 80
59Operationoperator: 74
operands: 75
60Operationoperator: 81
operands: 76
61Literal
62Literal
63Operationoperator: 79
operands: 77
64Operationoperator: 81
operands: 78
65Operationoperator: 79
operands: 80
66Operationoperator: 81
operands: 82
67Literal
68ExprTuple83, 101
69Literal
70ExprTuple100
71Literal
72ExprTuple84
73Literal
74Literal
75NamedExprsoperation: 85
part: 88
76ExprTuple100, 90
77NamedExprsstate: 86
part: 88
78ExprTuple100, 101
79Literal
80NamedExprsstate: 87
part: 88
81Literal
82ExprTuple89, 90
83Literal
84Literal
85Operationoperator: 91
operands: 92
86Operationoperator: 93
operands: 94
87Literal
88Variable
89Operationoperator: 96
operands: 95
90Operationoperator: 96
operands: 97
91Literal
92ExprTuple98, 101
93Literal
94ExprTuple99, 101
95ExprTuple101, 100
96Literal
97ExprTuple101, 102
98Literal
99Variable
100Literal
101Literal
102Literal