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 LessEq, ModAbs, greater, one, subtract
from proveit.physics.quantum.QPE import _b_floor, _e_value, _eps, _m_domain, _phase_est_circuit, _two_pow_t
from proveit.statistics import ProbOfAll
In [2]:
# build up the expression from sub-expressions
expr = greater(ProbOfAll(instance_param_or_params = [m], instance_element = _phase_est_circuit, domain = _m_domain, condition = LessEq(ModAbs(subtract(m, _b_floor), _two_pow_t), _e_value)).with_wrapping(), subtract(one, _eps))
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[\begin{array}{l}\textrm{Prob}_{m \in \{0~\ldotp \ldotp~2^{t} - 1\}~|~\left|m - b_{\textit{f}}\right|_{\textup{mod}\thinspace 2^{t}} \leq \left(2^{t - n} - 1\right)}~\\
\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] > \left(1 - \epsilon\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)normalreversed('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
5ExprTuple126, 8
6Literal
7ExprTuple9
8Operationoperator: 129
operand: 13
9Lambdaparameter: 125
body: 12
10ExprTuple13
11ExprTuple125
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: 126
end_index: 127
27ExprRangelambda_map: 39
start_index: 126
end_index: 128
28ExprRangelambda_map: 40
start_index: 126
end_index: 127
29ExprRangelambda_map: 40
start_index: 107
end_index: 108
30ExprRangelambda_map: 41
start_index: 126
end_index: 127
31ExprRangelambda_map: 42
start_index: 126
end_index: 128
32ExprRangelambda_map: 43
start_index: 126
end_index: 127
33ExprRangelambda_map: 44
start_index: 126
end_index: 128
34Literal
35ExprTuple125, 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: 119
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, 98
59ExprTuple72, 99
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: 109
operands: 85
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
83ExprTuple98, 99
84ExprTuple125, 100
85ExprTuple121, 101
86Literal
87ExprTuple102
88Literal
89Literal
90NamedExprsoperation: 103
part: 106
91ExprTuple126, 108
92NamedExprsstate: 104
part: 106
93ExprTuple126, 127
94Literal
95NamedExprsstate: 105
part: 106
96Literal
97ExprTuple107, 108
98Operationoperator: 109
operands: 110
99Operationoperator: 129
operand: 126
100Operationoperator: 129
operand: 122
101Operationoperator: 119
operands: 113
102Literal
103Operationoperator: 114
operands: 115
104Operationoperator: 116
operands: 117
105Literal
106Variable
107Operationoperator: 119
operands: 118
108Operationoperator: 119
operands: 120
109Literal
110ExprTuple121, 127
111ExprTuple126
112ExprTuple122
113ExprTuple127, 123
114Literal
115ExprTuple124, 127
116Literal
117ExprTuple125, 127
118ExprTuple127, 126
119Literal
120ExprTuple127, 128
121Literal
122Literal
123Operationoperator: 129
operand: 131
124Literal
125Variable
126Literal
127Literal
128Literal
129Literal
130ExprTuple131
131Literal