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, 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 = Forall(instance_param_or_params = [n], instance_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))), domain = 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())
\forall_{n \in \mathbb{N}^+}~\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)\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: 6
operand: 2
1ExprTuple2
2Lambdaparameter: 66
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 27
operands: 8
6Literal
7ExprTuple9
8ExprTuple66, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple73, 74
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 23
operands: 24
20Operationoperator: 68
operands: 25
21Operationoperator: 27
operands: 26
22Operationoperator: 27
operands: 28
23Literal
24ExprTuple29, 30, 31
25ExprTuple32, 33
26ExprTuple73, 34
27Literal
28ExprTuple74, 34
29Operationoperator: 35
operands: 36
30Operationoperator: 37
operand: 66
31Operationoperator: 39
operands: 40
32Operationoperator: 58
operands: 41
33Operationoperator: 61
operands: 42
34Operationoperator: 43
operands: 44
35Literal
36ExprTuple74, 66
37Literal
38ExprTuple66
39Literal
40ExprTuple73, 66
41ExprTuple67, 45
42ExprTuple46, 47
43Literal
44ExprTuple48, 49
45Operationoperator: 61
operands: 50
46Literal
47Operationoperator: 58
operands: 51
48Literal
49Operationoperator: 52
operands: 53
50ExprTuple70, 54
51ExprTuple55, 56
52Literal
53ExprTuple56, 57
54Operationoperator: 58
operands: 59
55Operationoperator: 63
operand: 65
56Operationoperator: 61
operands: 62
57Operationoperator: 63
operand: 67
58Literal
59ExprTuple66, 70
60ExprTuple65
61Literal
62ExprTuple70, 66
63Literal
64ExprTuple67
65Operationoperator: 68
operands: 69
66Variable
67Literal
68Literal
69ExprTuple70, 71, 72, 73, 74
70Literal
71Literal
72Literal
73Variable
74Variable