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 _failure_upper_bound
In [2]:
# check that the built expression is the same as the stored expression
assert _failure_upper_bound.expr == stored_expr
assert _failure_upper_bound.expr._style_id == stored_expr._style_id
print("Passed sanity check: _failure_upper_bound matches stored_expr")
Passed sanity check: _failure_upper_bound matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{e \in \{1~\ldotp \ldotp~2^{t - 1} - 2\}}~\left(\left[P_{\rm fail}\right]\left(e\right) \leq \left(\frac{1}{2 \cdot e} + \frac{1}{4 \cdot e^{2}}\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: 42
body: 4
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operands: 8
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11, 12
9Literal
10ExprTuple42, 13
11Operationoperator: 14
operand: 42
12Operationoperator: 40
operands: 16
13Operationoperator: 17
operands: 18
14Literal
15ExprTuple42
16ExprTuple19, 20
17Literal
18ExprTuple48, 21
19Operationoperator: 23
operands: 22
20Operationoperator: 23
operands: 24
21Operationoperator: 40
operands: 25
22ExprTuple48, 26
23Literal
24ExprTuple48, 27
25ExprTuple28, 29
26Operationoperator: 31
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 38
operands: 33
29Operationoperator: 46
operand: 43
30ExprTuple43, 42
31Literal
32ExprTuple35, 36
33ExprTuple43, 37
34ExprTuple43
35Literal
36Operationoperator: 38
operands: 39
37Operationoperator: 40
operands: 41
38Literal
39ExprTuple42, 43
40Literal
41ExprTuple44, 45
42Variable
43Literal
44Literal
45Operationoperator: 46
operand: 48
46Literal
47ExprTuple48
48Literal