logo

Common _sample_space of type SetOfAll

from the theory of proveit.physics.quantum.QPE

In [1]:
import proveit
# Automation is not needed when only 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 the special expression
from proveit.physics.quantum.QPE import _sample_space
In [2]:
# check that the built expression is the same as the stored expression
assert _sample_space == stored_expr
assert _sample_space._style_id == stored_expr._style_id
print("Passed sanity check: _sample_space matches stored_expr")
Passed sanity check: _sample_space matches stored_expr
In [3]:
# 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{
\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\}_{m \in \{0~\ldotp \ldotp~2^{t} - 1\}}
In [4]:
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 [5]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operand: 3
1Literal
2ExprTuple3
3Lambdaparameter: 97
body: 5
4ExprTuple97
5Conditionalvalue: 6
condition: 7
6Operationoperator: 8
operands: 9
7Operationoperator: 10
operands: 11
8Literal
9ExprTuple12, 13, 14, 15
10Literal
11ExprTuple97, 16
12ExprTuple17, 18
13ExprTuple19, 20
14ExprTuple21, 22
15ExprTuple23, 24
16Operationoperator: 79
operands: 25
17ExprRangelambda_map: 26
start_index: 98
end_index: 99
18ExprRangelambda_map: 27
start_index: 98
end_index: 100
19ExprRangelambda_map: 28
start_index: 98
end_index: 99
20ExprRangelambda_map: 28
start_index: 87
end_index: 88
21ExprRangelambda_map: 29
start_index: 98
end_index: 99
22ExprRangelambda_map: 30
start_index: 98
end_index: 100
23ExprRangelambda_map: 31
start_index: 98
end_index: 99
24ExprRangelambda_map: 32
start_index: 98
end_index: 100
25ExprTuple33, 34
26Lambdaparameter: 86
body: 35
27Lambdaparameter: 86
body: 36
28Lambdaparameter: 86
body: 37
29Lambdaparameter: 86
body: 38
30Lambdaparameter: 86
body: 39
31Lambdaparameter: 86
body: 40
32Lambdaparameter: 86
body: 42
33Literal
34Operationoperator: 94
operands: 43
35Operationoperator: 71
operands: 44
36Operationoperator: 51
operands: 45
37Operationoperator: 51
operands: 46
38Operationoperator: 47
operands: 48
39Operationoperator: 72
operands: 49
40Operationoperator: 51
operands: 50
41ExprTuple86
42Operationoperator: 51
operands: 52
43ExprTuple53, 54
44NamedExprsstate: 55
45NamedExprselement: 56
targets: 64
46NamedExprselement: 57
targets: 58
47Literal
48NamedExprsbasis: 59
49NamedExprsoperation: 60
50NamedExprselement: 61
targets: 62
51Literal
52NamedExprselement: 63
targets: 64
53Operationoperator: 65
operands: 66
54Operationoperator: 67
operand: 98
55Operationoperator: 69
operand: 82
56Operationoperator: 71
operands: 78
57Operationoperator: 72
operands: 73
58Operationoperator: 79
operands: 74
59Literal
60Literal
61Operationoperator: 77
operands: 75
62Operationoperator: 79
operands: 76
63Operationoperator: 77
operands: 78
64Operationoperator: 79
operands: 80
65Literal
66ExprTuple81, 99
67Literal
68ExprTuple98
69Literal
70ExprTuple82
71Literal
72Literal
73NamedExprsoperation: 83
part: 86
74ExprTuple98, 88
75NamedExprsstate: 84
part: 86
76ExprTuple98, 99
77Literal
78NamedExprsstate: 85
part: 86
79Literal
80ExprTuple87, 88
81Literal
82Literal
83Operationoperator: 89
operands: 90
84Operationoperator: 91
operands: 92
85Literal
86Variable
87Operationoperator: 94
operands: 93
88Operationoperator: 94
operands: 95
89Literal
90ExprTuple96, 99
91Literal
92ExprTuple97, 99
93ExprTuple99, 98
94Literal
95ExprTuple99, 100
96Literal
97Variable
98Literal
99Literal
100Literal