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, k, m
from proveit.numbers import Exp, Mult, Neg, Sum, e, frac, i, one, pi, two
from proveit.physics.quantum.QPE import _alpha_m, _m_domain, _phase, _t, _two_pow_t
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(_alpha_m, Mult(Exp(frac(one, Exp(two, frac(_t, two))), two), Sum(index_or_indices = [k], summand = Mult(Exp(e, Mult(two, pi, i, _phase, k)), Exp(e, Neg(frac(Mult(two, pi, i, k, m), _two_pow_t)))), domain = _m_domain)))
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(\alpha_{m}, \left(\frac{1}{2^{\frac{t}{2}}}\right)^{2} \cdot \left(\sum_{k = 0}^{2^{t} - 1} \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi \cdot k} \cdot \mathsf{e}^{-\frac{2 \cdot \pi \cdot \mathsf{i} \cdot k \cdot m}{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: 3
operand: 58
2Operationoperator: 51
operands: 5
3Literal
4ExprTuple58
5ExprTuple6, 7
6Operationoperator: 53
operands: 8
7Operationoperator: 9
operand: 12
8ExprTuple11, 59
9Literal
10ExprTuple12
11Operationoperator: 44
operands: 13
12Lambdaparameter: 57
body: 15
13ExprTuple50, 16
14ExprTuple57
15Conditionalvalue: 17
condition: 18
16Operationoperator: 53
operands: 19
17Operationoperator: 51
operands: 20
18Operationoperator: 21
operands: 22
19ExprTuple59, 23
20ExprTuple24, 25
21Literal
22ExprTuple57, 26
23Operationoperator: 44
operands: 27
24Operationoperator: 53
operands: 28
25Operationoperator: 53
operands: 29
26Operationoperator: 30
operands: 31
27ExprTuple60, 59
28ExprTuple33, 32
29ExprTuple33, 34
30Literal
31ExprTuple35, 36
32Operationoperator: 51
operands: 37
33Literal
34Operationoperator: 46
operand: 42
35Literal
36Operationoperator: 39
operands: 40
37ExprTuple59, 55, 56, 41, 57
38ExprTuple42
39Literal
40ExprTuple49, 43
41Literal
42Operationoperator: 44
operands: 45
43Operationoperator: 46
operand: 50
44Literal
45ExprTuple48, 49
46Literal
47ExprTuple50
48Operationoperator: 51
operands: 52
49Operationoperator: 53
operands: 54
50Literal
51Literal
52ExprTuple59, 55, 56, 57, 58
53Literal
54ExprTuple59, 60
55Literal
56Literal
57Variable
58Variable
59Literal
60Literal