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, subtract, 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 = Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = _neg_domain)
expr = LessEq(Add(sub_expr2, Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _pos_domain)), Add(sub_expr2, Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(subtract(l, one), two)), domain = _pos_domain)))
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}{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) \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 - 1\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: 72
operands: 5
4Operationoperator: 72
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 12
operand: 14
8Operationoperator: 12
operand: 15
9Operationoperator: 12
operand: 16
10ExprTuple14
11ExprTuple15
12Literal
13ExprTuple16
14Lambdaparameter: 55
body: 17
15Lambdaparameter: 55
body: 18
16Lambdaparameter: 55
body: 20
17Conditionalvalue: 21
condition: 25
18Conditionalvalue: 22
condition: 23
19ExprTuple55
20Conditionalvalue: 24
condition: 25
21Operationoperator: 29
operands: 26
22Operationoperator: 29
operands: 27
23Operationoperator: 31
operands: 28
24Operationoperator: 29
operands: 30
25Operationoperator: 31
operands: 32
26ExprTuple80, 33
27ExprTuple80, 34
28ExprTuple55, 35
29Literal
30ExprTuple80, 36
31Literal
32ExprTuple55, 37
33Operationoperator: 68
operands: 38
34Operationoperator: 68
operands: 39
35Operationoperator: 42
operands: 40
36Operationoperator: 68
operands: 41
37Operationoperator: 42
operands: 43
38ExprTuple44, 74
39ExprTuple55, 74
40ExprTuple45, 46
41ExprTuple47, 74
42Literal
43ExprTuple54, 60
44Operationoperator: 72
operands: 48
45Operationoperator: 72
operands: 49
46Operationoperator: 78
operand: 54
47Operationoperator: 72
operands: 51
48ExprTuple55, 52
49ExprTuple53, 80
50ExprTuple54
51ExprTuple55, 77
52Operationoperator: 78
operand: 59
53Operationoperator: 78
operand: 60
54Operationoperator: 72
operands: 58
55Variable
56ExprTuple59
57ExprTuple60
58ExprTuple61, 80
59Operationoperator: 62
operands: 63
60Operationoperator: 68
operands: 64
61Variable
62Literal
63ExprTuple65, 66
64ExprTuple74, 67
65Operationoperator: 68
operands: 69
66Operationoperator: 70
operand: 75
67Operationoperator: 72
operands: 73
68Literal
69ExprTuple74, 76
70Literal
71ExprTuple75
72Literal
73ExprTuple76, 77
74Literal
75Literal
76Literal
77Operationoperator: 78
operand: 80
78Literal
79ExprTuple80
80Literal