logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.QFT

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, ExprTuple, Lambda, k, l, n
from proveit.logic import And, Equals, InSet
from proveit.numbers import Exp, Interval, Mult, Neg, e, frac, i, one, pi, subtract, two, zero
from proveit.physics.quantum import NumBra, NumKet, Qmult
from proveit.physics.quantum.QFT import InverseFourierTransform
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Exp(two, n)
sub_expr2 = Interval(zero, subtract(sub_expr1, one))
expr = ExprTuple(Lambda([k, l], Conditional(Equals(Qmult(NumBra(l, n), InverseFourierTransform(n), NumKet(k, n)), Mult(frac(one, Exp(two, frac(n, two))), Exp(e, frac(Neg(Mult(two, pi, i, k, l)), sub_expr1)))), And(InSet(k, sub_expr2), InSet(l, sub_expr2)))))
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(\left(k, l\right) \mapsto \left\{\left({_{n}}\langle l \rvert \thinspace {\mathrm {FT}}^{\dag}_{n} \thinspace \lvert k \rangle_{n}\right) = \left(\frac{1}{2^{\frac{n}{2}}} \cdot \mathsf{e}^{\frac{-\left(2 \cdot \pi \cdot \mathsf{i} \cdot k \cdot l\right)}{2^{n}}}\right) \textrm{ if } k \in \{0~\ldotp \ldotp~2^{n} - 1\} ,  l \in \{0~\ldotp \ldotp~2^{n} - 1\}\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple64, 65
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Operationoperator: 14
operands: 15
11Operationoperator: 59
operands: 16
12Operationoperator: 18
operands: 17
13Operationoperator: 18
operands: 19
14Literal
15ExprTuple20, 21, 22
16ExprTuple23, 24
17ExprTuple64, 25
18Literal
19ExprTuple65, 25
20Operationoperator: 26
operands: 27
21Operationoperator: 28
operand: 57
22Operationoperator: 30
operands: 31
23Operationoperator: 49
operands: 32
24Operationoperator: 52
operands: 33
25Operationoperator: 34
operands: 35
26Literal
27ExprTuple65, 57
28Literal
29ExprTuple57
30Literal
31ExprTuple64, 57
32ExprTuple58, 36
33ExprTuple37, 38
34Literal
35ExprTuple39, 40
36Operationoperator: 52
operands: 41
37Literal
38Operationoperator: 49
operands: 42
39Literal
40Operationoperator: 43
operands: 44
41ExprTuple61, 45
42ExprTuple46, 47
43Literal
44ExprTuple47, 48
45Operationoperator: 49
operands: 50
46Operationoperator: 54
operand: 56
47Operationoperator: 52
operands: 53
48Operationoperator: 54
operand: 58
49Literal
50ExprTuple57, 61
51ExprTuple56
52Literal
53ExprTuple61, 57
54Literal
55ExprTuple58
56Operationoperator: 59
operands: 60
57Variable
58Literal
59Literal
60ExprTuple61, 62, 63, 64, 65
61Literal
62Literal
63Literal
64Variable
65Variable