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 Variable, l
from proveit.numbers import Add, Exp, LessEq, Mult, Sum, four, 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, 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))), Mult(sub_expr2, Add(Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = _neg_domain), Variable("_a", latex_format = r"{_{-}a}"))))
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 = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{l^{2}}\right) + {_{-}a}\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: 64
operands: 5
4Operationoperator: 64
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 74
operands: 10
8Operationoperator: 35
operands: 11
9Operationoperator: 74
operands: 12
10ExprTuple13, 14
11ExprTuple82, 15
12ExprTuple16, 17
13Operationoperator: 20
operand: 22
14Operationoperator: 20
operand: 23
15Literal
16Operationoperator: 20
operand: 24
17Variable
18ExprTuple22
19ExprTuple23
20Literal
21ExprTuple24
22Lambdaparameter: 54
body: 25
23Lambdaparameter: 54
body: 26
24Lambdaparameter: 54
body: 28
25Conditionalvalue: 29
condition: 32
26Conditionalvalue: 29
condition: 30
27ExprTuple54
28Conditionalvalue: 31
condition: 32
29Operationoperator: 35
operands: 33
30Operationoperator: 37
operands: 34
31Operationoperator: 35
operands: 36
32Operationoperator: 37
operands: 38
33ExprTuple82, 39
34ExprTuple54, 40
35Literal
36ExprTuple82, 41
37Literal
38ExprTuple54, 42
39Operationoperator: 70
operands: 43
40Operationoperator: 46
operands: 44
41Operationoperator: 70
operands: 45
42Operationoperator: 46
operands: 47
43ExprTuple48, 76
44ExprTuple57, 62
45ExprTuple54, 76
46Literal
47ExprTuple49, 50
48Operationoperator: 74
operands: 51
49Operationoperator: 74
operands: 52
50Operationoperator: 80
operand: 57
51ExprTuple54, 55
52ExprTuple56, 82
53ExprTuple57
54Variable
55Operationoperator: 80
operand: 61
56Operationoperator: 80
operand: 62
57Operationoperator: 74
operands: 60
58ExprTuple61
59ExprTuple62
60ExprTuple63, 82
61Operationoperator: 64
operands: 65
62Operationoperator: 70
operands: 66
63Variable
64Literal
65ExprTuple67, 68
66ExprTuple76, 69
67Operationoperator: 70
operands: 71
68Operationoperator: 72
operand: 77
69Operationoperator: 74
operands: 75
70Literal
71ExprTuple76, 78
72Literal
73ExprTuple77
74Literal
75ExprTuple78, 79
76Literal
77Literal
78Literal
79Operationoperator: 80
operand: 82
80Literal
81ExprTuple82
82Literal