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 = Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = _neg_domain)
expr = LessEq(Mult(sub_expr2, Add(sub_expr3, Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _pos_domain))), Mult(sub_expr2, Add(sub_expr3, 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}{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)\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: 69
operands: 5
4Operationoperator: 69
operands: 6
5ExprTuple8, 7
6ExprTuple8, 9
7Operationoperator: 79
operands: 10
8Operationoperator: 36
operands: 11
9Operationoperator: 79
operands: 12
10ExprTuple15, 13
11ExprTuple87, 14
12ExprTuple15, 16
13Operationoperator: 19
operand: 21
14Literal
15Operationoperator: 19
operand: 22
16Operationoperator: 19
operand: 23
17ExprTuple21
18ExprTuple22
19Literal
20ExprTuple23
21Lambdaparameter: 62
body: 24
22Lambdaparameter: 62
body: 25
23Lambdaparameter: 62
body: 27
24Conditionalvalue: 28
condition: 32
25Conditionalvalue: 29
condition: 30
26ExprTuple62
27Conditionalvalue: 31
condition: 32
28Operationoperator: 36
operands: 33
29Operationoperator: 36
operands: 34
30Operationoperator: 38
operands: 35
31Operationoperator: 36
operands: 37
32Operationoperator: 38
operands: 39
33ExprTuple87, 40
34ExprTuple87, 41
35ExprTuple62, 42
36Literal
37ExprTuple87, 43
38Literal
39ExprTuple62, 44
40Operationoperator: 75
operands: 45
41Operationoperator: 75
operands: 46
42Operationoperator: 49
operands: 47
43Operationoperator: 75
operands: 48
44Operationoperator: 49
operands: 50
45ExprTuple51, 81
46ExprTuple62, 81
47ExprTuple52, 53
48ExprTuple54, 81
49Literal
50ExprTuple61, 67
51Operationoperator: 79
operands: 55
52Operationoperator: 79
operands: 56
53Operationoperator: 85
operand: 61
54Operationoperator: 79
operands: 58
55ExprTuple62, 59
56ExprTuple60, 87
57ExprTuple61
58ExprTuple62, 84
59Operationoperator: 85
operand: 66
60Operationoperator: 85
operand: 67
61Operationoperator: 79
operands: 65
62Variable
63ExprTuple66
64ExprTuple67
65ExprTuple68, 87
66Operationoperator: 69
operands: 70
67Operationoperator: 75
operands: 71
68Variable
69Literal
70ExprTuple72, 73
71ExprTuple81, 74
72Operationoperator: 75
operands: 76
73Operationoperator: 77
operand: 82
74Operationoperator: 79
operands: 80
75Literal
76ExprTuple81, 83
77Literal
78ExprTuple82
79Literal
80ExprTuple83, 84
81Literal
82Literal
83Literal
84Operationoperator: 85
operand: 87
85Literal
86ExprTuple87
87Literal