logo

Expression of type NotEquals

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, Variable, m, n
from proveit.logic import NotEquals
from proveit.numbers import Add, Interval, one
from proveit.physics.quantum import NumKet
from proveit.physics.quantum.QPE import _ket_u, _s, _t
from proveit.physics.quantum.circuits import MultiQubitElem, Output
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
sub_expr2 = Interval(one, _t)
sub_expr3 = ExprRange(sub_expr1, MultiQubitElem(element = Output(state = _ket_u, part = sub_expr1), targets = Interval(Add(_t, one), Add(_t, _s))), one, _s)
expr = NotEquals([ExprRange(sub_expr1, MultiQubitElem(element = Output(state = NumKet(m, _t), part = sub_expr1), targets = sub_expr2), one, _t), sub_expr3], [ExprRange(sub_expr1, MultiQubitElem(element = Output(state = NumKet(n, _t), part = sub_expr1), targets = sub_expr2), one, _t), sub_expr3])
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(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert m \rangle_{t}~\mbox{part}~1~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array}, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert m \rangle_{t}~\mbox{part}~2~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array}, \ldots, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert m \rangle_{t}~\mbox{part}~t~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array},\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~1~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~2~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}, \ldots, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~s~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}\right) \neq \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert n \rangle_{t}~\mbox{part}~1~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array}, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert n \rangle_{t}~\mbox{part}~2~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array}, \ldots, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert n \rangle_{t}~\mbox{part}~t~\mbox{on}~\{1~\ldotp \ldotp~t\}} 
} \end{array},\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~1~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~2~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}, \ldots, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
& & \qout{\lvert u \rangle~\mbox{part}~s~\mbox{on}~\{t + 1~\ldotp \ldotp~t + s\}} 
} \end{array}\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
3ExprTuple5, 7
4ExprTuple6, 7
5ExprRangelambda_map: 8
start_index: 45
end_index: 46
6ExprRangelambda_map: 9
start_index: 45
end_index: 46
7ExprRangelambda_map: 10
start_index: 45
end_index: 47
8Lambdaparameter: 34
body: 11
9Lambdaparameter: 34
body: 12
10Lambdaparameter: 34
body: 14
11Operationoperator: 17
operands: 15
12Operationoperator: 17
operands: 16
13ExprTuple34
14Operationoperator: 17
operands: 18
15NamedExprselement: 19
targets: 21
16NamedExprselement: 20
targets: 21
17Literal
18NamedExprselement: 22
targets: 23
19Operationoperator: 27
operands: 24
20Operationoperator: 27
operands: 25
21Operationoperator: 29
operands: 26
22Operationoperator: 27
operands: 28
23Operationoperator: 29
operands: 30
24NamedExprsstate: 31
part: 34
25NamedExprsstate: 32
part: 34
26ExprTuple45, 46
27Literal
28NamedExprsstate: 33
part: 34
29Literal
30ExprTuple35, 36
31Operationoperator: 38
operands: 37
32Operationoperator: 38
operands: 39
33Literal
34Variable
35Operationoperator: 41
operands: 40
36Operationoperator: 41
operands: 42
37ExprTuple43, 46
38Literal
39ExprTuple44, 46
40ExprTuple46, 45
41Literal
42ExprTuple46, 47
43Variable
44Variable
45Literal
46Literal
47Literal