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, 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))), Mult(sub_expr2, Add(Variable("_a", latex_format = r"{_{-}a}"), Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = Interval(e, subtract(_two_pow__t_minus_one, one))))))
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({_{-}a} + \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: 71
operands: 5
4Operationoperator: 71
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 76
operands: 10
8Operationoperator: 37
operands: 11
9Operationoperator: 76
operands: 12
10ExprTuple13, 14
11ExprTuple88, 15
12ExprTuple16, 17
13Operationoperator: 20
operand: 22
14Operationoperator: 20
operand: 23
15Literal
16Variable
17Operationoperator: 20
operand: 24
18ExprTuple22
19ExprTuple23
20Literal
21ExprTuple24
22Lambdaparameter: 62
body: 25
23Lambdaparameter: 62
body: 26
24Lambdaparameter: 62
body: 28
25Conditionalvalue: 30
condition: 29
26Conditionalvalue: 30
condition: 31
27ExprTuple62
28Conditionalvalue: 32
condition: 33
29Operationoperator: 39
operands: 34
30Operationoperator: 37
operands: 35
31Operationoperator: 39
operands: 36
32Operationoperator: 37
operands: 38
33Operationoperator: 39
operands: 40
34ExprTuple62, 41
35ExprTuple88, 42
36ExprTuple62, 43
37Literal
38ExprTuple88, 44
39Literal
40ExprTuple62, 45
41Operationoperator: 50
operands: 46
42Operationoperator: 78
operands: 47
43Operationoperator: 50
operands: 48
44Operationoperator: 78
operands: 49
45Operationoperator: 50
operands: 51
46ExprTuple52, 53
47ExprTuple54, 83
48ExprTuple61, 67
49ExprTuple62, 83
50Literal
51ExprTuple68, 55
52Operationoperator: 76
operands: 56
53Operationoperator: 86
operand: 61
54Operationoperator: 76
operands: 58
55Operationoperator: 76
operands: 59
56ExprTuple60, 88
57ExprTuple61
58ExprTuple62, 63
59ExprTuple67, 82
60Operationoperator: 86
operand: 67
61Operationoperator: 76
operands: 65
62Variable
63Operationoperator: 86
operand: 69
64ExprTuple67
65ExprTuple68, 88
66ExprTuple69
67Operationoperator: 78
operands: 70
68Variable
69Operationoperator: 71
operands: 72
70ExprTuple83, 73
71Literal
72ExprTuple74, 75
73Operationoperator: 76
operands: 77
74Operationoperator: 78
operands: 79
75Operationoperator: 80
operand: 85
76Literal
77ExprTuple84, 82
78Literal
79ExprTuple83, 84
80Literal
81ExprTuple85
82Operationoperator: 86
operand: 88
83Literal
84Literal
85Literal
86Literal
87ExprTuple88
88Literal