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 A, Conditional, ExprTuple, Lambda, m
from proveit.core_expr_types import B_1_to_m
from proveit.linear_algebra import TensorProd
from proveit.logic import Equals, Forall, Iff, InSet
from proveit.numbers import NaturalPos
from proveit.physics.quantum.circuits import QcircuitEquiv, circuit_compressed_inputAm, circuit_expanded_inputBm
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda(m, Conditional(Forall(instance_param_or_params = [A, B_1_to_m], instance_expr = Iff(QcircuitEquiv(circuit_compressed_inputAm, circuit_expanded_inputBm), Equals(A, TensorProd(B_1_to_m)))), InSet(m, NaturalPos))))
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(m \mapsto \left\{\forall_{A, B_{1}, B_{2}, \ldots, B_{m}}~\left(\left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{A} & { /^{m} } \qw
} \end{array}\right) \cong \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{B_{1}} & \qw \\
\qin{B_{2}} & \qw \\
\qin{\vdots} & \qw \\
\qin{B_{m}} & \qw
} \end{array}\right)\right) \Leftrightarrow \left(A = \left(B_{1} {\otimes}  B_{2} {\otimes}  \ldots {\otimes}  B_{m}\right)\right)\right) \textrm{ if } m \in \mathbb{N}^+\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameter: 54
body: 3
2ExprTuple54
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple54, 11
10Lambdaparameters: 12
body: 13
11Literal
12ExprTuple52, 32
13Operationoperator: 14
operands: 15
14Literal
15ExprTuple16, 17
16Operationoperator: 18
operands: 19
17Operationoperator: 20
operands: 21
18Literal
19ExprTuple22, 23
20Literal
21ExprTuple52, 24
22Operationoperator: 26
operand: 30
23Operationoperator: 26
operand: 31
24Operationoperator: 28
operands: 29
25ExprTuple30
26Literal
27ExprTuple31
28Literal
29ExprTuple32
30ExprTuple33
31ExprTuple34
32ExprRangelambda_map: 35
start_index: 53
end_index: 54
33ExprRangelambda_map: 36
start_index: 53
end_index: 54
34ExprRangelambda_map: 37
start_index: 53
end_index: 54
35Lambdaparameter: 55
body: 45
36Lambdaparameter: 55
body: 38
37Lambdaparameter: 55
body: 39
38Operationoperator: 40
operands: 41
39Operationoperator: 46
operands: 42
40Literal
41NamedExprselement: 43
targets: 44
42NamedExprsstate: 45
43Operationoperator: 46
operands: 47
44Operationoperator: 48
operands: 49
45IndexedVarvariable: 50
index: 55
46Literal
47NamedExprsstate: 52
part: 55
48Literal
49ExprTuple53, 54
50Variable
51ExprTuple55
52Variable
53Literal
54Variable
55Variable