logo

Expression of type Conditional

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 Conditional, l
from proveit.logic import And, InSet, NotEquals
from proveit.numbers import Abs, Exp, LessEq, Mult, four, frac, one, two, zero
from proveit.physics.quantum.QPE import _diff_l_scaled_delta_floor, _full_domain, _rel_indexed_alpha
In [2]:
# build up the expression from sub-expressions
expr = Conditional(LessEq(Exp(Abs(_rel_indexed_alpha), two), frac(one, Mult(four, Exp(_diff_l_scaled_delta_floor, two)))), And(InSet(l, _full_domain), NotEquals(l, zero)))
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\{\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}} \textrm{ if } l \in \{-2^{t - 1} + 1~\ldotp \ldotp~2^{t - 1}\} ,  l \neq 0\right..
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
condition_delimiter'comma' or 'and'commacomma('with_comma_delimiter', 'with_conjunction_delimiter')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Conditionalvalue: 1
condition: 2
1Operationoperator: 3
operands: 4
2Operationoperator: 5
operands: 6
3Literal
4ExprTuple7, 8
5Literal
6ExprTuple9, 10
7Operationoperator: 56
operands: 11
8Operationoperator: 12
operands: 13
9Operationoperator: 14
operands: 15
10Operationoperator: 16
operands: 17
11ExprTuple18, 62
12Literal
13ExprTuple65, 19
14Literal
15ExprTuple42, 20
16Literal
17ExprTuple42, 21
18Operationoperator: 22
operand: 27
19Operationoperator: 49
operands: 24
20Operationoperator: 25
operands: 26
21Literal
22Literal
23ExprTuple27
24ExprTuple28, 29
25Literal
26ExprTuple30, 44
27Operationoperator: 31
operand: 35
28Literal
29Operationoperator: 56
operands: 33
30Operationoperator: 51
operands: 34
31Literal
32ExprTuple35
33ExprTuple36, 62
34ExprTuple37, 65
35Operationoperator: 38
operands: 39
36Operationoperator: 51
operands: 40
37Operationoperator: 60
operand: 44
38Literal
39ExprTuple64, 42
40ExprTuple42, 43
41ExprTuple44
42Variable
43Operationoperator: 60
operand: 47
44Operationoperator: 56
operands: 46
45ExprTuple47
46ExprTuple62, 48
47Operationoperator: 49
operands: 50
48Operationoperator: 51
operands: 52
49Literal
50ExprTuple53, 54
51Literal
52ExprTuple63, 55
53Operationoperator: 56
operands: 57
54Operationoperator: 58
operand: 64
55Operationoperator: 60
operand: 65
56Literal
57ExprTuple62, 63
58Literal
59ExprTuple64
60Literal
61ExprTuple65
62Literal
63Literal
64Literal
65Literal