logo

Expression of type ExprTuple

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 ExprTuple, l
from proveit.numbers import Abs, Exp, Mult, e, frac, i, one, pi, subtract, two
from proveit.physics.quantum.QPE import _delta_b_floor, _rel_indexed_alpha, _two_pow_t
from proveit.trigonometry import Sin
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Abs(_rel_indexed_alpha), Mult(frac(one, _two_pow_t), frac(Abs(subtract(one, Exp(e, Mult(two, pi, i, subtract(Mult(_two_pow_t, _delta_b_floor), l))))), Mult(two, Sin(Mult(pi, Abs(subtract(_delta_b_floor, frac(l, _two_pow_t)))))))))
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(\left|\alpha_{b_{\textit{f}} \oplus l}\right|, \frac{1}{2^{t}} \cdot \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 \sin{\left(\pi \cdot \left|\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\right|\right)}}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 32
operand: 5
2Operationoperator: 49
operands: 4
3ExprTuple5
4ExprTuple6, 7
5Operationoperator: 8
operand: 12
6Operationoperator: 53
operands: 10
7Operationoperator: 53
operands: 11
8Literal
9ExprTuple12
10ExprTuple24, 57
11ExprTuple13, 14
12Operationoperator: 15
operands: 16
13Operationoperator: 32
operand: 19
14Operationoperator: 49
operands: 18
15Literal
16ExprTuple62, 56
17ExprTuple19
18ExprTuple63, 20
19Operationoperator: 43
operands: 21
20Operationoperator: 22
operand: 26
21ExprTuple24, 25
22Literal
23ExprTuple26
24Literal
25Operationoperator: 51
operand: 29
26Operationoperator: 49
operands: 28
27ExprTuple29
28ExprTuple39, 30
29Operationoperator: 60
operands: 31
30Operationoperator: 32
operand: 36
31ExprTuple34, 35
32Literal
33ExprTuple36
34Literal
35Operationoperator: 49
operands: 37
36Operationoperator: 43
operands: 38
37ExprTuple63, 39, 40, 41
38ExprTuple55, 42
39Literal
40Literal
41Operationoperator: 43
operands: 44
42Operationoperator: 51
operand: 48
43Literal
44ExprTuple46, 47
45ExprTuple48
46Operationoperator: 49
operands: 50
47Operationoperator: 51
operand: 56
48Operationoperator: 53
operands: 54
49Literal
50ExprTuple57, 55
51Literal
52ExprTuple56
53Literal
54ExprTuple56, 57
55Operationoperator: 58
operand: 62
56Variable
57Operationoperator: 60
operands: 61
58Literal
59ExprTuple62
60Literal
61ExprTuple63, 64
62Literal
63Literal
64Literal