logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.QPE

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, ExprTuple, Lambda, l
from proveit.logic import And, Equals, InSet, NotEquals
from proveit.numbers import Exp, Mult, e, frac, i, one, pi, subtract, two, zero
from proveit.physics.quantum.QPE import _delta_b_floor, _full_domain, _rel_indexed_alpha, _two_pow_t
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(l, Conditional(Equals(_rel_indexed_alpha, Mult(frac(one, _two_pow_t), frac(subtract(one, Exp(e, Mult(two, pi, i, subtract(Mult(_two_pow_t, _delta_b_floor), l)))), subtract(one, Exp(e, Mult(two, pi, i, subtract(_delta_b_floor, frac(l, _two_pow_t)))))))), And(InSet(l, _full_domain), NotEquals(l, zero)))))
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(l \mapsto \left\{\alpha_{b_{\textit{f}} \oplus l} = \left(\frac{1}{2^{t}} \cdot \frac{1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\left(2^{t} \cdot \delta_{b_{\textit{f}}}\right) - l\right)}}{1 - \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \left(\delta_{b_{\textit{f}}} - \frac{l}{2^{t}}\right)}}\right) \textrm{ if } l \in \{-2^{t - 1} + 1~\ldotp \ldotp~2^{t - 1}\} ,  l \neq 0\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 81
body: 2
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 13
operand: 20
10Operationoperator: 69
operands: 15
11Operationoperator: 16
operands: 17
12Operationoperator: 18
operands: 19
13Literal
14ExprTuple20
15ExprTuple21, 22
16Literal
17ExprTuple81, 23
18Literal
19ExprTuple81, 24
20Operationoperator: 25
operands: 26
21Operationoperator: 78
operands: 27
22Operationoperator: 78
operands: 28
23Operationoperator: 29
operands: 30
24Literal
25Literal
26ExprTuple80, 81
27ExprTuple68, 82
28ExprTuple31, 32
29Literal
30ExprTuple33, 45
31Operationoperator: 62
operands: 34
32Operationoperator: 62
operands: 35
33Operationoperator: 62
operands: 36
34ExprTuple68, 37
35ExprTuple68, 38
36ExprTuple39, 68
37Operationoperator: 72
operand: 43
38Operationoperator: 72
operand: 44
39Operationoperator: 72
operand: 45
40ExprTuple43
41ExprTuple44
42ExprTuple45
43Operationoperator: 83
operands: 46
44Operationoperator: 83
operands: 47
45Operationoperator: 83
operands: 48
46ExprTuple50, 49
47ExprTuple50, 51
48ExprTuple85, 52
49Operationoperator: 69
operands: 53
50Literal
51Operationoperator: 69
operands: 54
52Operationoperator: 62
operands: 55
53ExprTuple85, 57, 58, 56
54ExprTuple85, 57, 58, 59
55ExprTuple86, 60
56Operationoperator: 62
operands: 61
57Literal
58Literal
59Operationoperator: 62
operands: 63
60Operationoperator: 72
operand: 68
61ExprTuple65, 66
62Literal
63ExprTuple74, 67
64ExprTuple68
65Operationoperator: 69
operands: 70
66Operationoperator: 72
operand: 81
67Operationoperator: 72
operand: 75
68Literal
69Literal
70ExprTuple82, 74
71ExprTuple81
72Literal
73ExprTuple75
74Operationoperator: 76
operand: 80
75Operationoperator: 78
operands: 79
76Literal
77ExprTuple80
78Literal
79ExprTuple81, 82
80Literal
81Variable
82Operationoperator: 83
operands: 84
83Literal
84ExprTuple85, 86
85Literal
86Literal