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 circuit_aU, circuit_b
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(circuit_aU, circuit_b)
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{a} & \gate{\begin{array}{c} \uparrow \\U_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\U_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\U_{m} \\ \downarrow\end{array}} & { /^{k} } \qw
} \end{array}, \begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{b} & { /^{k} } \qw
} \end{array}\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: 4
operands: 3
2Operationoperator: 4
operand: 8
3ExprTuple6, 7
4Literal
5ExprTuple8
6ExprTuple9
7ExprRangelambda_map: 10
start_index: 34
end_index: 11
8ExprTuple12
9ExprRangelambda_map: 13
start_index: 34
end_index: 35
10Lambdaparameter: 33
body: 14
11Variable
12ExprRangelambda_map: 15
start_index: 34
end_index: 35
13Lambdaparameter: 33
body: 16
14IndexedVarvariable: 17
index: 33
15Lambdaparameter: 33
body: 19
16Operationoperator: 21
operands: 20
17Variable
18ExprTuple33
19Operationoperator: 21
operands: 22
20NamedExprselement: 23
targets: 25
21Literal
22NamedExprselement: 24
targets: 25
23Operationoperator: 27
operands: 26
24Operationoperator: 27
operands: 28
25Operationoperator: 29
operands: 30
26NamedExprsstate: 31
part: 33
27Literal
28NamedExprsstate: 32
part: 33
29Literal
30ExprTuple34, 35
31Variable
32Variable
33Variable
34Literal
35Variable