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
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 = ExprTuple(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(Mult(two, Sin(Mult(_two_pow_t, pi, sub_expr1))), Mult(two, 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())
\left(\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{2 \cdot \sin{\left(2^{t} \cdot \pi \cdot \left|\delta_{b_{\textit{r}}}\right|\right)}}{2 \cdot \sin{\left(\pi \cdot \left|\delta_{b_{\textit{r}}}\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: 4
operands: 3
2Operationoperator: 4
operands: 5
3ExprTuple6, 7
4Literal
5ExprTuple8, 9
6Operationoperator: 39
operand: 14
7Operationoperator: 39
operand: 15
8Operationoperator: 45
operands: 12
9Operationoperator: 45
operands: 13
10ExprTuple14
11ExprTuple15
12ExprTuple55, 16
13ExprTuple55, 17
14Operationoperator: 19
operands: 18
15Operationoperator: 19
operands: 20
16Operationoperator: 22
operand: 27
17Operationoperator: 22
operand: 28
18ExprTuple25, 24
19Literal
20ExprTuple25, 26
21ExprTuple27
22Literal
23ExprTuple28
24Operationoperator: 30
operand: 34
25Literal
26Operationoperator: 30
operand: 35
27Operationoperator: 45
operands: 32
28Operationoperator: 45
operands: 33
29ExprTuple34
30Literal
31ExprTuple35
32ExprTuple47, 48, 36
33ExprTuple48, 36
34Operationoperator: 51
operands: 37
35Operationoperator: 51
operands: 38
36Operationoperator: 39
operand: 50
37ExprTuple42, 41
38ExprTuple42, 43
39Literal
40ExprTuple50
41Operationoperator: 45
operands: 44
42Literal
43Operationoperator: 45
operands: 46
44ExprTuple55, 48, 49, 50, 47
45Literal
46ExprTuple55, 48, 49, 50
47Operationoperator: 51
operands: 52
48Literal
49Literal
50Operationoperator: 53
operand: 57
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple57
55Literal
56Literal
57Literal