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, Sum, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _pos_domain
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(frac(one, four), Sum(index_or_indices = [l], 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())
\left(\frac{1}{4}, \sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\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: 12
operands: 3
2Operationoperator: 4
operand: 7
3ExprTuple42, 6
4Literal
5ExprTuple7
6Literal
7Lambdaparameter: 27
body: 9
8ExprTuple27
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple42, 16
14Literal
15ExprTuple27, 17
16Operationoperator: 43
operands: 18
17Operationoperator: 19
operands: 20
18ExprTuple21, 47
19Literal
20ExprTuple22, 23
21Operationoperator: 32
operands: 24
22Operationoperator: 32
operands: 25
23Operationoperator: 43
operands: 26
24ExprTuple27, 28
25ExprTuple29, 42
26ExprTuple47, 30
27Variable
28Operationoperator: 38
operand: 34
29Variable
30Operationoperator: 32
operands: 33
31ExprTuple34
32Literal
33ExprTuple48, 35
34Operationoperator: 36
operands: 37
35Operationoperator: 38
operand: 42
36Literal
37ExprTuple40, 41
38Literal
39ExprTuple42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operand: 49
42Literal
43Literal
44ExprTuple47, 48
45Literal
46ExprTuple49
47Literal
48Literal
49Literal