logo

Expression of type Less

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 m
from proveit.numbers import Less, one, subtract
from proveit.physics.quantum.QPE import _eps, _m_domain, _phase_est_circuit, _success_cond
from proveit.statistics import ProbOfAll
In [2]:
# build up the expression from sub-expressions
expr = Less(subtract(one, _eps), ProbOfAll(instance_param_or_params = [m], instance_element = _phase_est_circuit, domain = _m_domain, condition = _success_cond).with_wrapping())
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(1 - \epsilon\right) < \left[\begin{array}{l}\textrm{Prob}_{m \in \{0~\ldotp \ldotp~2^{t} - 1\}~|~\left|\frac{m}{2^{t}} - \varphi\right|_{\textup{mod}\thinspace 1} \leq 2^{-n}}~\\
\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
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 119
operands: 5
4Operationoperator: 6
operand: 9
5ExprTuple125, 8
6Literal
7ExprTuple9
8Operationoperator: 112
operand: 13
9Lambdaparameter: 124
body: 12
10ExprTuple13
11ExprTuple124
12Conditionalvalue: 14
condition: 15
13Literal
14Operationoperator: 16
operands: 17
15Operationoperator: 18
operands: 19
16Literal
17ExprTuple20, 21, 22, 23
18Literal
19ExprTuple24, 25
20ExprTuple26, 27
21ExprTuple28, 29
22ExprTuple30, 31
23ExprTuple32, 33
24Operationoperator: 34
operands: 35
25Operationoperator: 36
operands: 37
26ExprRangelambda_map: 38
start_index: 125
end_index: 130
27ExprRangelambda_map: 39
start_index: 125
end_index: 126
28ExprRangelambda_map: 40
start_index: 125
end_index: 130
29ExprRangelambda_map: 40
start_index: 107
end_index: 108
30ExprRangelambda_map: 41
start_index: 125
end_index: 130
31ExprRangelambda_map: 42
start_index: 125
end_index: 126
32ExprRangelambda_map: 43
start_index: 125
end_index: 130
33ExprRangelambda_map: 44
start_index: 125
end_index: 126
34Literal
35ExprTuple124, 45
36Literal
37ExprTuple46, 47
38Lambdaparameter: 106
body: 48
39Lambdaparameter: 106
body: 49
40Lambdaparameter: 106
body: 50
41Lambdaparameter: 106
body: 51
42Lambdaparameter: 106
body: 52
43Lambdaparameter: 106
body: 53
44Lambdaparameter: 106
body: 55
45Operationoperator: 96
operands: 56
46Operationoperator: 57
operands: 58
47Operationoperator: 127
operands: 59
48Operationoperator: 88
operands: 60
49Operationoperator: 67
operands: 61
50Operationoperator: 67
operands: 62
51Operationoperator: 63
operands: 64
52Operationoperator: 89
operands: 65
53Operationoperator: 67
operands: 66
54ExprTuple106
55Operationoperator: 67
operands: 68
56ExprTuple69, 70
57Literal
58ExprTuple71, 125
59ExprTuple129, 72
60NamedExprsstate: 73
61NamedExprselement: 74
targets: 82
62NamedExprselement: 75
targets: 76
63Literal
64NamedExprsbasis: 77
65NamedExprsoperation: 78
66NamedExprselement: 79
targets: 80
67Literal
68NamedExprselement: 81
targets: 82
69Literal
70Operationoperator: 119
operands: 83
71Operationoperator: 119
operands: 84
72Operationoperator: 112
operand: 101
73Operationoperator: 86
operand: 102
74Operationoperator: 88
operands: 95
75Operationoperator: 89
operands: 90
76Operationoperator: 96
operands: 91
77Literal
78Literal
79Operationoperator: 94
operands: 92
80Operationoperator: 96
operands: 93
81Operationoperator: 94
operands: 95
82Operationoperator: 96
operands: 97
83ExprTuple121, 98
84ExprTuple99, 100
85ExprTuple101
86Literal
87ExprTuple102
88Literal
89Literal
90NamedExprsoperation: 103
part: 106
91ExprTuple125, 108
92NamedExprsstate: 104
part: 106
93ExprTuple125, 130
94Literal
95NamedExprsstate: 105
part: 106
96Literal
97ExprTuple107, 108
98Operationoperator: 112
operand: 125
99Operationoperator: 110
operands: 111
100Operationoperator: 112
operand: 122
101Literal
102Literal
103Operationoperator: 114
operands: 115
104Operationoperator: 116
operands: 117
105Literal
106Variable
107Operationoperator: 119
operands: 118
108Operationoperator: 119
operands: 120
109ExprTuple125
110Literal
111ExprTuple124, 121
112Literal
113ExprTuple122
114Literal
115ExprTuple123, 130
116Literal
117ExprTuple124, 130
118ExprTuple130, 125
119Literal
120ExprTuple130, 126
121Operationoperator: 127
operands: 128
122Literal
123Literal
124Variable
125Literal
126Literal
127Literal
128ExprTuple129, 130
129Literal
130Literal