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, e
from proveit.physics.quantum.QPE import Pfail, _fail_prob_e
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Pfail(e), _fail_prob_e)
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[P_{\rm fail}\right]\left(e\right), \begin{array}{l}\textrm{Prob}_{m \in \{0~\ldotp \ldotp~2^{t} - 1\}~|~\left|m - b_{\textit{f}}\right|_{\textup{mod}\thinspace 2^{t}} > e}~\\
\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)\end{array}\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
1Operationoperator: 3
operand: 42
2Operationoperator: 5
operand: 7
3Literal
4ExprTuple42
5Literal
6ExprTuple7
7Lambdaparameter: 116
body: 9
8ExprTuple116
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16, 17, 18, 19
14Literal
15ExprTuple20, 21
16ExprTuple22, 23
17ExprTuple24, 25
18ExprTuple26, 27
19ExprTuple28, 29
20Operationoperator: 30
operands: 31
21Operationoperator: 32
operands: 33
22ExprRangelambda_map: 34
start_index: 117
end_index: 118
23ExprRangelambda_map: 35
start_index: 117
end_index: 119
24ExprRangelambda_map: 36
start_index: 117
end_index: 118
25ExprRangelambda_map: 36
start_index: 99
end_index: 100
26ExprRangelambda_map: 37
start_index: 117
end_index: 118
27ExprRangelambda_map: 38
start_index: 117
end_index: 119
28ExprRangelambda_map: 39
start_index: 117
end_index: 118
29ExprRangelambda_map: 40
start_index: 117
end_index: 119
30Literal
31ExprTuple116, 41
32Literal
33ExprTuple42, 43
34Lambdaparameter: 98
body: 44
35Lambdaparameter: 98
body: 45
36Lambdaparameter: 98
body: 46
37Lambdaparameter: 98
body: 47
38Lambdaparameter: 98
body: 48
39Lambdaparameter: 98
body: 49
40Lambdaparameter: 98
body: 51
41Operationoperator: 89
operands: 52
42Variable
43Operationoperator: 53
operands: 54
44Operationoperator: 81
operands: 55
45Operationoperator: 62
operands: 56
46Operationoperator: 62
operands: 57
47Operationoperator: 58
operands: 59
48Operationoperator: 82
operands: 60
49Operationoperator: 62
operands: 61
50ExprTuple98
51Operationoperator: 62
operands: 63
52ExprTuple64, 65
53Literal
54ExprTuple66, 91
55NamedExprsstate: 67
56NamedExprselement: 68
targets: 76
57NamedExprselement: 69
targets: 70
58Literal
59NamedExprsbasis: 71
60NamedExprsoperation: 72
61NamedExprselement: 73
targets: 74
62Literal
63NamedExprselement: 75
targets: 76
64Literal
65Operationoperator: 111
operands: 77
66Operationoperator: 111
operands: 78
67Operationoperator: 79
operand: 94
68Operationoperator: 81
operands: 88
69Operationoperator: 82
operands: 83
70Operationoperator: 89
operands: 84
71Literal
72Literal
73Operationoperator: 87
operands: 85
74Operationoperator: 89
operands: 86
75Operationoperator: 87
operands: 88
76Operationoperator: 89
operands: 90
77ExprTuple91, 92
78ExprTuple116, 93
79Literal
80ExprTuple94
81Literal
82Literal
83NamedExprsoperation: 95
part: 98
84ExprTuple117, 100
85NamedExprsstate: 96
part: 98
86ExprTuple117, 118
87Literal
88NamedExprsstate: 97
part: 98
89Literal
90ExprTuple99, 100
91Operationoperator: 101
operands: 102
92Operationoperator: 104
operand: 117
93Operationoperator: 104
operand: 114
94Literal
95Operationoperator: 106
operands: 107
96Operationoperator: 108
operands: 109
97Literal
98Variable
99Operationoperator: 111
operands: 110
100Operationoperator: 111
operands: 112
101Literal
102ExprTuple113, 118
103ExprTuple117
104Literal
105ExprTuple114
106Literal
107ExprTuple115, 118
108Literal
109ExprTuple116, 118
110ExprTuple118, 117
111Literal
112ExprTuple118, 119
113Literal
114Literal
115Literal
116Variable
117Literal
118Literal
119Literal