logo

Expression of type Conditional

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, 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 = 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\{\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()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operand: 6
2Operationoperator: 24
operands: 5
3Literal
4ExprTuple6
5ExprTuple63, 7
6Lambdaparameters: 8
body: 9
7Literal
8ExprTuple70, 71
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple16, 17
14Literal
15ExprTuple18, 19
16Operationoperator: 20
operands: 21
17Operationoperator: 65
operands: 22
18Operationoperator: 24
operands: 23
19Operationoperator: 24
operands: 25
20Literal
21ExprTuple26, 27, 28
22ExprTuple29, 30
23ExprTuple70, 31
24Literal
25ExprTuple71, 31
26Operationoperator: 32
operands: 33
27Operationoperator: 34
operand: 63
28Operationoperator: 36
operands: 37
29Operationoperator: 55
operands: 38
30Operationoperator: 58
operands: 39
31Operationoperator: 40
operands: 41
32Literal
33ExprTuple71, 63
34Literal
35ExprTuple63
36Literal
37ExprTuple70, 63
38ExprTuple64, 42
39ExprTuple43, 44
40Literal
41ExprTuple45, 46
42Operationoperator: 58
operands: 47
43Literal
44Operationoperator: 55
operands: 48
45Literal
46Operationoperator: 49
operands: 50
47ExprTuple67, 51
48ExprTuple52, 53
49Literal
50ExprTuple53, 54
51Operationoperator: 55
operands: 56
52Operationoperator: 60
operand: 62
53Operationoperator: 58
operands: 59
54Operationoperator: 60
operand: 64
55Literal
56ExprTuple63, 67
57ExprTuple62
58Literal
59ExprTuple67, 63
60Literal
61ExprTuple64
62Operationoperator: 65
operands: 66
63Variable
64Literal
65Literal
66ExprTuple67, 68, 69, 70, 71
67Literal
68Literal
69Literal
70Variable
71Variable