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.logic import Equals
from proveit.physics.quantum.QPE import _Omega, _sample_space
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Equals(_sample_space, _Omega))
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(\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\}} = \Omega\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Operationoperator: 2
operands: 3
2Literal
3ExprTuple4, 5
4Operationoperator: 6
operand: 8
5Literal
6Literal
7ExprTuple8
8Lambdaparameter: 102
body: 10
9ExprTuple102
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18, 19, 20
15Literal
16ExprTuple102, 21
17ExprTuple22, 23
18ExprTuple24, 25
19ExprTuple26, 27
20ExprTuple28, 29
21Operationoperator: 84
operands: 30
22ExprRangelambda_map: 31
start_index: 103
end_index: 104
23ExprRangelambda_map: 32
start_index: 103
end_index: 105
24ExprRangelambda_map: 33
start_index: 103
end_index: 104
25ExprRangelambda_map: 33
start_index: 92
end_index: 93
26ExprRangelambda_map: 34
start_index: 103
end_index: 104
27ExprRangelambda_map: 35
start_index: 103
end_index: 105
28ExprRangelambda_map: 36
start_index: 103
end_index: 104
29ExprRangelambda_map: 37
start_index: 103
end_index: 105
30ExprTuple38, 39
31Lambdaparameter: 91
body: 40
32Lambdaparameter: 91
body: 41
33Lambdaparameter: 91
body: 42
34Lambdaparameter: 91
body: 43
35Lambdaparameter: 91
body: 44
36Lambdaparameter: 91
body: 45
37Lambdaparameter: 91
body: 47
38Literal
39Operationoperator: 99
operands: 48
40Operationoperator: 76
operands: 49
41Operationoperator: 56
operands: 50
42Operationoperator: 56
operands: 51
43Operationoperator: 52
operands: 53
44Operationoperator: 77
operands: 54
45Operationoperator: 56
operands: 55
46ExprTuple91
47Operationoperator: 56
operands: 57
48ExprTuple58, 59
49NamedExprsstate: 60
50NamedExprselement: 61
targets: 69
51NamedExprselement: 62
targets: 63
52Literal
53NamedExprsbasis: 64
54NamedExprsoperation: 65
55NamedExprselement: 66
targets: 67
56Literal
57NamedExprselement: 68
targets: 69
58Operationoperator: 70
operands: 71
59Operationoperator: 72
operand: 103
60Operationoperator: 74
operand: 87
61Operationoperator: 76
operands: 83
62Operationoperator: 77
operands: 78
63Operationoperator: 84
operands: 79
64Literal
65Literal
66Operationoperator: 82
operands: 80
67Operationoperator: 84
operands: 81
68Operationoperator: 82
operands: 83
69Operationoperator: 84
operands: 85
70Literal
71ExprTuple86, 104
72Literal
73ExprTuple103
74Literal
75ExprTuple87
76Literal
77Literal
78NamedExprsoperation: 88
part: 91
79ExprTuple103, 93
80NamedExprsstate: 89
part: 91
81ExprTuple103, 104
82Literal
83NamedExprsstate: 90
part: 91
84Literal
85ExprTuple92, 93
86Literal
87Literal
88Operationoperator: 94
operands: 95
89Operationoperator: 96
operands: 97
90Literal
91Variable
92Operationoperator: 99
operands: 98
93Operationoperator: 99
operands: 100
94Literal
95ExprTuple101, 104
96Literal
97ExprTuple102, 104
98ExprTuple104, 103
99Literal
100ExprTuple104, 105
101Literal
102Variable
103Literal
104Literal
105Literal