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 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 = ExprTuple(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())
\left(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..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 65
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operand: 8
4Operationoperator: 26
operands: 7
5Literal
6ExprTuple8
7ExprTuple65, 9
8Lambdaparameters: 10
body: 11
9Literal
10ExprTuple72, 73
11Conditionalvalue: 12
condition: 13
12Operationoperator: 14
operands: 15
13Operationoperator: 16
operands: 17
14Literal
15ExprTuple18, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 22
operands: 23
19Operationoperator: 67
operands: 24
20Operationoperator: 26
operands: 25
21Operationoperator: 26
operands: 27
22Literal
23ExprTuple28, 29, 30
24ExprTuple31, 32
25ExprTuple72, 33
26Literal
27ExprTuple73, 33
28Operationoperator: 34
operands: 35
29Operationoperator: 36
operand: 65
30Operationoperator: 38
operands: 39
31Operationoperator: 57
operands: 40
32Operationoperator: 60
operands: 41
33Operationoperator: 42
operands: 43
34Literal
35ExprTuple73, 65
36Literal
37ExprTuple65
38Literal
39ExprTuple72, 65
40ExprTuple66, 44
41ExprTuple45, 46
42Literal
43ExprTuple47, 48
44Operationoperator: 60
operands: 49
45Literal
46Operationoperator: 57
operands: 50
47Literal
48Operationoperator: 51
operands: 52
49ExprTuple69, 53
50ExprTuple54, 55
51Literal
52ExprTuple55, 56
53Operationoperator: 57
operands: 58
54Operationoperator: 62
operand: 64
55Operationoperator: 60
operands: 61
56Operationoperator: 62
operand: 66
57Literal
58ExprTuple65, 69
59ExprTuple64
60Literal
61ExprTuple69, 65
62Literal
63ExprTuple66
64Operationoperator: 67
operands: 68
65Variable
66Literal
67Literal
68ExprTuple69, 70, 71, 72, 73
69Literal
70Literal
71Literal
72Variable
73Variable