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, _two_pow_t
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(_alpha_m, Mult(frac(one, _two_pow_t), Sum(index_or_indices = [k], summand = Mult(Exp(e, Neg(frac(Mult(two, pi, i, k, m), _two_pow_t))), Exp(e, Mult(two, pi, i, _phase, k))), 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}, \frac{1}{2^{t}} \cdot \left(\sum_{k = 0}^{2^{t} - 1} \left(\mathsf{e}^{-\frac{2 \cdot \pi \cdot \mathsf{i} \cdot k \cdot m}{2^{t}}} \cdot \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi \cdot k}\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: 52
2Operationoperator: 45
operands: 5
3Literal
4ExprTuple52
5ExprTuple6, 7
6Operationoperator: 38
operands: 8
7Operationoperator: 9
operand: 11
8ExprTuple44, 43
9Literal
10ExprTuple11
11Lambdaparameter: 51
body: 13
12ExprTuple51
13Conditionalvalue: 14
condition: 15
14Operationoperator: 45
operands: 16
15Operationoperator: 17
operands: 18
16ExprTuple19, 20
17Literal
18ExprTuple51, 21
19Operationoperator: 47
operands: 22
20Operationoperator: 47
operands: 23
21Operationoperator: 24
operands: 25
22ExprTuple27, 26
23ExprTuple27, 28
24Literal
25ExprTuple29, 30
26Operationoperator: 40
operand: 35
27Literal
28Operationoperator: 45
operands: 32
29Literal
30Operationoperator: 33
operands: 34
31ExprTuple35
32ExprTuple53, 49, 50, 36, 51
33Literal
34ExprTuple43, 37
35Operationoperator: 38
operands: 39
36Literal
37Operationoperator: 40
operand: 44
38Literal
39ExprTuple42, 43
40Literal
41ExprTuple44
42Operationoperator: 45
operands: 46
43Operationoperator: 47
operands: 48
44Literal
45Literal
46ExprTuple53, 49, 50, 51, 52
47Literal
48ExprTuple53, 54
49Literal
50Literal
51Variable
52Variable
53Literal
54Literal