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 e, l
from proveit.numbers import Add, Exp, Interval, LessEq, Mult, Sum, four, frac, one, subtract, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain, _pos_domain, _two_pow__t_minus_one
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
sub_expr2 = frac(one, four)
sub_expr3 = frac(one, Exp(l, two))
sub_expr4 = subtract(_two_pow__t_minus_one, one)
sub_expr5 = frac(one, Exp(_diff_l_scaled_delta_floor, two))
expr = LessEq(Mult(sub_expr2, Add(Sum(index_or_indices = sub_expr1, summand = sub_expr5, domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = sub_expr5, domain = _pos_domain))), Mult(sub_expr2, Add(Sum(index_or_indices = sub_expr1, summand = sub_expr3, domain = Interval(Add(e, one), sub_expr4)), Sum(index_or_indices = sub_expr1, summand = sub_expr3, domain = Interval(e, sub_expr4)))))
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(\frac{1}{4} \cdot \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)\right) \leq \left(\frac{1}{4} \cdot \left(\left(\sum_{l = e + 1}^{2^{t - 1} - 1} \frac{1}{l^{2}}\right) + \left(\sum_{l = e}^{2^{t - 1} - 1} \frac{1}{l^{2}}\right)\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: 78
operands: 5
4Operationoperator: 78
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 83
operands: 10
8Operationoperator: 42
operands: 11
9Operationoperator: 83
operands: 12
10ExprTuple13, 14
11ExprTuple95, 15
12ExprTuple16, 17
13Operationoperator: 21
operand: 23
14Operationoperator: 21
operand: 24
15Literal
16Operationoperator: 21
operand: 25
17Operationoperator: 21
operand: 26
18ExprTuple23
19ExprTuple24
20ExprTuple25
21Literal
22ExprTuple26
23Lambdaparameter: 69
body: 27
24Lambdaparameter: 69
body: 28
25Lambdaparameter: 69
body: 29
26Lambdaparameter: 69
body: 31
27Conditionalvalue: 33
condition: 32
28Conditionalvalue: 33
condition: 34
29Conditionalvalue: 36
condition: 35
30ExprTuple69
31Conditionalvalue: 36
condition: 37
32Operationoperator: 44
operands: 38
33Operationoperator: 42
operands: 39
34Operationoperator: 44
operands: 40
35Operationoperator: 44
operands: 41
36Operationoperator: 42
operands: 43
37Operationoperator: 44
operands: 45
38ExprTuple69, 46
39ExprTuple95, 47
40ExprTuple69, 48
41ExprTuple69, 49
42Literal
43ExprTuple95, 50
44Literal
45ExprTuple69, 51
46Operationoperator: 57
operands: 52
47Operationoperator: 85
operands: 53
48Operationoperator: 57
operands: 54
49Operationoperator: 57
operands: 55
50Operationoperator: 85
operands: 56
51Operationoperator: 57
operands: 58
52ExprTuple59, 60
53ExprTuple61, 90
54ExprTuple68, 74
55ExprTuple68, 62
56ExprTuple69, 90
57Literal
58ExprTuple75, 62
59Operationoperator: 83
operands: 63
60Operationoperator: 93
operand: 68
61Operationoperator: 83
operands: 65
62Operationoperator: 83
operands: 66
63ExprTuple67, 95
64ExprTuple68
65ExprTuple69, 70
66ExprTuple74, 89
67Operationoperator: 93
operand: 74
68Operationoperator: 83
operands: 72
69Variable
70Operationoperator: 93
operand: 76
71ExprTuple74
72ExprTuple75, 95
73ExprTuple76
74Operationoperator: 85
operands: 77
75Variable
76Operationoperator: 78
operands: 79
77ExprTuple90, 80
78Literal
79ExprTuple81, 82
80Operationoperator: 83
operands: 84
81Operationoperator: 85
operands: 86
82Operationoperator: 87
operand: 92
83Literal
84ExprTuple91, 89
85Literal
86ExprTuple90, 91
87Literal
88ExprTuple92
89Operationoperator: 93
operand: 95
90Literal
91Literal
92Literal
93Literal
94ExprTuple95
95Literal