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 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 = 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())
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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 43
body: 2
1ExprTuple43
2Conditionalvalue: 3
condition: 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple9, 10
7Literal
8ExprTuple43, 11
9Operationoperator: 53
operands: 12
10Operationoperator: 13
operands: 14
11Operationoperator: 15
operands: 16
12ExprTuple17, 57
13Literal
14ExprTuple45, 18
15Literal
16ExprTuple19, 20
17Operationoperator: 21
operand: 26
18Operationoperator: 49
operands: 23
19Operationoperator: 40
operands: 24
20Operationoperator: 53
operands: 25
21Literal
22ExprTuple26
23ExprTuple27, 28
24ExprTuple29, 45
25ExprTuple57, 30
26Operationoperator: 31
operand: 35
27Literal
28Operationoperator: 53
operands: 33
29Variable
30Operationoperator: 40
operands: 34
31Literal
32ExprTuple35
33ExprTuple36, 57
34ExprTuple58, 37
35Operationoperator: 38
operands: 39
36Operationoperator: 40
operands: 41
37Operationoperator: 46
operand: 45
38Literal
39ExprTuple59, 43
40Literal
41ExprTuple43, 44
42ExprTuple45
43Variable
44Operationoperator: 46
operand: 48
45Literal
46Literal
47ExprTuple48
48Operationoperator: 49
operands: 50
49Literal
50ExprTuple51, 52
51Operationoperator: 53
operands: 54
52Operationoperator: 55
operand: 59
53Literal
54ExprTuple57, 58
55Literal
56ExprTuple59
57Literal
58Literal
59Literal