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_circuit
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(phase_kickback_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] & \qout{\frac{1}{\sqrt{2}} \cdot \left(\lvert 0 \rangle + \left(\mathsf{e}^{2 \cdot \pi \cdot \mathsf{i} \cdot \varphi} \cdot \lvert 1 \rangle\right)\right)} \\
\qin{\lvert u \rangle} & \gate{U} & \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
5ExprTuple9, 10
6ExprTuple11, 12
7Operationoperator: 44
operands: 13
8ExprRangelambda_map: 14
start_index: 80
end_index: 19
9Operationoperator: 35
operands: 15
10ExprRangelambda_map: 16
start_index: 80
end_index: 19
11Operationoperator: 50
operands: 17
12ExprRangelambda_map: 18
start_index: 80
end_index: 19
13NamedExprsstate: 20
14Lambdaparameter: 59
body: 21
15NamedExprselement: 22
targets: 23
16Lambdaparameter: 59
body: 24
17NamedExprsstate: 25
18Lambdaparameter: 59
body: 27
19Operationoperator: 65
operands: 28
20Operationoperator: 76
operand: 37
21Operationoperator: 35
operands: 30
22Literal
23Operationoperator: 31
operand: 83
24Operationoperator: 35
operands: 33
25Operationoperator: 63
operands: 34
26ExprTuple59
27Operationoperator: 35
operands: 36
28ExprTuple71, 80
29ExprTuple37
30NamedExprselement: 38
targets: 43
31Literal
32ExprTuple83
33NamedExprselement: 39
targets: 43
34ExprTuple40, 41
35Literal
36NamedExprselement: 42
targets: 43
37Literal
38Operationoperator: 44
operands: 51
39Operationoperator: 45
operands: 46
40Operationoperator: 72
operands: 47
41Operationoperator: 48
operands: 49
42Operationoperator: 50
operands: 51
43Operationoperator: 52
operands: 53
44Literal
45Literal
46NamedExprsoperation: 54
part: 59
47ExprTuple80, 55
48Literal
49ExprTuple56, 57
50Literal
51NamedExprsstate: 58
part: 59
52Literal
53ExprTuple83, 60
54Variable
55Operationoperator: 74
operands: 61
56Operationoperator: 76
operand: 68
57Operationoperator: 63
operands: 64
58Variable
59Variable
60Operationoperator: 65
operands: 66
61ExprTuple83, 67
62ExprTuple68
63Literal
64ExprTuple69, 70
65Literal
66ExprTuple71, 83
67Operationoperator: 72
operands: 73
68Literal
69Operationoperator: 74
operands: 75
70Operationoperator: 76
operand: 80
71Variable
72Literal
73ExprTuple80, 83
74Literal
75ExprTuple78, 79
76Literal
77ExprTuple80
78Literal
79Operationoperator: 81
operands: 82
80Literal
81Literal
82ExprTuple83, 84, 85, 86
83Literal
84Literal
85Literal
86Variable