logo

Expression of type Lambda

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, 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 44
body: 2
1ExprTuple44
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple11, 12
9Operationoperator: 58
operands: 13
10Operationoperator: 14
operands: 15
11Operationoperator: 16
operands: 17
12Operationoperator: 18
operands: 19
13ExprTuple20, 64
14Literal
15ExprTuple67, 21
16Literal
17ExprTuple44, 22
18Literal
19ExprTuple44, 23
20Operationoperator: 24
operand: 29
21Operationoperator: 51
operands: 26
22Operationoperator: 27
operands: 28
23Literal
24Literal
25ExprTuple29
26ExprTuple30, 31
27Literal
28ExprTuple32, 46
29Operationoperator: 33
operand: 37
30Literal
31Operationoperator: 58
operands: 35
32Operationoperator: 53
operands: 36
33Literal
34ExprTuple37
35ExprTuple38, 64
36ExprTuple39, 67
37Operationoperator: 40
operands: 41
38Operationoperator: 53
operands: 42
39Operationoperator: 62
operand: 46
40Literal
41ExprTuple66, 44
42ExprTuple44, 45
43ExprTuple46
44Variable
45Operationoperator: 62
operand: 49
46Operationoperator: 58
operands: 48
47ExprTuple49
48ExprTuple64, 50
49Operationoperator: 51
operands: 52
50Operationoperator: 53
operands: 54
51Literal
52ExprTuple55, 56
53Literal
54ExprTuple65, 57
55Operationoperator: 58
operands: 59
56Operationoperator: 60
operand: 66
57Operationoperator: 62
operand: 67
58Literal
59ExprTuple64, 65
60Literal
61ExprTuple66
62Literal
63ExprTuple67
64Literal
65Literal
66Literal
67Literal