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, _pos_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(subtract(k, one), two))), domain = _pos_domain), LessEq(Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(_diff_l_scaled_delta_floor, two)), domain = _pos_domain), Sum(index_or_indices = sub_expr1, summand = frac(one, Exp(subtract(l, one), two)), domain = _pos_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 \{e + 1~\ldotp \ldotp~2^{t - 1}\}}~\left(\frac{1}{\left(k - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}} \leq \frac{1}{\left(k - 1\right)^{2}}\right)\right] \Rightarrow \left(\left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right) \leq \left(\sum_{l = e + 1}^{2^{t - 1}} \frac{1}{\left(l - 1\right)^{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: 61
body: 12
9Operationoperator: 14
operand: 18
10Operationoperator: 14
operand: 19
11ExprTuple61
12Conditionalvalue: 16
condition: 17
13ExprTuple18
14Literal
15ExprTuple19
16Operationoperator: 20
operands: 21
17Operationoperator: 36
operands: 22
18Lambdaparameter: 63
body: 23
19Lambdaparameter: 63
body: 25
20Literal
21ExprTuple26, 27
22ExprTuple61, 42
23Conditionalvalue: 28
condition: 30
24ExprTuple63
25Conditionalvalue: 29
condition: 30
26Operationoperator: 34
operands: 31
27Operationoperator: 34
operands: 32
28Operationoperator: 34
operands: 33
29Operationoperator: 34
operands: 35
30Operationoperator: 36
operands: 37
31ExprTuple77, 38
32ExprTuple77, 39
33ExprTuple77, 40
34Literal
35ExprTuple77, 41
36Literal
37ExprTuple63, 42
38Operationoperator: 78
operands: 43
39Operationoperator: 78
operands: 44
40Operationoperator: 78
operands: 45
41Operationoperator: 78
operands: 46
42Operationoperator: 47
operands: 48
43ExprTuple49, 82
44ExprTuple50, 82
45ExprTuple51, 82
46ExprTuple52, 82
47Literal
48ExprTuple53, 54
49Operationoperator: 67
operands: 55
50Operationoperator: 67
operands: 56
51Operationoperator: 67
operands: 57
52Operationoperator: 67
operands: 58
53Operationoperator: 67
operands: 59
54Operationoperator: 78
operands: 60
55ExprTuple61, 62
56ExprTuple61, 70
57ExprTuple63, 62
58ExprTuple63, 70
59ExprTuple64, 77
60ExprTuple82, 65
61Variable
62Operationoperator: 73
operand: 69
63Variable
64Variable
65Operationoperator: 67
operands: 68
66ExprTuple69
67Literal
68ExprTuple83, 70
69Operationoperator: 71
operands: 72
70Operationoperator: 73
operand: 77
71Literal
72ExprTuple75, 76
73Literal
74ExprTuple77
75Operationoperator: 78
operands: 79
76Operationoperator: 80
operand: 84
77Literal
78Literal
79ExprTuple82, 83
80Literal
81ExprTuple84
82Literal
83Literal
84Literal