logo

Expression of type Equals

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 k, m
from proveit.logic import Equals
from proveit.numbers import Exp, Mult, Neg, Sum, e, frac, i, one, pi, two
from proveit.physics.quantum import NumBra, NumKet, Qmult
from proveit.physics.quantum.QFT import InverseFourierTransform
from proveit.physics.quantum.QPE import _alpha_m, _m_domain, _phase, _t, _two_pow_t
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [k]
sub_expr2 = Exp(e, Mult(two, pi, i, _phase, k))
sub_expr3 = frac(one, Exp(two, frac(_t, two)))
expr = Equals(Equals(_alpha_m, Mult(sub_expr3, Sum(index_or_indices = sub_expr1, summand = Mult(sub_expr2, Qmult(NumBra(m, _t), InverseFourierTransform(_t), NumKet(k, _t))), domain = _m_domain))), Equals(_alpha_m, Mult(Exp(sub_expr3, two), Sum(index_or_indices = sub_expr1, summand = Mult(sub_expr2, 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}}} \cdot \left(\sum_{k = 0}^{2^{t} - 1} \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi \cdot k} \cdot \left({_{t}}\langle m \rvert \thinspace {\mathrm {FT}}^{\dag}_{t} \thinspace \lvert k \rangle_{t}\right)\right)\right)\right)\right) = \left(\alpha_{m} = \left(\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)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 5
operands: 1
1ExprTuple2, 3
2Operationoperator: 5
operands: 4
3Operationoperator: 5
operands: 6
4ExprTuple8, 7
5Literal
6ExprTuple8, 9
7Operationoperator: 77
operands: 10
8Operationoperator: 11
operand: 84
9Operationoperator: 77
operands: 13
10ExprTuple22, 14
11Literal
12ExprTuple84
13ExprTuple15, 16
14Operationoperator: 19
operand: 21
15Operationoperator: 79
operands: 18
16Operationoperator: 19
operand: 23
17ExprTuple21
18ExprTuple22, 85
19Literal
20ExprTuple23
21Lambdaparameter: 83
body: 24
22Operationoperator: 70
operands: 25
23Lambdaparameter: 83
body: 27
24Conditionalvalue: 28
condition: 31
25ExprTuple76, 29
26ExprTuple83
27Conditionalvalue: 30
condition: 31
28Operationoperator: 77
operands: 32
29Operationoperator: 79
operands: 33
30Operationoperator: 77
operands: 34
31Operationoperator: 35
operands: 36
32ExprTuple39, 37
33ExprTuple85, 38
34ExprTuple39, 40
35Literal
36ExprTuple83, 41
37Operationoperator: 42
operands: 43
38Operationoperator: 70
operands: 44
39Operationoperator: 79
operands: 45
40Operationoperator: 79
operands: 46
41Operationoperator: 47
operands: 48
42Literal
43ExprTuple49, 50, 51
44ExprTuple86, 85
45ExprTuple53, 52
46ExprTuple53, 54
47Literal
48ExprTuple55, 56
49Operationoperator: 57
operands: 58
50Operationoperator: 59
operand: 86
51Operationoperator: 61
operands: 62
52Operationoperator: 77
operands: 63
53Literal
54Operationoperator: 72
operand: 68
55Literal
56Operationoperator: 65
operands: 66
57Literal
58ExprTuple84, 86
59Literal
60ExprTuple86
61Literal
62ExprTuple83, 86
63ExprTuple85, 81, 82, 67, 83
64ExprTuple68
65Literal
66ExprTuple75, 69
67Literal
68Operationoperator: 70
operands: 71
69Operationoperator: 72
operand: 76
70Literal
71ExprTuple74, 75
72Literal
73ExprTuple76
74Operationoperator: 77
operands: 78
75Operationoperator: 79
operands: 80
76Literal
77Literal
78ExprTuple85, 81, 82, 83, 84
79Literal
80ExprTuple85, 86
81Literal
82Literal
83Variable
84Variable
85Literal
86Literal