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 k, l, n
from proveit.logic import Equals, Forall
from proveit.numbers import Exp, Interval, Mult, 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 = 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)))
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_{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)
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
4ExprTuple66, 67
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple14, 15
12Operationoperator: 16
operands: 17
13Operationoperator: 61
operands: 18
14Operationoperator: 20
operands: 19
15Operationoperator: 20
operands: 21
16Literal
17ExprTuple22, 23, 24
18ExprTuple25, 26
19ExprTuple66, 27
20Literal
21ExprTuple67, 27
22Operationoperator: 28
operands: 29
23Operationoperator: 30
operand: 59
24Operationoperator: 32
operands: 33
25Operationoperator: 51
operands: 34
26Operationoperator: 54
operands: 35
27Operationoperator: 36
operands: 37
28Literal
29ExprTuple67, 59
30Literal
31ExprTuple59
32Literal
33ExprTuple66, 59
34ExprTuple60, 38
35ExprTuple39, 40
36Literal
37ExprTuple41, 42
38Operationoperator: 54
operands: 43
39Literal
40Operationoperator: 51
operands: 44
41Literal
42Operationoperator: 45
operands: 46
43ExprTuple63, 47
44ExprTuple48, 49
45Literal
46ExprTuple49, 50
47Operationoperator: 51
operands: 52
48Operationoperator: 56
operand: 58
49Operationoperator: 54
operands: 55
50Operationoperator: 56
operand: 60
51Literal
52ExprTuple59, 63
53ExprTuple58
54Literal
55ExprTuple63, 59
56Literal
57ExprTuple60
58Operationoperator: 61
operands: 62
59Variable
60Literal
61Literal
62ExprTuple63, 64, 65, 66, 67
63Literal
64Literal
65Literal
66Variable
67Variable