logo

Expression of type Implies

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 k, l
from proveit.logic import Forall, Implies
from proveit.numbers import Abs, Exp, LessEq, Mult, Sum, four, frac, one, subtract, two
from proveit.physics.quantum.QPE import ModAdd, SubIndexed, _alpha, _b_floor, _delta_b_floor, _diff_l_scaled_delta_floor, _pos_domain, _rel_indexed_alpha, _two_pow_t
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
expr = Implies(Forall(instance_param_or_params = [k], instance_expr = LessEq(Exp(Abs(SubIndexed(_alpha, [ModAdd(_b_floor, k)])), two), frac(one, Mult(four, Exp(subtract(k, Mult(_two_pow_t, _delta_b_floor)), two)))), domain = _pos_domain), LessEq(Sum(index_or_indices = sub_expr1, summand = Exp(Abs(_rel_indexed_alpha), two), domain = _pos_domain), Sum(index_or_indices = sub_expr1, summand = frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two))), domain = _pos_domain)))
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[\forall_{k \in \{e + 1~\ldotp \ldotp~2^{t - 1}\}}~\left(\left|\alpha_{b_{\textit{f}} \oplus k}\right|^{2} \leq \frac{1}{4 \cdot \left(k - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right)\right] \Rightarrow \left(\left(\sum_{l = e + 1}^{2^{t - 1}} \left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2}\right) \leq \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right)\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: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameter: 77
body: 12
9Operationoperator: 14
operand: 18
10Operationoperator: 14
operand: 19
11ExprTuple77
12Conditionalvalue: 16
condition: 17
13ExprTuple18
14Literal
15ExprTuple19
16Operationoperator: 20
operands: 21
17Operationoperator: 36
operands: 22
18Lambdaparameter: 78
body: 23
19Lambdaparameter: 78
body: 25
20Literal
21ExprTuple26, 27
22ExprTuple77, 42
23Conditionalvalue: 28
condition: 30
24ExprTuple78
25Conditionalvalue: 29
condition: 30
26Operationoperator: 90
operands: 31
27Operationoperator: 34
operands: 32
28Operationoperator: 90
operands: 33
29Operationoperator: 34
operands: 35
30Operationoperator: 36
operands: 37
31ExprTuple38, 94
32ExprTuple85, 39
33ExprTuple40, 94
34Literal
35ExprTuple85, 41
36Literal
37ExprTuple78, 42
38Operationoperator: 45
operand: 50
39Operationoperator: 86
operands: 44
40Operationoperator: 45
operand: 52
41Operationoperator: 86
operands: 47
42Operationoperator: 48
operands: 49
43ExprTuple50
44ExprTuple53, 51
45Literal
46ExprTuple52
47ExprTuple53, 54
48Literal
49ExprTuple55, 56
50Operationoperator: 59
operand: 64
51Operationoperator: 90
operands: 58
52Operationoperator: 59
operand: 66
53Literal
54Operationoperator: 90
operands: 61
55Operationoperator: 75
operands: 62
56Operationoperator: 90
operands: 63
57ExprTuple64
58ExprTuple65, 94
59Literal
60ExprTuple66
61ExprTuple67, 94
62ExprTuple68, 85
63ExprTuple94, 69
64Operationoperator: 72
operands: 70
65Operationoperator: 75
operands: 71
66Operationoperator: 72
operands: 73
67Operationoperator: 75
operands: 74
68Variable
69Operationoperator: 75
operands: 76
70ExprTuple96, 77
71ExprTuple77, 79
72Literal
73ExprTuple96, 78
74ExprTuple78, 79
75Literal
76ExprTuple95, 80
77Variable
78Variable
79Operationoperator: 82
operand: 84
80Operationoperator: 82
operand: 85
81ExprTuple84
82Literal
83ExprTuple85
84Operationoperator: 86
operands: 87
85Literal
86Literal
87ExprTuple88, 89
88Operationoperator: 90
operands: 91
89Operationoperator: 92
operand: 96
90Literal
91ExprTuple94, 95
92Literal
93ExprTuple96
94Literal
95Literal
96Literal