logo

Expression of type ExprTuple

from the theory of proveit.physics.quantum.circuits

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
from proveit.physics.quantum.circuits import phase_kickback_on_register_circuit
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(phase_kickback_on_register_circuit)
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{
\qin{\lvert + \rangle} & \control{} \qw \qwx[1] & \qw & \gate{\cdots} \qwx[1] & \qw & \qout{\frac{1}{\sqrt{2}} \cdot \left(\lvert 0 \rangle + \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi_{1}} \cdot \lvert 1 \rangle\right)\right)} \\
\qin{\lvert + \rangle} & \qw \qwx[1] & \control{} \qw \qwx[1] & \gate{\cdots} \qwx[1] & \qw & \qout{\frac{1}{\sqrt{2}} \cdot \left(\lvert 0 \rangle + \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi_{2}} \cdot \lvert 1 \rangle\right)\right)} \\
\qin{\begin{array}{c}:\\ \left(t - 3\right) \times \\:\end{array}} & \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} & \qout{\vdots} \\
\qin{\lvert + \rangle} & \qw \qwx[1] & \qw \qwx[1] & \gate{\cdots} \qwx[1] & \control{} \qw \qwx[1] & \qout{\frac{1}{\sqrt{2}} \cdot \left(\lvert 0 \rangle + \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi_{t}} \cdot \lvert 1 \rangle\right)\right)} \\
\qin{\lvert u \rangle} & \gate{U_{1}} & \gate{U_{2}} & \gate{\cdots} & \gate{U_{t}} & \qout{\lvert u \rangle}
} \end{array}\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Operationoperator: 2
operands: 3
2Literal
3ExprTuple4, 5, 6
4ExprTuple7, 8
5ExprRangelambda_map: 9
start_index: 103
end_index: 102
6ExprTuple10, 11
7ExprRangelambda_map: 12
start_index: 103
end_index: 102
8ExprRangelambda_map: 13
start_index: 103
end_index: 86
9Lambdaparameter: 85
body: 14
10ExprRangelambda_map: 15
start_index: 103
end_index: 102
11ExprRangelambda_map: 16
start_index: 103
end_index: 86
12Lambdaparameter: 112
body: 17
13Lambdaparameter: 112
body: 18
14ExprTuple19, 20
15Lambdaparameter: 112
body: 21
16Lambdaparameter: 112
body: 22
17Operationoperator: 36
operands: 23
18Operationoperator: 61
operands: 24
19ExprRangelambda_map: 25
start_index: 103
end_index: 102
20ExprRangelambda_map: 26
start_index: 103
end_index: 86
21Operationoperator: 41
operands: 27
22Operationoperator: 61
operands: 28
23NamedExprsstate: 29
24NamedExprselement: 30
targets: 47
25Lambdaparameter: 112
body: 31
26Lambdaparameter: 112
body: 32
27NamedExprsstate: 33
28NamedExprselement: 34
targets: 47
29Operationoperator: 96
operand: 43
30Operationoperator: 36
operands: 42
31Operationoperator: 37
operands: 38
32Operationoperator: 61
operands: 39
33Operationoperator: 81
operands: 40
34Operationoperator: 41
operands: 42
35ExprTuple43
36Literal
37Literal
38ExprTuple44, 45
39NamedExprselement: 46
targets: 47
40ExprTuple48, 49
41Literal
42NamedExprsstate: 50
part: 112
43Literal
44Conditionalvalue: 51
condition: 52
45Conditionalvalue: 53
condition: 54
46Operationoperator: 64
operands: 55
47Operationoperator: 56
operands: 57
48Operationoperator: 92
operands: 58
49Operationoperator: 59
operands: 60
50Variable
51Operationoperator: 61
operands: 62
52Operationoperator: 63
operands: 67
53Operationoperator: 64
operands: 65
54Operationoperator: 66
operands: 67
55NamedExprsoperation: 68
part: 112
56Literal
57ExprTuple91, 69
58ExprTuple103, 70
59Literal
60ExprTuple71, 72
61Literal
62NamedExprselement: 73
targets: 74
63Literal
64Literal
65NamedExprsoperation: 75
66Literal
67ExprTuple85, 112
68IndexedVarvariable: 76
index: 85
69Operationoperator: 98
operands: 78
70Operationoperator: 94
operands: 79
71Operationoperator: 96
operand: 88
72Operationoperator: 81
operands: 82
73Literal
74Operationoperator: 83
operand: 91
75Literal
76Variable
77ExprTuple85
78ExprTuple102, 86
79ExprTuple106, 87
80ExprTuple88
81Literal
82ExprTuple89, 90
83Literal
84ExprTuple91
85Variable
86Variable
87Operationoperator: 92
operands: 93
88Literal
89Operationoperator: 94
operands: 95
90Operationoperator: 96
operand: 103
91Operationoperator: 98
operands: 99
92Literal
93ExprTuple103, 106
94Literal
95ExprTuple100, 101
96Literal
97ExprTuple103
98Literal
99ExprTuple102, 103
100Literal
101Operationoperator: 104
operands: 105
102Variable
103Literal
104Literal
105ExprTuple106, 107, 108, 109
106Literal
107Literal
108Literal
109IndexedVarvariable: 110
index: 112
110Variable
111ExprTuple112
112Variable