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, _neg_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 = _neg_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 = -2^{t - 1} + 1}^{-\left(e + 1\right)} \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
3ExprTuple55, 6
4Literal
5ExprTuple7
6Literal
7Lambdaparameter: 27
body: 9
8ExprTuple27
9Conditionalvalue: 10
condition: 11
10Operationoperator: 12
operands: 13
11Operationoperator: 14
operands: 15
12Literal
13ExprTuple55, 16
14Literal
15ExprTuple27, 17
16Operationoperator: 43
operands: 18
17Operationoperator: 19
operands: 20
18ExprTuple21, 49
19Literal
20ExprTuple22, 23
21Operationoperator: 47
operands: 24
22Operationoperator: 47
operands: 25
23Operationoperator: 53
operand: 30
24ExprTuple27, 28
25ExprTuple29, 55
26ExprTuple30
27Variable
28Operationoperator: 53
operand: 34
29Operationoperator: 53
operand: 35
30Operationoperator: 47
operands: 33
31ExprTuple34
32ExprTuple35
33ExprTuple36, 55
34Operationoperator: 37
operands: 38
35Operationoperator: 43
operands: 39
36Variable
37Literal
38ExprTuple40, 41
39ExprTuple49, 42
40Operationoperator: 43
operands: 44
41Operationoperator: 45
operand: 50
42Operationoperator: 47
operands: 48
43Literal
44ExprTuple49, 51
45Literal
46ExprTuple50
47Literal
48ExprTuple51, 52
49Literal
50Literal
51Literal
52Operationoperator: 53
operand: 55
53Literal
54ExprTuple55
55Literal