logo

Expression of type Lambda

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 Conditional, Lambda, k, m
from proveit.linear_algebra import ScalarMult
from proveit.logic import InSet
from proveit.numbers import Exp, Mult, e, i, pi, two
from proveit.physics.quantum import NumBra, NumKet, Qmult
from proveit.physics.quantum.QFT import InverseFourierTransform
from proveit.physics.quantum.QPE import _m_domain, _phase, _t
In [2]:
# build up the expression from sub-expressions
expr = Lambda(k, Conditional(Qmult(NumBra(m, _t), InverseFourierTransform(_t), ScalarMult(Exp(e, Mult(two, pi, i, _phase, k)), NumKet(k, _t))), InSet(k, _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())
k \mapsto \left\{{_{t}}\langle m \rvert \thinspace {\mathrm {FT}}^{\dag}_{t} \thinspace \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi \cdot k} \cdot \lvert k \rangle_{t}\right) \textrm{ if } k \in \{0~\ldotp \ldotp~2^{t} - 1\}\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 44
body: 2
1ExprTuple44
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10, 11
7Literal
8ExprTuple44, 12
9Operationoperator: 13
operands: 14
10Operationoperator: 15
operand: 46
11Operationoperator: 17
operands: 18
12Operationoperator: 19
operands: 20
13Literal
14ExprTuple21, 46
15Literal
16ExprTuple46
17Literal
18ExprTuple22, 23
19Literal
20ExprTuple24, 25
21Variable
22Operationoperator: 37
operands: 26
23Operationoperator: 27
operands: 28
24Literal
25Operationoperator: 29
operands: 30
26ExprTuple31, 32
27Literal
28ExprTuple44, 46
29Literal
30ExprTuple33, 34
31Literal
32Operationoperator: 35
operands: 36
33Operationoperator: 37
operands: 38
34Operationoperator: 39
operand: 47
35Literal
36ExprTuple45, 41, 42, 43, 44
37Literal
38ExprTuple45, 46
39Literal
40ExprTuple47
41Literal
42Literal
43Literal
44Variable
45Literal
46Literal
47Literal