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 Exp, Mult, Real, 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(Sum(index_or_indices = [l], summand = frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two))), domain = _neg_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(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}, \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: 3
operand: 5
2Literal
3Literal
4ExprTuple5
5Lambdaparameter: 32
body: 7
6ExprTuple32
7Conditionalvalue: 8
condition: 9
8Operationoperator: 10
operands: 11
9Operationoperator: 12
operands: 13
10Literal
11ExprTuple56, 14
12Literal
13ExprTuple32, 15
14Operationoperator: 40
operands: 16
15Operationoperator: 17
operands: 18
16ExprTuple19, 20
17Literal
18ExprTuple21, 22
19Literal
20Operationoperator: 47
operands: 23
21Operationoperator: 42
operands: 24
22Operationoperator: 51
operand: 28
23ExprTuple26, 53
24ExprTuple27, 56
25ExprTuple28
26Operationoperator: 42
operands: 29
27Operationoperator: 51
operand: 34
28Operationoperator: 42
operands: 31
29ExprTuple32, 33
30ExprTuple34
31ExprTuple35, 56
32Variable
33Operationoperator: 51
operand: 38
34Operationoperator: 47
operands: 37
35Variable
36ExprTuple38
37ExprTuple53, 39
38Operationoperator: 40
operands: 41
39Operationoperator: 42
operands: 43
40Literal
41ExprTuple44, 45
42Literal
43ExprTuple54, 46
44Operationoperator: 47
operands: 48
45Operationoperator: 49
operand: 55
46Operationoperator: 51
operand: 56
47Literal
48ExprTuple53, 54
49Literal
50ExprTuple55
51Literal
52ExprTuple56
53Literal
54Literal
55Literal
56Literal