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, l
from proveit.numbers import Add, Exp, Real, Sum, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain, _pos_domain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
sub_expr2 = frac(one, Exp(_diff_l_scaled_delta_floor, two))
expr = ExprTuple(Add(Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = sub_expr2, domain = _pos_domain)), Real)
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(\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) + \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right), \mathbb{R}\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: 51
operands: 3
2Literal
3ExprTuple4, 5
4Operationoperator: 7
operand: 9
5Operationoperator: 7
operand: 10
6ExprTuple9
7Literal
8ExprTuple10
9Lambdaparameter: 37
body: 11
10Lambdaparameter: 37
body: 13
11Conditionalvalue: 15
condition: 14
12ExprTuple37
13Conditionalvalue: 15
condition: 16
14Operationoperator: 20
operands: 17
15Operationoperator: 18
operands: 19
16Operationoperator: 20
operands: 21
17ExprTuple37, 22
18Literal
19ExprTuple63, 23
20Literal
21ExprTuple37, 24
22Operationoperator: 27
operands: 25
23Operationoperator: 53
operands: 26
24Operationoperator: 27
operands: 28
25ExprTuple29, 30
26ExprTuple31, 58
27Literal
28ExprTuple36, 42
29Operationoperator: 51
operands: 32
30Operationoperator: 61
operand: 36
31Operationoperator: 51
operands: 34
32ExprTuple35, 63
33ExprTuple36
34ExprTuple37, 38
35Operationoperator: 61
operand: 42
36Operationoperator: 51
operands: 40
37Variable
38Operationoperator: 61
operand: 44
39ExprTuple42
40ExprTuple43, 63
41ExprTuple44
42Operationoperator: 53
operands: 45
43Variable
44Operationoperator: 46
operands: 47
45ExprTuple58, 48
46Literal
47ExprTuple49, 50
48Operationoperator: 51
operands: 52
49Operationoperator: 53
operands: 54
50Operationoperator: 55
operand: 60
51Literal
52ExprTuple59, 57
53Literal
54ExprTuple58, 59
55Literal
56ExprTuple60
57Operationoperator: 61
operand: 63
58Literal
59Literal
60Literal
61Literal
62ExprTuple63
63Literal