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 ExprTuple, Variable, l
from proveit.numbers import Exp, Mult, Sum, 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(Mult(frac(one, four), Sum(index_or_indices = [l], summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _neg_domain)), Variable("_a", latex_format = r"{_{-}a}"))
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(\frac{1}{4} \cdot \left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right), {_{-}a}\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 40
operands: 3
2Variable
3ExprTuple4, 5
4Operationoperator: 15
operands: 6
5Operationoperator: 7
operand: 10
6ExprTuple58, 9
7Literal
8ExprTuple10
9Literal
10Lambdaparameter: 30
body: 12
11ExprTuple30
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operands: 16
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple58, 19
17Literal
18ExprTuple30, 20
19Operationoperator: 46
operands: 21
20Operationoperator: 22
operands: 23
21ExprTuple24, 52
22Literal
23ExprTuple25, 26
24Operationoperator: 50
operands: 27
25Operationoperator: 50
operands: 28
26Operationoperator: 56
operand: 33
27ExprTuple30, 31
28ExprTuple32, 58
29ExprTuple33
30Variable
31Operationoperator: 56
operand: 37
32Operationoperator: 56
operand: 38
33Operationoperator: 50
operands: 36
34ExprTuple37
35ExprTuple38
36ExprTuple39, 58
37Operationoperator: 40
operands: 41
38Operationoperator: 46
operands: 42
39Variable
40Literal
41ExprTuple43, 44
42ExprTuple52, 45
43Operationoperator: 46
operands: 47
44Operationoperator: 48
operand: 53
45Operationoperator: 50
operands: 51
46Literal
47ExprTuple52, 54
48Literal
49ExprTuple53
50Literal
51ExprTuple54, 55
52Literal
53Literal
54Literal
55Operationoperator: 56
operand: 58
56Literal
57ExprTuple58
58Literal