logo

Expression of type Lambda

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, Lambda, k, l, n
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Exp, Interval, Mult, NaturalPos, 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)
expr = Lambda(n, Conditional(Forall(instance_param_or_params = [k, l], instance_expr = 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)))), domain = Interval(zero, subtract(sub_expr1, one))), InSet(n, NaturalPos)))
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())
n \mapsto \left\{\forall_{k, l \in \{0~\ldotp \ldotp~2^{n} - 1\}}~\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)\right) \textrm{ if } n \in \mathbb{N}^+\right..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 64
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 25
operands: 6
4Literal
5ExprTuple7
6ExprTuple64, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple71, 72
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operands: 22
18Operationoperator: 66
operands: 23
19Operationoperator: 25
operands: 24
20Operationoperator: 25
operands: 26
21Literal
22ExprTuple27, 28, 29
23ExprTuple30, 31
24ExprTuple71, 32
25Literal
26ExprTuple72, 32
27Operationoperator: 33
operands: 34
28Operationoperator: 35
operand: 64
29Operationoperator: 37
operands: 38
30Operationoperator: 56
operands: 39
31Operationoperator: 59
operands: 40
32Operationoperator: 41
operands: 42
33Literal
34ExprTuple72, 64
35Literal
36ExprTuple64
37Literal
38ExprTuple71, 64
39ExprTuple65, 43
40ExprTuple44, 45
41Literal
42ExprTuple46, 47
43Operationoperator: 59
operands: 48
44Literal
45Operationoperator: 56
operands: 49
46Literal
47Operationoperator: 50
operands: 51
48ExprTuple68, 52
49ExprTuple53, 54
50Literal
51ExprTuple54, 55
52Operationoperator: 56
operands: 57
53Operationoperator: 61
operand: 63
54Operationoperator: 59
operands: 60
55Operationoperator: 61
operand: 65
56Literal
57ExprTuple64, 68
58ExprTuple63
59Literal
60ExprTuple68, 64
61Literal
62ExprTuple65
63Operationoperator: 66
operands: 67
64Variable
65Literal
66Literal
67ExprTuple68, 69, 70, 71, 72
68Literal
69Literal
70Literal
71Variable
72Variable