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, j, k, n
from proveit.logic import Equals, Forall, InSet
from proveit.numbers import Exp, Interval, Mult, NaturalPos, e, frac, i, one, pi, subtract, two, zero
from proveit.physics.quantum import NumBra, NumKet, Qmult
from proveit.physics.quantum.QFT import FourierTransform
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Exp(two, n)
expr = Lambda(n, Conditional(Forall(instance_param_or_params = [j, k], instance_expr = Equals(Qmult(NumBra(k, n), FourierTransform(n), NumKet(j, n)), Qmult(frac(one, Exp(two, frac(n, two))), Exp(e, frac(Mult(two, pi, i, j, k), 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_{j, k \in \{0~\ldotp \ldotp~2^{n} - 1\}}~\left(\left({_{n}}\langle k \rvert \thinspace {\mathrm {FT}}_{n} \thinspace \lvert j \rangle_{n}\right) = \left(\frac{1}{2^{\frac{n}{2}}} \thinspace \mathsf{e}^{\frac{2 \cdot \pi \cdot \mathsf{i} \cdot j \cdot k}{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: 69
body: 1
1Conditionalvalue: 2
condition: 3
2Operationoperator: 4
operand: 7
3Operationoperator: 25
operands: 6
4Literal
5ExprTuple7
6ExprTuple69, 8
7Lambdaparameters: 9
body: 10
8Literal
9ExprTuple66, 67
10Conditionalvalue: 11
condition: 12
11Operationoperator: 13
operands: 14
12Operationoperator: 15
operands: 16
13Literal
14ExprTuple17, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 22
operands: 21
18Operationoperator: 22
operands: 23
19Operationoperator: 25
operands: 24
20Operationoperator: 25
operands: 26
21ExprTuple27, 28, 29
22Literal
23ExprTuple30, 31
24ExprTuple66, 32
25Literal
26ExprTuple67, 32
27Operationoperator: 33
operands: 34
28Operationoperator: 35
operand: 69
29Operationoperator: 37
operands: 38
30Operationoperator: 56
operands: 39
31Operationoperator: 60
operands: 40
32Operationoperator: 41
operands: 42
33Literal
34ExprTuple67, 69
35Literal
36ExprTuple69
37Literal
38ExprTuple66, 69
39ExprTuple70, 43
40ExprTuple44, 45
41Literal
42ExprTuple46, 47
43Operationoperator: 60
operands: 48
44Literal
45Operationoperator: 56
operands: 49
46Literal
47Operationoperator: 50
operands: 51
48ExprTuple68, 52
49ExprTuple53, 54
50Literal
51ExprTuple54, 55
52Operationoperator: 56
operands: 57
53Operationoperator: 58
operands: 59
54Operationoperator: 60
operands: 61
55Operationoperator: 62
operand: 70
56Literal
57ExprTuple69, 68
58Literal
59ExprTuple68, 64, 65, 66, 67
60Literal
61ExprTuple68, 69
62Literal
63ExprTuple70
64Literal
65Literal
66Variable
67Variable
68Literal
69Variable
70Literal