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 ExprRange, IndexedVar, Variable, a, c, l
from proveit.logic import Equals, Forall, Implies, InSet
from proveit.numbers import Complex, Exp, Mult, Sum, frac, one, two, zero
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _neg_domain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = [l]
sub_expr3 = IndexedVar(a, one)
sub_expr4 = ExprRange(sub_expr1, IndexedVar(c, sub_expr1), one, zero)
sub_expr5 = frac(one, Exp(_diff_l_scaled_delta_floor, two))
expr = Implies(Forall(instance_param_or_params = sub_expr2, instance_expr = InSet(sub_expr5, Complex), domain = _neg_domain), Forall(instance_param_or_params = [sub_expr3, sub_expr4], instance_expr = Equals(Mult(sub_expr3, Sum(index_or_indices = sub_expr2, summand = sub_expr5, domain = _neg_domain), sub_expr4), Sum(index_or_indices = sub_expr2, summand = Mult(sub_expr3, sub_expr5, sub_expr4), domain = _neg_domain)).with_wrapping_at(2), domain = Complex).with_wrapping()).with_wrapping_at(2)
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())
\begin{array}{c} \begin{array}{l} \left[\forall_{l \in \{-2^{t - 1} + 1~\ldotp \ldotp~-\left(e + 1\right)\}}~\left(\frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}} \in \mathbb{C}\right)\right] \Rightarrow  \\ \left[\begin{array}{l}\forall_{a_{1}, c_{1}, c_{2}, \ldots, c_{0} \in \mathbb{C}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(a_{1} \cdot \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)\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{0}\right) =  \\ \left(\sum_{l = -2^{t - 1} + 1}^{-\left(e + 1\right)} \left(a_{1} \cdot \frac{1}{\left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\cdot c_{1} \cdot  c_{2} \cdot  \ldots \cdot  c_{0}\right)\right) \end{array} \end{array}\right)\end{array}\right] \end{array} \end{array}
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.()(2)('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: 6
operand: 8
4Operationoperator: 6
operand: 9
5ExprTuple8
6Literal
7ExprTuple9
8Lambdaparameter: 70
body: 10
9Lambdaparameters: 11
body: 12
10Conditionalvalue: 13
condition: 42
11ExprTuple43, 45
12Conditionalvalue: 14
condition: 15
13Operationoperator: 46
operands: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16ExprTuple44, 38
17Literal
18ExprTuple21, 22
19Literal
20ExprTuple23, 24
21Operationoperator: 79
operands: 25
22Operationoperator: 32
operand: 30
23Operationoperator: 46
operands: 27
24ExprRangelambda_map: 28
start_index: 96
end_index: 52
25ExprTuple43, 29, 45
26ExprTuple30
27ExprTuple43, 38
28Lambdaparameter: 64
body: 31
29Operationoperator: 32
operand: 36
30Lambdaparameter: 70
body: 34
31Operationoperator: 46
operands: 35
32Literal
33ExprTuple36
34Conditionalvalue: 37
condition: 42
35ExprTuple55, 38
36Lambdaparameter: 70
body: 40
37Operationoperator: 79
operands: 41
38Literal
39ExprTuple70
40Conditionalvalue: 44
condition: 42
41ExprTuple43, 44, 45
42Operationoperator: 46
operands: 47
43IndexedVarvariable: 48
index: 96
44Operationoperator: 49
operands: 50
45ExprRangelambda_map: 51
start_index: 96
end_index: 52
46Literal
47ExprTuple70, 53
48Variable
49Literal
50ExprTuple96, 54
51Lambdaparameter: 64
body: 55
52Literal
53Operationoperator: 56
operands: 57
54Operationoperator: 86
operands: 58
55IndexedVarvariable: 59
index: 64
56Literal
57ExprTuple61, 62
58ExprTuple63, 91
59Variable
60ExprTuple64
61Operationoperator: 84
operands: 65
62Operationoperator: 94
operand: 69
63Operationoperator: 84
operands: 67
64Variable
65ExprTuple68, 96
66ExprTuple69
67ExprTuple70, 71
68Operationoperator: 94
operand: 75
69Operationoperator: 84
operands: 73
70Variable
71Operationoperator: 94
operand: 77
72ExprTuple75
73ExprTuple76, 96
74ExprTuple77
75Operationoperator: 86
operands: 78
76Variable
77Operationoperator: 79
operands: 80
78ExprTuple91, 81
79Literal
80ExprTuple82, 83
81Operationoperator: 84
operands: 85
82Operationoperator: 86
operands: 87
83Operationoperator: 88
operand: 93
84Literal
85ExprTuple92, 90
86Literal
87ExprTuple91, 92
88Literal
89ExprTuple93
90Operationoperator: 94
operand: 96
91Literal
92Literal
93Literal
94Literal
95ExprTuple96
96Literal