logo

Expression of type Forall

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 j, k, n
from proveit.logic import Equals, Forall
from proveit.numbers import Exp, Interval, Mult, 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 = 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)))
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())
\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)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameters: 4
body: 5
4ExprTuple61, 62
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14Operationoperator: 20
operands: 19
15Operationoperator: 20
operands: 21
16ExprTuple22, 23, 24
17Literal
18ExprTuple25, 26
19ExprTuple61, 27
20Literal
21ExprTuple62, 27
22Operationoperator: 28
operands: 29
23Operationoperator: 30
operand: 64
24Operationoperator: 32
operands: 33
25Operationoperator: 51
operands: 34
26Operationoperator: 55
operands: 35
27Operationoperator: 36
operands: 37
28Literal
29ExprTuple62, 64
30Literal
31ExprTuple64
32Literal
33ExprTuple61, 64
34ExprTuple65, 38
35ExprTuple39, 40
36Literal
37ExprTuple41, 42
38Operationoperator: 55
operands: 43
39Literal
40Operationoperator: 51
operands: 44
41Literal
42Operationoperator: 45
operands: 46
43ExprTuple63, 47
44ExprTuple48, 49
45Literal
46ExprTuple49, 50
47Operationoperator: 51
operands: 52
48Operationoperator: 53
operands: 54
49Operationoperator: 55
operands: 56
50Operationoperator: 57
operand: 65
51Literal
52ExprTuple64, 63
53Literal
54ExprTuple63, 59, 60, 61, 62
55Literal
56ExprTuple63, 64
57Literal
58ExprTuple65
59Literal
60Literal
61Variable
62Variable
63Literal
64Variable
65Literal