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(_diff_l_scaled_delta_floor, two))
expr = LessEq(Mult(sub_expr2, 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))), Add(Mult(frac(one, two), Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = Interval(Add(e, one), subtract(_two_pow__t_minus_one, one)))), Mult(sub_expr2, frac(one, Exp(e, two)))))
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(\left(\frac{1}{2} \cdot \left(\sum_{l = e + 1}^{2^{t - 1} - 1} \frac{1}{l^{2}}\right)\right) + \left(\frac{1}{4} \cdot \frac{1}{e^{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: 78
operands: 5
4Operationoperator: 83
operands: 6
5ExprTuple17, 7
6ExprTuple8, 9
7Operationoperator: 83
operands: 10
8Operationoperator: 78
operands: 11
9Operationoperator: 78
operands: 12
10ExprTuple13, 14
11ExprTuple15, 16
12ExprTuple17, 18
13Operationoperator: 22
operand: 26
14Operationoperator: 22
operand: 27
15Operationoperator: 44
operands: 21
16Operationoperator: 22
operand: 28
17Operationoperator: 44
operands: 24
18Operationoperator: 44
operands: 25
19ExprTuple26
20ExprTuple27
21ExprTuple95, 90
22Literal
23ExprTuple28
24ExprTuple95, 29
25ExprTuple95, 30
26Lambdaparameter: 69
body: 31
27Lambdaparameter: 69
body: 32
28Lambdaparameter: 69
body: 34
29Literal
30Operationoperator: 85
operands: 35
31Conditionalvalue: 37
condition: 36
32Conditionalvalue: 37
condition: 38
33ExprTuple69
34Conditionalvalue: 39
condition: 40
35ExprTuple75, 90
36Operationoperator: 46
operands: 41
37Operationoperator: 44
operands: 42
38Operationoperator: 46
operands: 43
39Operationoperator: 44
operands: 45
40Operationoperator: 46
operands: 47
41ExprTuple69, 48
42ExprTuple95, 49
43ExprTuple69, 50
44Literal
45ExprTuple95, 51
46Literal
47ExprTuple69, 52
48Operationoperator: 57
operands: 53
49Operationoperator: 85
operands: 54
50Operationoperator: 57
operands: 55
51Operationoperator: 85
operands: 56
52Operationoperator: 57
operands: 58
53ExprTuple59, 60
54ExprTuple61, 90
55ExprTuple68, 74
56ExprTuple69, 90
57Literal
58ExprTuple68, 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