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, NaturalPos, 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 = [n], instance_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))), 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_{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)\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: 71
body: 3
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 9
5Operationoperator: 27
operands: 8
6Literal
7ExprTuple9
8ExprTuple71, 10
9Lambdaparameters: 11
body: 12
10Literal
11ExprTuple68, 69
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Operationoperator: 24
operands: 23
20Operationoperator: 24
operands: 25
21Operationoperator: 27
operands: 26
22Operationoperator: 27
operands: 28
23ExprTuple29, 30, 31
24Literal
25ExprTuple32, 33
26ExprTuple68, 34
27Literal
28ExprTuple69, 34
29Operationoperator: 35
operands: 36
30Operationoperator: 37
operand: 71
31Operationoperator: 39
operands: 40
32Operationoperator: 58
operands: 41
33Operationoperator: 62
operands: 42
34Operationoperator: 43
operands: 44
35Literal
36ExprTuple69, 71
37Literal
38ExprTuple71
39Literal
40ExprTuple68, 71
41ExprTuple72, 45
42ExprTuple46, 47
43Literal
44ExprTuple48, 49
45Operationoperator: 62
operands: 50
46Literal
47Operationoperator: 58
operands: 51
48Literal
49Operationoperator: 52
operands: 53
50ExprTuple70, 54
51ExprTuple55, 56
52Literal
53ExprTuple56, 57
54Operationoperator: 58
operands: 59
55Operationoperator: 60
operands: 61
56Operationoperator: 62
operands: 63
57Operationoperator: 64
operand: 72
58Literal
59ExprTuple71, 70
60Literal
61ExprTuple70, 66, 67, 68, 69
62Literal
63ExprTuple70, 71
64Literal
65ExprTuple72
66Literal
67Literal
68Variable
69Variable
70Literal
71Variable
72Literal