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_evaluation
In [2]:
# check that the built expression is the same as the stored expression
assert _alpha_m_evaluation.expr == stored_expr
assert _alpha_m_evaluation.expr._style_id == stored_expr._style_id
print("Passed sanity check: _alpha_m_evaluation matches stored_expr")
Passed sanity check: _alpha_m_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 \{0~\ldotp \ldotp~2^{t} - 1\}}~\left(\alpha_{m} = \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: 61
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 26
operands: 9
7Literal
8ExprTuple10, 11
9ExprTuple61, 30
10Operationoperator: 12
operand: 61
11Operationoperator: 54
operands: 14
12Literal
13ExprTuple61
14ExprTuple15, 16
15Operationoperator: 47
operands: 17
16Operationoperator: 18
operand: 20
17ExprTuple53, 52
18Literal
19ExprTuple20
20Lambdaparameter: 60
body: 22
21ExprTuple60
22Conditionalvalue: 23
condition: 24
23Operationoperator: 54
operands: 25
24Operationoperator: 26
operands: 27
25ExprTuple28, 29
26Literal
27ExprTuple60, 30
28Operationoperator: 56
operands: 31
29Operationoperator: 56
operands: 32
30Operationoperator: 33
operands: 34
31ExprTuple36, 35
32ExprTuple36, 37
33Literal
34ExprTuple38, 39
35Operationoperator: 49
operand: 44
36Literal
37Operationoperator: 54
operands: 41
38Literal
39Operationoperator: 42
operands: 43
40ExprTuple44
41ExprTuple62, 58, 59, 45, 60
42Literal
43ExprTuple52, 46
44Operationoperator: 47
operands: 48
45Literal
46Operationoperator: 49
operand: 53
47Literal
48ExprTuple51, 52
49Literal
50ExprTuple53
51Operationoperator: 54
operands: 55
52Operationoperator: 56
operands: 57
53Literal
54Literal
55ExprTuple62, 58, 59, 60, 61
56Literal
57ExprTuple62, 63
58Literal
59Literal
60Variable
61Variable
62Literal
63Literal