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, Exp, LessEq, Mult, e, frac, i, one, pi, subtract, two
from proveit.physics.quantum.QPE import _delta_b_floor, _two_pow_t
from proveit.trigonometry import Sin
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Abs(subtract(_delta_b_floor, frac(l, _two_pow_t)))
expr = LessEq(frac(Abs(subtract(one, Exp(e, Mult(two, pi, i, subtract(Mult(_two_pow_t, _delta_b_floor), l))))), Mult(two, _two_pow_t, Sin(Mult(pi, sub_expr1)))), frac(one, Mult(two, _two_pow_t, sub_expr1)))
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())
\frac{\left|1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\left(2^{t} \cdot \delta_{b_{\textit{f}}}\right) - l\right)}\right|}{2 \cdot 2^{t} \cdot \sin{\left(\pi \cdot \left|\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\right|\right)}} \leq \frac{1}{2 \cdot 2^{t} \cdot \left|\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\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: 47
operands: 5
4Operationoperator: 47
operands: 6
5ExprTuple7, 8
6ExprTuple18, 9
7Operationoperator: 26
operand: 13
8Operationoperator: 43
operands: 11
9Operationoperator: 43
operands: 12
10ExprTuple13
11ExprTuple57, 51, 14
12ExprTuple57, 51, 24
13Operationoperator: 37
operands: 15
14Operationoperator: 16
operand: 20
15ExprTuple18, 19
16Literal
17ExprTuple20
18Literal
19Operationoperator: 45
operand: 23
20Operationoperator: 43
operands: 22
21ExprTuple23
22ExprTuple33, 24
23Operationoperator: 54
operands: 25
24Operationoperator: 26
operand: 30
25ExprTuple28, 29
26Literal
27ExprTuple30
28Literal
29Operationoperator: 43
operands: 31
30Operationoperator: 37
operands: 32
31ExprTuple57, 33, 34, 35
32ExprTuple49, 36
33Literal
34Literal
35Operationoperator: 37
operands: 38
36Operationoperator: 45
operand: 42
37Literal
38ExprTuple40, 41
39ExprTuple42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operand: 50
42Operationoperator: 47
operands: 48
43Literal
44ExprTuple51, 49
45Literal
46ExprTuple50
47Literal
48ExprTuple50, 51
49Operationoperator: 52
operand: 56
50Variable
51Operationoperator: 54
operands: 55
52Literal
53ExprTuple56
54Literal
55ExprTuple57, 58
56Literal
57Literal
58Literal