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 Lambda, m, n
from proveit.logic import Bijections, Forall, Implies, InSet, NotEquals, TRUE
from proveit.physics.quantum.QPE import _Omega, _m_domain, _phase_est_circuit
In [2]:
# build up the expression from sub-expressions
expr = Implies(Forall(instance_param_or_params = [m, n], instance_expr = TRUE, domain = _m_domain, condition = NotEquals(m, n)), InSet(Lambda(m, _phase_est_circuit), Bijections(_m_domain, _Omega)))
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_{m, n \in \{0~\ldotp \ldotp~2^{t} - 1\}~|~m \neq n}~\top\right] \Rightarrow \left(\left[m \mapsto \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{\lvert + \rangle} & \multigate{4}{\textrm{QPE}\left(U, t\right)} & \meter & \multiqout{3}{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} & \ghost{\textrm{QPE}\left(U, t\right)} & \measure{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} \qw & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert + \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & \meter & \ghostqout{\lvert m \rangle_{t}} \\
\qin{\lvert u \rangle} & \ghost{\textrm{QPE}\left(U, t\right)} & { /^{s} } \qw & \qout{\lvert u \rangle}
} \end{array}\right)\right] \in \left[\{0~\ldotp \ldotp~2^{t} - 1\} \xrightarrow[\text{onto}]{\text{1-to-1}} \Omega\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: 39
operands: 7
5Literal
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 42
body: 11
9Lambdaparameter: 117
body: 13
10Operationoperator: 14
operands: 15
11Conditionalvalue: 16
condition: 17
12ExprTuple117
13Operationoperator: 18
operands: 19
14Literal
15ExprTuple50, 20
16Literal
17Operationoperator: 21
operands: 22
18Literal
19ExprTuple23, 24, 25, 26
20Literal
21Literal
22ExprTuple27, 28, 29
23ExprTuple30, 31
24ExprTuple32, 33
25ExprTuple34, 35
26ExprTuple36, 37
27Operationoperator: 39
operands: 38
28Operationoperator: 39
operands: 40
29Operationoperator: 41
operands: 42
30ExprRangelambda_map: 43
start_index: 118
end_index: 119
31ExprRangelambda_map: 44
start_index: 118
end_index: 120
32ExprRangelambda_map: 45
start_index: 118
end_index: 119
33ExprRangelambda_map: 45
start_index: 102
end_index: 103
34ExprRangelambda_map: 46
start_index: 118
end_index: 119
35ExprRangelambda_map: 47
start_index: 118
end_index: 120
36ExprRangelambda_map: 48
start_index: 118
end_index: 119
37ExprRangelambda_map: 49
start_index: 118
end_index: 120
38ExprTuple117, 50
39Literal
40ExprTuple51, 50
41Literal
42ExprTuple117, 51
43Lambdaparameter: 101
body: 52
44Lambdaparameter: 101
body: 53
45Lambdaparameter: 101
body: 54
46Lambdaparameter: 101
body: 55
47Lambdaparameter: 101
body: 56
48Lambdaparameter: 101
body: 57
49Lambdaparameter: 101
body: 59
50Operationoperator: 93
operands: 60
51Variable
52Operationoperator: 85
operands: 61
53Operationoperator: 68
operands: 62
54Operationoperator: 68
operands: 63
55Operationoperator: 64
operands: 65
56Operationoperator: 86
operands: 66
57Operationoperator: 68
operands: 67
58ExprTuple101
59Operationoperator: 68
operands: 69
60ExprTuple70, 71
61NamedExprsstate: 72
62NamedExprselement: 73
targets: 81
63NamedExprselement: 74
targets: 75
64Literal
65NamedExprsbasis: 76
66NamedExprsoperation: 77
67NamedExprselement: 78
targets: 79
68Literal
69NamedExprselement: 80
targets: 81
70Literal
71Operationoperator: 113
operands: 82
72Operationoperator: 83
operand: 97
73Operationoperator: 85
operands: 92
74Operationoperator: 86
operands: 87
75Operationoperator: 93
operands: 88
76Literal
77Literal
78Operationoperator: 91
operands: 89
79Operationoperator: 93
operands: 90
80Operationoperator: 91
operands: 92
81Operationoperator: 93
operands: 94
82ExprTuple95, 96
83Literal
84ExprTuple97
85Literal
86Literal
87NamedExprsoperation: 98
part: 101
88ExprTuple118, 103
89NamedExprsstate: 99
part: 101
90ExprTuple118, 119
91Literal
92NamedExprsstate: 100
part: 101
93Literal
94ExprTuple102, 103
95Operationoperator: 104
operands: 105
96Operationoperator: 106
operand: 118
97Literal
98Operationoperator: 108
operands: 109
99Operationoperator: 110
operands: 111
100Literal
101Variable
102Operationoperator: 113
operands: 112
103Operationoperator: 113
operands: 114
104Literal
105ExprTuple115, 119
106Literal
107ExprTuple118
108Literal
109ExprTuple116, 119
110Literal
111ExprTuple117, 119
112ExprTuple119, 118
113Literal
114ExprTuple119, 120
115Literal
116Literal
117Variable
118Literal
119Literal
120Literal