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), 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, 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{\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)}}\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: 28
operand: 5
2Operationoperator: 49
operands: 4
3ExprTuple5
4ExprTuple6, 7
5Operationoperator: 8
operand: 12
6Operationoperator: 28
operand: 13
7Operationoperator: 45
operands: 11
8Literal
9ExprTuple12
10ExprTuple13
11ExprTuple59, 53, 14
12Operationoperator: 15
operands: 16
13Operationoperator: 39
operands: 17
14Operationoperator: 18
operand: 22
15Literal
16ExprTuple58, 52
17ExprTuple20, 21
18Literal
19ExprTuple22
20Literal
21Operationoperator: 47
operand: 25
22Operationoperator: 45
operands: 24
23ExprTuple25
24ExprTuple35, 26
25Operationoperator: 56
operands: 27
26Operationoperator: 28
operand: 32
27ExprTuple30, 31
28Literal
29ExprTuple32
30Literal
31Operationoperator: 45
operands: 33
32Operationoperator: 39
operands: 34
33ExprTuple59, 35, 36, 37
34ExprTuple51, 38
35Literal
36Literal
37Operationoperator: 39
operands: 40
38Operationoperator: 47
operand: 44
39Literal
40ExprTuple42, 43
41ExprTuple44
42Operationoperator: 45
operands: 46
43Operationoperator: 47
operand: 52
44Operationoperator: 49
operands: 50
45Literal
46ExprTuple53, 51
47Literal
48ExprTuple52
49Literal
50ExprTuple52, 53
51Operationoperator: 54
operand: 58
52Variable
53Operationoperator: 56
operands: 57
54Literal
55ExprTuple58
56Literal
57ExprTuple59, 60
58Literal
59Literal
60Literal