logo

Expression of type Forall

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 l
from proveit.logic import Forall
from proveit.numbers import Abs, Exp, LessEq, Mult, four, frac, one, two
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _pos_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
expr = Forall(instance_param_or_params = [l], instance_expr = LessEq(Exp(Abs(_rel_indexed_alpha), two), frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, 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())
\forall_{l \in \{e + 1~\ldotp \ldotp~2^{t - 1}\}}~\left(\left|\alpha_{b_{\textit{f}} \oplus l}\right|^{2} \leq \frac{1}{4 \cdot \left(l - \left(2^{t} \cdot \delta_{b_{\textit{f}}}\right)\right)^{2}}\right)
In [5]:
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 [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 46
body: 5
4ExprTuple46
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13
10Literal
11ExprTuple46, 14
12Operationoperator: 56
operands: 15
13Operationoperator: 16
operands: 17
14Operationoperator: 18
operands: 19
15ExprTuple20, 60
16Literal
17ExprTuple48, 21
18Literal
19ExprTuple22, 23
20Operationoperator: 24
operand: 29
21Operationoperator: 52
operands: 26
22Operationoperator: 43
operands: 27
23Operationoperator: 56
operands: 28
24Literal
25ExprTuple29
26ExprTuple30, 31
27ExprTuple32, 48
28ExprTuple60, 33
29Operationoperator: 34
operand: 38
30Literal
31Operationoperator: 56
operands: 36
32Variable
33Operationoperator: 43
operands: 37
34Literal
35ExprTuple38
36ExprTuple39, 60
37ExprTuple61, 40
38Operationoperator: 41
operands: 42
39Operationoperator: 43
operands: 44
40Operationoperator: 49
operand: 48
41Literal
42ExprTuple62, 46
43Literal
44ExprTuple46, 47
45ExprTuple48
46Variable
47Operationoperator: 49
operand: 51
48Literal
49Literal
50ExprTuple51
51Operationoperator: 52
operands: 53
52Literal
53ExprTuple54, 55
54Operationoperator: 56
operands: 57
55Operationoperator: 58
operand: 62
56Literal
57ExprTuple60, 61
58Literal
59ExprTuple62
60Literal
61Literal
62Literal