logo

Expression of type Mult

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 l
from proveit.numbers import Add, Exp, Mult, Sum, four, 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]
expr = Mult(frac(one, four), Add(Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, two)), domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _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())
\frac{1}{4} \cdot \left(\left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{l^{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)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 53
operands: 1
1ExprTuple2, 3
2Operationoperator: 23
operands: 4
3Operationoperator: 58
operands: 5
4ExprTuple70, 6
5ExprTuple7, 8
6Literal
7Operationoperator: 10
operand: 12
8Operationoperator: 10
operand: 13
9ExprTuple12
10Literal
11ExprTuple13
12Lambdaparameter: 44
body: 14
13Lambdaparameter: 44
body: 16
14Conditionalvalue: 17
condition: 18
15ExprTuple44
16Conditionalvalue: 19
condition: 20
17Operationoperator: 23
operands: 21
18Operationoperator: 25
operands: 22
19Operationoperator: 23
operands: 24
20Operationoperator: 25
operands: 26
21ExprTuple70, 27
22ExprTuple44, 28
23Literal
24ExprTuple70, 29
25Literal
26ExprTuple44, 30
27Operationoperator: 60
operands: 31
28Operationoperator: 34
operands: 32
29Operationoperator: 60
operands: 33
30Operationoperator: 34
operands: 35
31ExprTuple44, 65
32ExprTuple36, 37
33ExprTuple38, 65
34Literal
35ExprTuple43, 49
36Operationoperator: 58
operands: 39
37Operationoperator: 68
operand: 43
38Operationoperator: 58
operands: 41
39ExprTuple42, 70
40ExprTuple43
41ExprTuple44, 45
42Operationoperator: 68
operand: 49
43Operationoperator: 58
operands: 47
44Variable
45Operationoperator: 68
operand: 51
46ExprTuple49
47ExprTuple50, 70
48ExprTuple51
49Operationoperator: 60
operands: 52
50Variable
51Operationoperator: 53
operands: 54
52ExprTuple65, 55
53Literal
54ExprTuple56, 57
55Operationoperator: 58
operands: 59
56Operationoperator: 60
operands: 61
57Operationoperator: 62
operand: 67
58Literal
59ExprTuple66, 64
60Literal
61ExprTuple65, 66
62Literal
63ExprTuple67
64Operationoperator: 68
operand: 70
65Literal
66Literal
67Literal
68Literal
69ExprTuple70
70Literal