logo
In [1]:
import proveit
# Automation is not needed when only building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.QPE import _alpha_m_mod_evaluation
In [2]:
# check that the built expression is the same as the stored expression
assert _alpha_m_mod_evaluation.expr == stored_expr
assert _alpha_m_mod_evaluation.expr._style_id == stored_expr._style_id
print("Passed sanity check: _alpha_m_mod_evaluation matches stored_expr")
Passed sanity check: _alpha_m_mod_evaluation matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{m \in \mathbb{Z}}~\left(\alpha_{m ~\textup{mod}~ 2^{t}} = \left(\frac{1}{2^{t}} \cdot \left(\sum_{k = 0}^{2^{t} - 1} \left(\mathsf{e}^{-\frac{2 \cdot \pi \cdot \mathsf{i} \cdot k \cdot m}{2^{t}}} \cdot \mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi \cdot k}\right)\right)\right)\right)
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneNone/False('with_wrapping',)
condition_wrappingWrap 'before' or 'after' the condition (or None).NoneNone/False('with_wrap_after_condition', 'with_wrap_before_condition')
wrap_paramsIf 'True', wraps every two parameters AND wraps the Expression after the parametersNoneNone/False('with_params',)
justificationjustify to the 'left', 'center', or 'right' in the array cellscentercenter('with_justification',)
In [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 66
body: 5
4ExprTuple66
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 31
operands: 10
8Literal
9ExprTuple11, 12
10ExprTuple66, 13
11Operationoperator: 14
operand: 17
12Operationoperator: 59
operands: 16
13Literal
14Literal
15ExprTuple17
16ExprTuple18, 19
17Operationoperator: 20
operands: 21
18Operationoperator: 52
operands: 22
19Operationoperator: 23
operand: 25
20Literal
21ExprTuple66, 57
22ExprTuple58, 57
23Literal
24ExprTuple25
25Lambdaparameter: 65
body: 27
26ExprTuple65
27Conditionalvalue: 28
condition: 29
28Operationoperator: 59
operands: 30
29Operationoperator: 31
operands: 32
30ExprTuple33, 34
31Literal
32ExprTuple65, 35
33Operationoperator: 61
operands: 36
34Operationoperator: 61
operands: 37
35Operationoperator: 38
operands: 39
36ExprTuple41, 40
37ExprTuple41, 42
38Literal
39ExprTuple43, 44
40Operationoperator: 54
operand: 49
41Literal
42Operationoperator: 59
operands: 46
43Literal
44Operationoperator: 47
operands: 48
45ExprTuple49
46ExprTuple67, 63, 64, 50, 65
47Literal
48ExprTuple57, 51
49Operationoperator: 52
operands: 53
50Literal
51Operationoperator: 54
operand: 58
52Literal
53ExprTuple56, 57
54Literal
55ExprTuple58
56Operationoperator: 59
operands: 60
57Operationoperator: 61
operands: 62
58Literal
59Literal
60ExprTuple67, 63, 64, 65, 66
61Literal
62ExprTuple67, 68
63Literal
64Literal
65Variable
66Variable
67Literal
68Literal