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, _pos_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, _pos_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 \{e + 1~\ldotp \ldotp~2^{t - 1}\}\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: 44
body: 3
2ExprTuple44
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10, 11
8Literal
9ExprTuple44, 12
10Operationoperator: 54
operands: 13
11Operationoperator: 14
operands: 15
12Operationoperator: 16
operands: 17
13ExprTuple18, 58
14Literal
15ExprTuple46, 19
16Literal
17ExprTuple20, 21
18Operationoperator: 22
operand: 27
19Operationoperator: 50
operands: 24
20Operationoperator: 41
operands: 25
21Operationoperator: 54
operands: 26
22Literal
23ExprTuple27
24ExprTuple28, 29
25ExprTuple30, 46
26ExprTuple58, 31
27Operationoperator: 32
operand: 36
28Literal
29Operationoperator: 54
operands: 34
30Variable
31Operationoperator: 41
operands: 35
32Literal
33ExprTuple36
34ExprTuple37, 58
35ExprTuple59, 38
36Operationoperator: 39
operands: 40
37Operationoperator: 41
operands: 42
38Operationoperator: 47
operand: 46
39Literal
40ExprTuple60, 44
41Literal
42ExprTuple44, 45
43ExprTuple46
44Variable
45Operationoperator: 47
operand: 49
46Literal
47Literal
48ExprTuple49
49Operationoperator: 50
operands: 51
50Literal
51ExprTuple52, 53
52Operationoperator: 54
operands: 55
53Operationoperator: 56
operand: 60
54Literal
55ExprTuple58, 59
56Literal
57ExprTuple60
58Literal
59Literal
60Literal