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 Variable
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 = subtract(Exp(two, subtract(_t, _n)), one)
expr = greater_eq(Add(one, Neg(frac(one, Mult(two, sub_expr1))), Neg(frac(one, Mult(four, Exp(sub_expr1, two))))), Add(one, Neg(Variable("_a", latex_format = r"{_{-}a}")), Neg(frac(one, Exp(Add(two, frac(one, _eps)), 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 - {_{-}a} - \frac{1}{\left(2 + \frac{1}{\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: 48
operands: 5
4Operationoperator: 48
operands: 6
5ExprTuple47, 7, 8
6ExprTuple47, 9, 10
7Operationoperator: 52
operand: 15
8Operationoperator: 52
operand: 16
9Operationoperator: 52
operand: 17
10Operationoperator: 52
operand: 18
11ExprTuple15
12ExprTuple16
13ExprTuple17
14ExprTuple18
15Variable
16Operationoperator: 36
operands: 19
17Operationoperator: 36
operands: 20
18Operationoperator: 36
operands: 21
19ExprTuple47, 22
20ExprTuple47, 23
21ExprTuple47, 24
22Operationoperator: 42
operands: 25
23Operationoperator: 27
operands: 26
24Operationoperator: 27
operands: 28
25ExprTuple29, 45
26ExprTuple45, 35
27Literal
28ExprTuple30, 31
29Operationoperator: 48
operands: 32
30Literal
31Operationoperator: 42
operands: 33
32ExprTuple45, 34
33ExprTuple35, 45
34Operationoperator: 36
operands: 37
35Operationoperator: 48
operands: 38
36Literal
37ExprTuple47, 39
38ExprTuple40, 41
39Literal
40Operationoperator: 42
operands: 43
41Operationoperator: 52
operand: 47
42Literal
43ExprTuple45, 46
44ExprTuple47
45Literal
46Operationoperator: 48
operands: 49
47Literal
48Literal
49ExprTuple50, 51
50Literal
51Operationoperator: 52
operand: 54
52Literal
53ExprTuple54
54Literal