logo

Expression of type Equals

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.logic import Equals
from proveit.numbers import Abs, Exp, Mult, e, frac, i, one, pi, subtract, two
from proveit.physics.quantum.QPE import _delta_b_round, _two_pow_t
from proveit.trigonometry import Sin
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Abs(_delta_b_round)
expr = Equals(frac(Abs(subtract(one, Exp(e, Mult(two, pi, i, _delta_b_round, _two_pow_t)))), Abs(subtract(one, Exp(e, Mult(two, pi, i, _delta_b_round))))), frac(Sin(Mult(_two_pow_t, pi, sub_expr1)), Sin(Mult(pi, 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 \delta_{b_{\textit{r}}} \cdot 2^{t}}\right|}{\left|1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \delta_{b_{\textit{r}}}}\right|} = \frac{\sin{\left(2^{t} \cdot \pi \cdot \left|\delta_{b_{\textit{r}}}\right|\right)}}{\sin{\left(\pi \cdot \left|\delta_{b_{\textit{r}}}\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: 6
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple10, 11
8Operationoperator: 33
operand: 17
9Operationoperator: 33
operand: 18
10Operationoperator: 15
operand: 19
11Operationoperator: 15
operand: 20
12ExprTuple17
13ExprTuple18
14ExprTuple19
15Literal
16ExprTuple20
17Operationoperator: 22
operands: 21
18Operationoperator: 22
operands: 23
19Operationoperator: 43
operands: 24
20Operationoperator: 43
operands: 25
21ExprTuple27, 26
22Literal
23ExprTuple27, 28
24ExprTuple45, 46, 29
25ExprTuple46, 29
26Operationoperator: 31
operand: 35
27Literal
28Operationoperator: 31
operand: 36
29Operationoperator: 33
operand: 48
30ExprTuple35
31Literal
32ExprTuple36
33Literal
34ExprTuple48
35Operationoperator: 49
operands: 37
36Operationoperator: 49
operands: 38
37ExprTuple40, 39
38ExprTuple40, 41
39Operationoperator: 43
operands: 42
40Literal
41Operationoperator: 43
operands: 44
42ExprTuple53, 46, 47, 48, 45
43Literal
44ExprTuple53, 46, 47, 48
45Operationoperator: 49
operands: 50
46Literal
47Literal
48Operationoperator: 51
operand: 55
49Literal
50ExprTuple53, 54
51Literal
52ExprTuple55
53Literal
54Literal
55Literal