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.numbers import Add, Exp, Mult, Neg, four, frac, greater_eq, one, subtract, two
from proveit.physics.quantum.QPE import _eps, _n, _t
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Add(one, frac(one, Mult(two, _eps)))
sub_expr2 = subtract(Exp(two, subtract(_t, _n)), one)
expr = greater_eq(Add(one, Neg(frac(one, Mult(two, sub_expr2))), Neg(frac(one, Mult(four, Exp(sub_expr2, two))))), Add(one, Neg(frac(one, Mult(two, sub_expr1))), Neg(frac(one, Mult(four, Exp(sub_expr1, two))))))
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(1 - \frac{1}{2 \cdot \left(2^{t - n} - 1\right)} - \frac{1}{4 \cdot \left(2^{t - n} - 1\right)^{2}}\right) \geq \left(1 - \frac{1}{2 \cdot \left(1 + \frac{1}{2 \cdot \epsilon}\right)} - \frac{1}{4 \cdot \left(1 + \frac{1}{2 \cdot \epsilon}\right)^{2}}\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)normalreversed('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: 53
operands: 5
4Operationoperator: 53
operands: 6
5ExprTuple50, 7, 8
6ExprTuple50, 9, 10
7Operationoperator: 59
operand: 15
8Operationoperator: 59
operand: 16
9Operationoperator: 59
operand: 17
10Operationoperator: 59
operand: 18
11ExprTuple15
12ExprTuple16
13ExprTuple17
14ExprTuple18
15Operationoperator: 43
operands: 19
16Operationoperator: 43
operands: 20
17Operationoperator: 43
operands: 21
18Operationoperator: 43
operands: 22
19ExprTuple50, 23
20ExprTuple50, 24
21ExprTuple50, 25
22ExprTuple50, 26
23Operationoperator: 51
operands: 27
24Operationoperator: 51
operands: 28
25Operationoperator: 51
operands: 29
26Operationoperator: 51
operands: 30
27ExprTuple55, 36
28ExprTuple32, 31
29ExprTuple55, 37
30ExprTuple32, 33
31Operationoperator: 45
operands: 34
32Literal
33Operationoperator: 45
operands: 35
34ExprTuple36, 55
35ExprTuple37, 55
36Operationoperator: 53
operands: 38
37Operationoperator: 53
operands: 39
38ExprTuple50, 40
39ExprTuple41, 42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operands: 46
42Operationoperator: 59
operand: 50
43Literal
44ExprTuple50, 48
45Literal
46ExprTuple55, 49
47ExprTuple50
48Operationoperator: 51
operands: 52
49Operationoperator: 53
operands: 54
50Literal
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple57, 58
55Literal
56Literal
57Literal
58Operationoperator: 59
operand: 61
59Literal
60ExprTuple61
61Literal