logo

Expression of type ExprTuple

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 ExprTuple, Lambda, m, n
from proveit.logic import Bijections, Forall, 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 = ExprTuple(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, \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
wrap_positionsposition(s) at which wrapping is to occur; 'n' is after the nth comma.()()('with_wrapping_at',)
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'leftleft('with_justification',)
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1, 2
1Operationoperator: 3
operand: 6
2Operationoperator: 37
operands: 5
3Literal
4ExprTuple6
5ExprTuple7, 8
6Lambdaparameters: 40
body: 9
7Lambdaparameter: 115
body: 11
8Operationoperator: 12
operands: 13
9Conditionalvalue: 14
condition: 15
10ExprTuple115
11Operationoperator: 16
operands: 17
12Literal
13ExprTuple48, 18
14Literal
15Operationoperator: 19
operands: 20
16Literal
17ExprTuple21, 22, 23, 24
18Literal
19Literal
20ExprTuple25, 26, 27
21ExprTuple28, 29
22ExprTuple30, 31
23ExprTuple32, 33
24ExprTuple34, 35
25Operationoperator: 37
operands: 36
26Operationoperator: 37
operands: 38
27Operationoperator: 39
operands: 40
28ExprRangelambda_map: 41
start_index: 116
end_index: 117
29ExprRangelambda_map: 42
start_index: 116
end_index: 118
30ExprRangelambda_map: 43
start_index: 116
end_index: 117
31ExprRangelambda_map: 43
start_index: 100
end_index: 101
32ExprRangelambda_map: 44
start_index: 116
end_index: 117
33ExprRangelambda_map: 45
start_index: 116
end_index: 118
34ExprRangelambda_map: 46
start_index: 116
end_index: 117
35ExprRangelambda_map: 47
start_index: 116
end_index: 118
36ExprTuple115, 48
37Literal
38ExprTuple49, 48
39Literal
40ExprTuple115, 49
41Lambdaparameter: 99
body: 50
42Lambdaparameter: 99
body: 51
43Lambdaparameter: 99
body: 52
44Lambdaparameter: 99
body: 53
45Lambdaparameter: 99
body: 54
46Lambdaparameter: 99
body: 55
47Lambdaparameter: 99
body: 57
48Operationoperator: 91
operands: 58
49Variable
50Operationoperator: 83
operands: 59
51Operationoperator: 66
operands: 60
52Operationoperator: 66
operands: 61
53Operationoperator: 62
operands: 63
54Operationoperator: 84
operands: 64
55Operationoperator: 66
operands: 65
56ExprTuple99
57Operationoperator: 66
operands: 67
58ExprTuple68, 69
59NamedExprsstate: 70
60NamedExprselement: 71
targets: 79
61NamedExprselement: 72
targets: 73
62Literal
63NamedExprsbasis: 74
64NamedExprsoperation: 75
65NamedExprselement: 76
targets: 77
66Literal
67NamedExprselement: 78
targets: 79
68Literal
69Operationoperator: 111
operands: 80
70Operationoperator: 81
operand: 95
71Operationoperator: 83
operands: 90
72Operationoperator: 84
operands: 85
73Operationoperator: 91
operands: 86
74Literal
75Literal
76Operationoperator: 89
operands: 87
77Operationoperator: 91
operands: 88
78Operationoperator: 89
operands: 90
79Operationoperator: 91
operands: 92
80ExprTuple93, 94
81Literal
82ExprTuple95
83Literal
84Literal
85NamedExprsoperation: 96
part: 99
86ExprTuple116, 101
87NamedExprsstate: 97
part: 99
88ExprTuple116, 117
89Literal
90NamedExprsstate: 98
part: 99
91Literal
92ExprTuple100, 101
93Operationoperator: 102
operands: 103
94Operationoperator: 104
operand: 116
95Literal
96Operationoperator: 106
operands: 107
97Operationoperator: 108
operands: 109
98Literal
99Variable
100Operationoperator: 111
operands: 110
101Operationoperator: 111
operands: 112
102Literal
103ExprTuple113, 117
104Literal
105ExprTuple116
106Literal
107ExprTuple114, 117
108Literal
109ExprTuple115, 117
110ExprTuple117, 116
111Literal
112ExprTuple117, 118
113Literal
114Literal
115Variable
116Literal
117Literal
118Literal