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, two
from proveit.physics.quantum.QPE import _pos_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
expr = Lambda(l, Conditional(Exp(Abs(_rel_indexed_alpha), 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} \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: 31
body: 2
1ExprTuple31
2Conditionalvalue: 3
condition: 4
3Operationoperator: 20
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 24
6Literal
7ExprTuple31, 9
8Operationoperator: 10
operand: 14
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple14
12Literal
13ExprTuple15, 16
14Operationoperator: 17
operand: 22
15Operationoperator: 28
operands: 19
16Operationoperator: 20
operands: 21
17Literal
18ExprTuple22
19ExprTuple23, 36
20Literal
21ExprTuple24, 25
22Operationoperator: 26
operands: 27
23Variable
24Literal
25Operationoperator: 28
operands: 29
26Literal
27ExprTuple30, 31
28Literal
29ExprTuple32, 33
30Literal
31Variable
32Literal
33Operationoperator: 34
operand: 36
34Literal
35ExprTuple36
36Literal