logo

Expression of type ExprTuple

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, ExprTuple, 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 = ExprTuple(Lambda(l, Conditional(frac(one, Mult(four, 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())
\left(l \mapsto \left\{\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~-\left(e + 1\right)\}\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 28
body: 3
2ExprTuple28
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operands: 7
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple52, 10
8Literal
9ExprTuple28, 11
10Operationoperator: 36
operands: 12
11Operationoperator: 13
operands: 14
12ExprTuple15, 16
13Literal
14ExprTuple17, 18
15Literal
16Operationoperator: 43
operands: 19
17Operationoperator: 38
operands: 20
18Operationoperator: 47
operand: 24
19ExprTuple22, 49
20ExprTuple23, 52
21ExprTuple24
22Operationoperator: 38
operands: 25
23Operationoperator: 47
operand: 30
24Operationoperator: 38
operands: 27
25ExprTuple28, 29
26ExprTuple30
27ExprTuple31, 52
28Variable
29Operationoperator: 47
operand: 34
30Operationoperator: 43
operands: 33
31Variable
32ExprTuple34
33ExprTuple49, 35
34Operationoperator: 36
operands: 37
35Operationoperator: 38
operands: 39
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple50, 42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operand: 51
42Operationoperator: 47
operand: 52
43Literal
44ExprTuple49, 50
45Literal
46ExprTuple51
47Literal
48ExprTuple52
49Literal
50Literal
51Literal
52Literal