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, Mult, Sum, four, 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 = 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), 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(\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) + \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - 1\right)^{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: 73
operands: 5
4Operationoperator: 73
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 83
operands: 10
8Operationoperator: 40
operands: 11
9Operationoperator: 83
operands: 12
10ExprTuple13, 14
11ExprTuple91, 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: 66
body: 27
24Lambdaparameter: 66
body: 28
25Lambdaparameter: 66
body: 29
26Lambdaparameter: 66
body: 31
27Conditionalvalue: 32
condition: 34
28Conditionalvalue: 32
condition: 36
29Conditionalvalue: 33
condition: 34
30ExprTuple66
31Conditionalvalue: 35
condition: 36
32Operationoperator: 40
operands: 37
33Operationoperator: 40
operands: 38
34Operationoperator: 42
operands: 39
35Operationoperator: 40
operands: 41
36Operationoperator: 42
operands: 43
37ExprTuple91, 44
38ExprTuple91, 45
39ExprTuple66, 46
40Literal
41ExprTuple91, 47
42Literal
43ExprTuple66, 48
44Operationoperator: 79
operands: 49
45Operationoperator: 79
operands: 50
46Operationoperator: 53
operands: 51
47Operationoperator: 79
operands: 52
48Operationoperator: 53
operands: 54
49ExprTuple55, 85
50ExprTuple66, 85
51ExprTuple56, 57
52ExprTuple58, 85
53Literal
54ExprTuple65, 71
55Operationoperator: 83
operands: 59
56Operationoperator: 83
operands: 60
57Operationoperator: 89
operand: 65
58Operationoperator: 83
operands: 62
59ExprTuple66, 63
60ExprTuple64, 91
61ExprTuple65
62ExprTuple66, 88
63Operationoperator: 89
operand: 70
64Operationoperator: 89
operand: 71
65Operationoperator: 83
operands: 69
66Variable
67ExprTuple70
68ExprTuple71
69ExprTuple72, 91
70Operationoperator: 73
operands: 74
71Operationoperator: 79
operands: 75
72Variable
73Literal
74ExprTuple76, 77
75ExprTuple85, 78
76Operationoperator: 79
operands: 80
77Operationoperator: 81
operand: 86
78Operationoperator: 83
operands: 84
79Literal
80ExprTuple85, 87
81Literal
82ExprTuple86
83Literal
84ExprTuple87, 88
85Literal
86Literal
87Literal
88Operationoperator: 89
operand: 91
89Literal
90ExprTuple91
91Literal