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, k
from proveit.logic import InSet
from proveit.numbers import Exp, Mult, e, i, pi, two
from proveit.physics.quantum.QPE import _delta_b_round, _m_domain
In [2]:
# build up the expression from sub-expressions
expr = Lambda(k, Conditional(Exp(Exp(e, Mult(two, pi, i, _delta_b_round)), k), InSet(k, _m_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())
k \mapsto \left\{(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \delta_{b_{\textit{r}}}})^{k} \textrm{ if } k \in \{0~\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: 9
body: 2
1ExprTuple9
2Conditionalvalue: 3
condition: 4
3Operationoperator: 29
operands: 5
4Operationoperator: 6
operands: 7
5ExprTuple8, 9
6Literal
7ExprTuple9, 10
8Operationoperator: 29
operands: 11
9Variable
10Operationoperator: 12
operands: 13
11ExprTuple14, 15
12Literal
13ExprTuple16, 17
14Literal
15Operationoperator: 18
operands: 19
16Literal
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple34, 22, 23, 24
20Literal
21ExprTuple25, 26
22Literal
23Literal
24Operationoperator: 27
operand: 33
25Operationoperator: 29
operands: 30
26Operationoperator: 31
operand: 36
27Literal
28ExprTuple33
29Literal
30ExprTuple34, 35
31Literal
32ExprTuple36
33Literal
34Literal
35Literal
36Literal