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 e, l
from proveit.numbers import Add, Exp, LessEq, Mult, Sum, four, frac, one, two
from proveit.physics.quantum.QPE import Pfail, _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, Mult(four, Exp(_diff_l_scaled_delta_floor, two)))
expr = LessEq(Pfail(e), Add(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = sub_expr2, 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[P_{\rm fail}\right]\left(e\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}} \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\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: 5
operand: 47
4Operationoperator: 54
operands: 7
5Literal
6ExprTuple47
7ExprTuple8, 9
8Operationoperator: 11
operand: 13
9Operationoperator: 11
operand: 14
10ExprTuple13
11Literal
12ExprTuple14
13Lambdaparameter: 48
body: 15
14Lambdaparameter: 48
body: 17
15Conditionalvalue: 19
condition: 18
16ExprTuple48
17Conditionalvalue: 19
condition: 20
18Operationoperator: 24
operands: 21
19Operationoperator: 22
operands: 23
20Operationoperator: 24
operands: 25
21ExprTuple48, 26
22Literal
23ExprTuple67, 27
24Literal
25ExprTuple48, 28
26Operationoperator: 31
operands: 29
27Operationoperator: 56
operands: 30
28Operationoperator: 31
operands: 32
29ExprTuple33, 34
30ExprTuple35, 36
31Literal
32ExprTuple41, 46
33Operationoperator: 54
operands: 37
34Operationoperator: 61
operand: 41
35Literal
36Operationoperator: 63
operands: 39
37ExprTuple40, 67
38ExprTuple41
39ExprTuple42, 68
40Operationoperator: 61
operand: 46
41Operationoperator: 54
operands: 44
42Operationoperator: 54
operands: 45
43ExprTuple46
44ExprTuple47, 67
45ExprTuple48, 49
46Operationoperator: 63
operands: 50
47Variable
48Variable
49Operationoperator: 61
operand: 53
50ExprTuple68, 52
51ExprTuple53
52Operationoperator: 54
operands: 55
53Operationoperator: 56
operands: 57
54Literal
55ExprTuple69, 58
56Literal
57ExprTuple59, 60
58Operationoperator: 61
operand: 67
59Operationoperator: 63
operands: 64
60Operationoperator: 65
operand: 70
61Literal
62ExprTuple67
63Literal
64ExprTuple68, 69
65Literal
66ExprTuple70
67Literal
68Literal
69Literal
70Literal