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 Add, Exp, LessEq, Sum, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain, _pos_domain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
sub_expr2 = frac(one, Exp(_diff_l_scaled_delta_floor, two))
sub_expr3 = Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _pos_domain)
expr = LessEq(Add(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain), sub_expr3), Add(Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = _neg_domain), sub_expr3))
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}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right) + \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right)\right) \leq \left(\left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{l^{2}}\right) + \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\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: 62
operands: 5
4Operationoperator: 62
operands: 6
5ExprTuple7, 9
6ExprTuple8, 9
7Operationoperator: 12
operand: 14
8Operationoperator: 12
operand: 15
9Operationoperator: 12
operand: 16
10ExprTuple14
11ExprTuple15
12Literal
13ExprTuple16
14Lambdaparameter: 48
body: 17
15Lambdaparameter: 48
body: 18
16Lambdaparameter: 48
body: 20
17Conditionalvalue: 23
condition: 22
18Conditionalvalue: 21
condition: 22
19ExprTuple48
20Conditionalvalue: 23
condition: 24
21Operationoperator: 27
operands: 25
22Operationoperator: 29
operands: 26
23Operationoperator: 27
operands: 28
24Operationoperator: 29
operands: 30
25ExprTuple74, 31
26ExprTuple48, 32
27Literal
28ExprTuple74, 33
29Literal
30ExprTuple48, 34
31Operationoperator: 64
operands: 35
32Operationoperator: 38
operands: 36
33Operationoperator: 64
operands: 37
34Operationoperator: 38
operands: 39
35ExprTuple48, 69
36ExprTuple40, 41
37ExprTuple42, 69
38Literal
39ExprTuple47, 53
40Operationoperator: 62
operands: 43
41Operationoperator: 72
operand: 47
42Operationoperator: 62
operands: 45
43ExprTuple46, 74
44ExprTuple47
45ExprTuple48, 49
46Operationoperator: 72
operand: 53
47Operationoperator: 62
operands: 51
48Variable
49Operationoperator: 72
operand: 55
50ExprTuple53
51ExprTuple54, 74
52ExprTuple55
53Operationoperator: 64
operands: 56
54Variable
55Operationoperator: 57
operands: 58
56ExprTuple69, 59
57Literal
58ExprTuple60, 61
59Operationoperator: 62
operands: 63
60Operationoperator: 64
operands: 65
61Operationoperator: 66
operand: 71
62Literal
63ExprTuple70, 68
64Literal
65ExprTuple69, 70
66Literal
67ExprTuple71
68Operationoperator: 72
operand: 74
69Literal
70Literal
71Literal
72Literal
73ExprTuple74
74Literal