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 Exp, Mult, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain
In [2]:
# build up the expression from sub-expressions
expr = Lambda(l, Conditional(Mult(frac(one, four), frac(one, 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())
l \mapsto \left\{\frac{1}{4} \cdot \frac{1}{\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..
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Lambdaparameter: 29
body: 2
1ExprTuple29
2Conditionalvalue: 3
condition: 4
3Operationoperator: 37
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple29, 10
8Operationoperator: 12
operands: 11
9Operationoperator: 12
operands: 13
10Operationoperator: 14
operands: 15
11ExprTuple53, 16
12Literal
13ExprTuple53, 17
14Literal
15ExprTuple18, 19
16Literal
17Operationoperator: 44
operands: 20
18Operationoperator: 39
operands: 21
19Operationoperator: 48
operand: 25
20ExprTuple23, 50
21ExprTuple24, 53
22ExprTuple25
23Operationoperator: 39
operands: 26
24Operationoperator: 48
operand: 31
25Operationoperator: 39
operands: 28
26ExprTuple29, 30
27ExprTuple31
28ExprTuple32, 53
29Variable
30Operationoperator: 48
operand: 35
31Operationoperator: 44
operands: 34
32Variable
33ExprTuple35
34ExprTuple50, 36
35Operationoperator: 37
operands: 38
36Operationoperator: 39
operands: 40
37Literal
38ExprTuple41, 42
39Literal
40ExprTuple51, 43
41Operationoperator: 44
operands: 45
42Operationoperator: 46
operand: 52
43Operationoperator: 48
operand: 53
44Literal
45ExprTuple50, 51
46Literal
47ExprTuple52
48Literal
49ExprTuple53
50Literal
51Literal
52Literal
53Literal