logo

Expression of type LessEq

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 l
from proveit.numbers import Abs, Add, Exp, LessEq, Mult, Sum, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain, _pos_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
sub_expr2 = Exp(Abs(_rel_indexed_alpha), two)
sub_expr3 = frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two)))
expr = LessEq(Add(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _pos_domain)), Add(Sum(index_or_indices = sub_expr1, summand = sub_expr3, domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = sub_expr3, 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(\left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2}\right) + \left(\sum_{l = e + 1}^{2^{t - 1}} \left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2}\right)\right) \leq \left(\left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right) + \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: 72
operands: 5
4Operationoperator: 72
operands: 6
5ExprTuple7, 8
6ExprTuple9, 10
7Operationoperator: 14
operand: 16
8Operationoperator: 14
operand: 17
9Operationoperator: 14
operand: 18
10Operationoperator: 14
operand: 19
11ExprTuple16
12ExprTuple17
13ExprTuple18
14Literal
15ExprTuple19
16Lambdaparameter: 66
body: 20
17Lambdaparameter: 66
body: 21
18Lambdaparameter: 66
body: 22
19Lambdaparameter: 66
body: 24
20Conditionalvalue: 25
condition: 26
21Conditionalvalue: 25
condition: 28
22Conditionalvalue: 27
condition: 26
23ExprTuple66
24Conditionalvalue: 27
condition: 28
25Operationoperator: 81
operands: 29
26Operationoperator: 33
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29ExprTuple35, 86
30ExprTuple66, 36
31Literal
32ExprTuple85, 37
33Literal
34ExprTuple66, 38
35Operationoperator: 39
operand: 45
36Operationoperator: 43
operands: 41
37Operationoperator: 74
operands: 42
38Operationoperator: 43
operands: 44
39Literal
40ExprTuple45
41ExprTuple46, 47
42ExprTuple48, 49
43Literal
44ExprTuple57, 64
45Operationoperator: 50
operand: 55
46Operationoperator: 72
operands: 52
47Operationoperator: 79
operand: 57
48Literal
49Operationoperator: 81
operands: 54
50Literal
51ExprTuple55
52ExprTuple56, 85
53ExprTuple57
54ExprTuple58, 86
55Operationoperator: 59
operands: 60
56Operationoperator: 79
operand: 64
57Operationoperator: 72
operands: 62
58Operationoperator: 72
operands: 63
59Literal
60ExprTuple88, 66
61ExprTuple64
62ExprTuple65, 85
63ExprTuple66, 67
64Operationoperator: 81
operands: 68
65Variable
66Variable
67Operationoperator: 79
operand: 71
68ExprTuple86, 70
69ExprTuple71
70Operationoperator: 72
operands: 73
71Operationoperator: 74
operands: 75
72Literal
73ExprTuple87, 76
74Literal
75ExprTuple77, 78
76Operationoperator: 79
operand: 85
77Operationoperator: 81
operands: 82
78Operationoperator: 83
operand: 88
79Literal
80ExprTuple85
81Literal
82ExprTuple86, 87
83Literal
84ExprTuple88
85Literal
86Literal
87Literal
88Literal