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 InSet
from proveit.numbers import Abs, Exp, LessEq, Mult, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_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)))), InSet(l, _neg_domain))))
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~-\left(e + 1\right)\}\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
9ExprTuple45, 12
10Operationoperator: 60
operands: 13
11Operationoperator: 14
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple18, 64
14Literal
15ExprTuple59, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 22
operand: 27
19Operationoperator: 53
operands: 24
20Operationoperator: 49
operands: 25
21Operationoperator: 55
operand: 31
22Literal
23ExprTuple27
24ExprTuple28, 29
25ExprTuple30, 59
26ExprTuple31
27Operationoperator: 32
operand: 37
28Literal
29Operationoperator: 60
operands: 34
30Operationoperator: 55
operand: 39
31Operationoperator: 49
operands: 36
32Literal
33ExprTuple37
34ExprTuple38, 64
35ExprTuple39
36ExprTuple40, 59
37Operationoperator: 41
operands: 42
38Operationoperator: 49
operands: 43
39Operationoperator: 60
operands: 44
40Variable
41Literal
42ExprTuple66, 45
43ExprTuple45, 46
44ExprTuple64, 47
45Variable
46Operationoperator: 55
operand: 51
47Operationoperator: 49
operands: 50
48ExprTuple51
49Literal
50ExprTuple65, 52
51Operationoperator: 53
operands: 54
52Operationoperator: 55
operand: 59
53Literal
54ExprTuple57, 58
55Literal
56ExprTuple59
57Operationoperator: 60
operands: 61
58Operationoperator: 62
operand: 66
59Literal
60Literal
61ExprTuple64, 65
62Literal
63ExprTuple66
64Literal
65Literal
66Literal