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 = frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two)))
sub_expr3 = Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain)
expr = LessEq(Add(sub_expr3, Sum(index_or_indices = sub_expr1, summand = Exp(Abs(_rel_indexed_alpha), two), domain = _pos_domain)), Add(sub_expr3, Sum(index_or_indices = sub_expr1, summand = sub_expr2, 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)} \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}} \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: 68
operands: 5
4Operationoperator: 68
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 12
operand: 14
8Operationoperator: 12
operand: 15
9Operationoperator: 12
operand: 16
10ExprTuple14
11ExprTuple15
12Literal
13ExprTuple16
14Lambdaparameter: 62
body: 17
15Lambdaparameter: 62
body: 18
16Lambdaparameter: 62
body: 20
17Conditionalvalue: 21
condition: 24
18Conditionalvalue: 23
condition: 22
19ExprTuple62
20Conditionalvalue: 23
condition: 24
21Operationoperator: 77
operands: 25
22Operationoperator: 29
operands: 26
23Operationoperator: 27
operands: 28
24Operationoperator: 29
operands: 30
25ExprTuple31, 82
26ExprTuple62, 32
27Literal
28ExprTuple81, 33
29Literal
30ExprTuple62, 34
31Operationoperator: 35
operand: 41
32Operationoperator: 39
operands: 37
33Operationoperator: 70
operands: 38
34Operationoperator: 39
operands: 40
35Literal
36ExprTuple41
37ExprTuple42, 43
38ExprTuple44, 45
39Literal
40ExprTuple53, 60
41Operationoperator: 46
operand: 51
42Operationoperator: 68
operands: 48
43Operationoperator: 75
operand: 53
44Literal
45Operationoperator: 77
operands: 50
46Literal
47ExprTuple51
48ExprTuple52, 81
49ExprTuple53
50ExprTuple54, 82
51Operationoperator: 55
operands: 56
52Operationoperator: 75
operand: 60
53Operationoperator: 68
operands: 58
54Operationoperator: 68
operands: 59
55Literal
56ExprTuple84, 62
57ExprTuple60
58ExprTuple61, 81
59ExprTuple62, 63
60Operationoperator: 77
operands: 64
61Variable
62Variable
63Operationoperator: 75
operand: 67
64ExprTuple82, 66
65ExprTuple67
66Operationoperator: 68
operands: 69
67Operationoperator: 70
operands: 71
68Literal
69ExprTuple83, 72
70Literal
71ExprTuple73, 74
72Operationoperator: 75
operand: 81
73Operationoperator: 77
operands: 78
74Operationoperator: 79
operand: 84
75Literal
76ExprTuple81
77Literal
78ExprTuple82, 83
79Literal
80ExprTuple84
81Literal
82Literal
83Literal
84Literal