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, InSet, NotEquals
from proveit.numbers import Abs, Exp, LessEq, Mult, four, frac, one, two, zero
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _full_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(l, Conditional(LessEq(Exp(Abs(_rel_indexed_alpha), two), frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two)))), 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\{\left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2} \leq \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}} \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: 45
body: 3
2ExprTuple45
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple12, 13
10Operationoperator: 59
operands: 14
11Operationoperator: 15
operands: 16
12Operationoperator: 17
operands: 18
13Operationoperator: 19
operands: 20
14ExprTuple21, 65
15Literal
16ExprTuple68, 22
17Literal
18ExprTuple45, 23
19Literal
20ExprTuple45, 24
21Operationoperator: 25
operand: 30
22Operationoperator: 52
operands: 27
23Operationoperator: 28
operands: 29
24Literal
25Literal
26ExprTuple30
27ExprTuple31, 32
28Literal
29ExprTuple33, 47
30Operationoperator: 34
operand: 38
31Literal
32Operationoperator: 59
operands: 36
33Operationoperator: 54
operands: 37
34Literal
35ExprTuple38
36ExprTuple39, 65
37ExprTuple40, 68
38Operationoperator: 41
operands: 42
39Operationoperator: 54
operands: 43
40Operationoperator: 63
operand: 47
41Literal
42ExprTuple67, 45
43ExprTuple45, 46
44ExprTuple47
45Variable
46Operationoperator: 63
operand: 50
47Operationoperator: 59
operands: 49
48ExprTuple50
49ExprTuple65, 51
50Operationoperator: 52
operands: 53
51Operationoperator: 54
operands: 55
52Literal
53ExprTuple56, 57
54Literal
55ExprTuple66, 58
56Operationoperator: 59
operands: 60
57Operationoperator: 61
operand: 67
58Operationoperator: 63
operand: 68
59Literal
60ExprTuple65, 66
61Literal
62ExprTuple67
63Literal
64ExprTuple68
65Literal
66Literal
67Literal
68Literal