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 Abs, Add, Exp, LessEq, Mult, Sum, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain, _pos_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
sub_expr2 = Exp(Abs(_rel_indexed_alpha), two)
sub_expr3 = Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _pos_domain)
expr = LessEq(Add(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain), sub_expr3), Add(Sum(index_or_indices = sub_expr1, summand = frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two))), domain = _neg_domain), sub_expr3))
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)} \left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2}\right) + \left(\sum_{l = e + 1}^{2^{t - 1}} \left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2}\right)\right) \leq \left(\left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right) + \left(\sum_{l = e + 1}^{2^{t - 1}} \left|\alpha_{b_{\textit{f}} \oplus l}\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: 70
operands: 5
4Operationoperator: 70
operands: 6
5ExprTuple7, 9
6ExprTuple8, 9
7Operationoperator: 12
operand: 14
8Operationoperator: 12
operand: 15
9Operationoperator: 12
operand: 16
10ExprTuple14
11ExprTuple15
12Literal
13ExprTuple16
14Lambdaparameter: 63
body: 17
15Lambdaparameter: 63
body: 18
16Lambdaparameter: 63
body: 20
17Conditionalvalue: 23
condition: 22
18Conditionalvalue: 21
condition: 22
19ExprTuple63
20Conditionalvalue: 23
condition: 24
21Operationoperator: 25
operands: 26
22Operationoperator: 29
operands: 27
23Operationoperator: 75
operands: 28
24Operationoperator: 29
operands: 30
25Literal
26ExprTuple84, 31
27ExprTuple63, 32
28ExprTuple33, 81
29Literal
30ExprTuple63, 34
31Operationoperator: 68
operands: 35
32Operationoperator: 39
operands: 36
33Operationoperator: 37
operand: 45
34Operationoperator: 39
operands: 40
35ExprTuple41, 42
36ExprTuple43, 44
37Literal
38ExprTuple45
39Literal
40ExprTuple53, 61
41Literal
42Operationoperator: 75
operands: 46
43Operationoperator: 70
operands: 47
44Operationoperator: 79
operand: 53
45Operationoperator: 49
operand: 54
46ExprTuple51, 81
47ExprTuple52, 84
48ExprTuple53
49Literal
50ExprTuple54
51Operationoperator: 70
operands: 55
52Operationoperator: 79
operand: 61
53Operationoperator: 70
operands: 57
54Operationoperator: 58
operands: 59
55ExprTuple63, 60
56ExprTuple61
57ExprTuple62, 84
58Literal
59ExprTuple83, 63
60Operationoperator: 79
operand: 66
61Operationoperator: 75
operands: 65
62Variable
63Variable
64ExprTuple66
65ExprTuple81, 67
66Operationoperator: 68
operands: 69
67Operationoperator: 70
operands: 71
68Literal
69ExprTuple72, 73
70Literal
71ExprTuple82, 74
72Operationoperator: 75
operands: 76
73Operationoperator: 77
operand: 83
74Operationoperator: 79
operand: 84
75Literal
76ExprTuple81, 82
77Literal
78ExprTuple83
79Literal
80ExprTuple84
81Literal
82Literal
83Literal
84Literal