logo

Expression of type Implies

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 k, l
from proveit.logic import Forall, Implies
from proveit.numbers import Exp, LessEq, Mult, Sum, frac, one, subtract, two
from proveit.physics.quantum.QPE import _delta_b_floor, _diff_l_scaled_delta_floor, _neg_domain, _two_pow_t
In [2]:
# build up the expression from sub-expressions
sub_expr1 = [l]
expr = Implies(Forall(instance_param_or_params = [k], instance_expr = LessEq(frac(one, Exp(subtract(k, Mult(_two_pow_t, _delta_b_floor)), two)), frac(one, Exp(k, two))), domain = _neg_domain), LessEq(Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _neg_domain), Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(l, 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[\forall_{k \in \{-2^{t - 1} + 1~\ldotp \ldotp~-\left(e + 1\right)\}}~\left(\frac{1}{\left(k - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}} \leq \frac{1}{k^{2}}\right)\right] \Rightarrow \left(\left(\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) \leq \left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \frac{1}{l^{2}}\right)\right)
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()()('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operand: 8
4Operationoperator: 20
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameter: 57
body: 12
9Operationoperator: 14
operand: 18
10Operationoperator: 14
operand: 19
11ExprTuple57
12Conditionalvalue: 16
condition: 17
13ExprTuple18
14Literal
15ExprTuple19
16Operationoperator: 20
operands: 21
17Operationoperator: 36
operands: 22
18Lambdaparameter: 58
body: 23
19Lambdaparameter: 58
body: 25
20Literal
21ExprTuple26, 27
22ExprTuple57, 42
23Conditionalvalue: 28
condition: 30
24ExprTuple58
25Conditionalvalue: 29
condition: 30
26Operationoperator: 34
operands: 31
27Operationoperator: 34
operands: 32
28Operationoperator: 34
operands: 33
29Operationoperator: 34
operands: 35
30Operationoperator: 36
operands: 37
31ExprTuple86, 38
32ExprTuple86, 39
33ExprTuple86, 40
34Literal
35ExprTuple86, 41
36Literal
37ExprTuple58, 42
38Operationoperator: 74
operands: 43
39Operationoperator: 74
operands: 44
40Operationoperator: 74
operands: 45
41Operationoperator: 74
operands: 46
42Operationoperator: 47
operands: 48
43ExprTuple49, 80
44ExprTuple57, 80
45ExprTuple50, 80
46ExprTuple58, 80
47Literal
48ExprTuple51, 52
49Operationoperator: 78
operands: 53
50Operationoperator: 78
operands: 54
51Operationoperator: 78
operands: 55
52Operationoperator: 84
operand: 61
53ExprTuple57, 59
54ExprTuple58, 59
55ExprTuple60, 86
56ExprTuple61
57Variable
58Variable
59Operationoperator: 84
operand: 65
60Operationoperator: 84
operand: 66
61Operationoperator: 78
operands: 64
62ExprTuple65
63ExprTuple66
64ExprTuple67, 86
65Operationoperator: 68
operands: 69
66Operationoperator: 74
operands: 70
67Variable
68Literal
69ExprTuple71, 72
70ExprTuple80, 73
71Operationoperator: 74
operands: 75
72Operationoperator: 76
operand: 81
73Operationoperator: 78
operands: 79
74Literal
75ExprTuple80, 82
76Literal
77ExprTuple81
78Literal
79ExprTuple82, 83
80Literal
81Literal
82Literal
83Operationoperator: 84
operand: 86
84Literal
85ExprTuple86
86Literal