logo
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_theorem_expr # Load the stored theorem expression as 'stored_expr'
# import the special expression
from proveit.physics.quantum.circuits import circuit_equiv_top_sub
In [2]:
# check that the built expression is the same as the stored expression
assert circuit_equiv_top_sub.expr == stored_expr
assert circuit_equiv_top_sub.expr._style_id == stored_expr._style_id
print("Passed sanity check: circuit_equiv_top_sub matches stored_expr")
Passed sanity check: circuit_equiv_top_sub matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{k, l, m \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{A_{1, 1}, A_{1, 2}, \ldots, A_{1, m}, A_{2, 1}, A_{2, 2}, \ldots, A_{2, m}, \ldots\ldots, A_{k, 1}, A_{k, 2}, \ldots, A_{k, m}, B_{1, 1}, B_{1, 2}, \ldots, B_{1, m}, B_{2, 1}, B_{2, 2}, \ldots, B_{2, m}, \ldots\ldots, B_{k, 1}, B_{k, 2}, \ldots, B_{k, m}, C_{1, 1}, C_{1, 2}, \ldots, C_{1, m}, C_{2, 1}, C_{2, 2}, \ldots, C_{2, m}, \ldots\ldots, C_{l, 1}, C_{l, 2}, \ldots, C_{l, m}}~\\
\left[\begin{array}{l}\forall_{\scriptsize \begin{array}{l}R_{1, 1}, R_{1, 2}, \ldots, R_{1, m}, R_{2, 1}, R_{2, 2}, \ldots, R_{2, m}, \ldots\ldots, R_{k, 1}, R_{k, 2}, \ldots, R_{k, m}, S_{1, 1}, S_{1, 2}, \ldots, S_{1, m}, S_{2, 1}, S_{2, 2}, \ldots, S_{2, m}, \ldots\ldots, S_{k, 1}, S_{k, 2}, \ldots, S_{k, m}, T_{1, 1}, T_{1, 2}, \ldots, T_{1, m}, T_{2, 1}, T_{2, 2}, \ldots, T_{2, m}, \ldots\ldots, T_{l, 1}, T_{l, 2}, \ldots, T_{l, m} \\~|~\textrm{disjoint}\left(T_{1, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{1, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{1, m}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{2, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{2, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{2, m}, \{1~\ldotp \ldotp~k\}\right), \ldots\ldots, \textrm{disjoint}\left(T_{l, 1}, \{1~\ldotp \ldotp~k\}\right), \textrm{disjoint}\left(T_{l, 2}, \{1~\ldotp \ldotp~k\}\right), \ldots, \textrm{disjoint}\left(T_{l, m}, \{1~\ldotp \ldotp~k\}\right)\end{array}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{A_{1, 1}~\mbox{on}~R_{1, 1}} \qwx[1] & \gate{A_{2, 1}~\mbox{on}~R_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{m, 1}~\mbox{on}~R_{m, 1}} \qwx[1] & \qw \\
& \gate{A_{1, 2}~\mbox{on}~R_{1, 2}} \qwx[1] & \gate{A_{2, 2}~\mbox{on}~R_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{m, 2}~\mbox{on}~R_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{A_{1, k}~\mbox{on}~R_{1, k}} & \gate{A_{2, k}~\mbox{on}~R_{2, k}} & \gate{\cdots} & \gate{A_{m, k}~\mbox{on}~R_{m, k}} & \qw
} \end{array}\right) \cong \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{B_{1, 1}~\mbox{on}~S_{1, 1}} \qwx[1] & \gate{B_{2, 1}~\mbox{on}~S_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{m, 1}~\mbox{on}~S_{m, 1}} \qwx[1] & \qw \\
& \gate{B_{1, 2}~\mbox{on}~S_{1, 2}} \qwx[1] & \gate{B_{2, 2}~\mbox{on}~S_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{m, 2}~\mbox{on}~S_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{B_{1, k}~\mbox{on}~S_{1, k}} & \gate{B_{2, k}~\mbox{on}~S_{2, k}} & \gate{\cdots} & \gate{B_{m, k}~\mbox{on}~S_{m, k}} & \qw
} \end{array}\right)\right) \Rightarrow  \\ \left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{A_{1, 1}~\mbox{on}~R_{1, 1}} \qwx[1] & \gate{A_{2, 1}~\mbox{on}~R_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{m, 1}~\mbox{on}~R_{m, 1}} \qwx[1] & \qw \\
& \gate{A_{1, 2}~\mbox{on}~R_{1, 2}} \qwx[1] & \gate{A_{2, 2}~\mbox{on}~R_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{m, 2}~\mbox{on}~R_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{A_{1, k}~\mbox{on}~R_{1, k}} \qwx[1] & \gate{A_{2, k}~\mbox{on}~R_{2, k}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{m, k}~\mbox{on}~R_{m, k}} \qwx[1] & \qw \\
& \gate{C_{1, 1}~\mbox{on}~T_{1, 1}} \qwx[1] & \gate{C_{2, 1}~\mbox{on}~T_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{C_{m, 1}~\mbox{on}~T_{m, 1}} \qwx[1] & \qw \\
& \gate{C_{1, 2}~\mbox{on}~T_{1, 2}} \qwx[1] & \gate{C_{2, 2}~\mbox{on}~T_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{C_{m, 2}~\mbox{on}~T_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{C_{1, l}~\mbox{on}~T_{1, l}} & \gate{C_{2, l}~\mbox{on}~T_{2, l}} & \gate{\cdots} & \gate{C_{m, l}~\mbox{on}~T_{m, l}} & \qw
} \end{array}\right) \cong \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{B_{1, 1}~\mbox{on}~S_{1, 1}} \qwx[1] & \gate{B_{2, 1}~\mbox{on}~S_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{m, 1}~\mbox{on}~S_{m, 1}} \qwx[1] & \qw \\
& \gate{B_{1, 2}~\mbox{on}~S_{1, 2}} \qwx[1] & \gate{B_{2, 2}~\mbox{on}~S_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{m, 2}~\mbox{on}~S_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{B_{1, k}~\mbox{on}~S_{1, k}} \qwx[1] & \gate{B_{2, k}~\mbox{on}~S_{2, k}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{m, k}~\mbox{on}~S_{m, k}} \qwx[1] & \qw \\
& \gate{C_{1, 1}~\mbox{on}~T_{1, 1}} \qwx[1] & \gate{C_{2, 1}~\mbox{on}~T_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{C_{m, 1}~\mbox{on}~T_{m, 1}} \qwx[1] & \qw \\
& \gate{C_{1, 2}~\mbox{on}~T_{1, 2}} \qwx[1] & \gate{C_{2, 2}~\mbox{on}~T_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{C_{m, 2}~\mbox{on}~T_{m, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{C_{1, l}~\mbox{on}~T_{1, l}} & \gate{C_{2, l}~\mbox{on}~T_{2, l}} & \gate{\cdots} & \gate{C_{m, l}~\mbox{on}~T_{m, l}} & \qw
} \end{array}\right)\right) \end{array} \end{array}\right)\end{array}\right]\end{array}\right]
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: 22
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple101, 99, 82
4Conditionalvalue: 5
condition: 6
5Operationoperator: 22
operand: 9
6Operationoperator: 47
operands: 8
7ExprTuple9
8ExprTuple10, 11, 12
9Lambdaparameters: 13
body: 14
10Operationoperator: 17
operands: 15
11Operationoperator: 17
operands: 16
12Operationoperator: 17
operands: 18
13ExprTuple19, 20, 21
14Operationoperator: 22
operand: 28
15ExprTuple101, 24
16ExprTuple99, 24
17Literal
18ExprTuple82, 24
19ExprRangelambda_map: 25
start_index: 100
end_index: 101
20ExprRangelambda_map: 26
start_index: 100
end_index: 101
21ExprRangelambda_map: 27
start_index: 100
end_index: 99
22Literal
23ExprTuple28
24Literal
25Lambdaparameter: 123
body: 29
26Lambdaparameter: 123
body: 30
27Lambdaparameter: 123
body: 31
28Lambdaparameters: 32
body: 33
29ExprRangelambda_map: 34
start_index: 100
end_index: 82
30ExprRangelambda_map: 35
start_index: 100
end_index: 82
31ExprRangelambda_map: 36
start_index: 100
end_index: 82
32ExprTuple37, 38, 39
33Conditionalvalue: 40
condition: 41
34Lambdaparameter: 124
body: 110
35Lambdaparameter: 124
body: 112
36Lambdaparameter: 124
body: 114
37ExprRangelambda_map: 42
start_index: 100
end_index: 101
38ExprRangelambda_map: 43
start_index: 100
end_index: 101
39ExprRangelambda_map: 44
start_index: 100
end_index: 99
40Operationoperator: 45
operands: 46
41Operationoperator: 47
operands: 48
42Lambdaparameter: 123
body: 49
43Lambdaparameter: 123
body: 50
44Lambdaparameter: 123
body: 51
45Literal
46ExprTuple52, 53
47Literal
48ExprTuple54
49ExprRangelambda_map: 55
start_index: 100
end_index: 82
50ExprRangelambda_map: 56
start_index: 100
end_index: 82
51ExprRangelambda_map: 57
start_index: 100
end_index: 82
52Operationoperator: 59
operands: 58
53Operationoperator: 59
operands: 60
54ExprRangelambda_map: 61
start_index: 100
end_index: 99
55Lambdaparameter: 124
body: 111
56Lambdaparameter: 124
body: 113
57Lambdaparameter: 124
body: 115
58ExprTuple62, 63
59Literal
60ExprTuple64, 65
61Lambdaparameter: 123
body: 66
62Operationoperator: 70
operands: 67
63Operationoperator: 70
operands: 68
64Operationoperator: 70
operands: 69
65Operationoperator: 70
operands: 71
66ExprRangelambda_map: 72
start_index: 100
end_index: 82
67ExprTuple73
68ExprTuple74
69ExprTuple75
70Literal
71ExprTuple76
72Lambdaparameter: 124
body: 77
73ExprRangelambda_map: 78
start_index: 100
end_index: 82
74ExprRangelambda_map: 79
start_index: 100
end_index: 82
75ExprRangelambda_map: 80
start_index: 100
end_index: 82
76ExprRangelambda_map: 81
start_index: 100
end_index: 82
77Operationoperator: 83
operands: 84
78Lambdaparameter: 123
body: 85
79Lambdaparameter: 123
body: 86
80Lambdaparameter: 123
body: 87
81Lambdaparameter: 123
body: 89
82Variable
83Literal
84ExprTuple115, 90
85ExprTuple91
86ExprTuple92
87ExprTuple91, 93
88ExprTuple123
89ExprTuple92, 93
90Operationoperator: 94
operands: 95
91ExprRangelambda_map: 96
start_index: 100
end_index: 101
92ExprRangelambda_map: 97
start_index: 100
end_index: 101
93ExprRangelambda_map: 98
start_index: 100
end_index: 99
94Literal
95ExprTuple100, 101
96Lambdaparameter: 124
body: 102
97Lambdaparameter: 124
body: 103
98Lambdaparameter: 124
body: 105
99Variable
100Literal
101Variable
102Operationoperator: 108
operands: 106
103Operationoperator: 108
operands: 107
104ExprTuple124
105Operationoperator: 108
operands: 109
106NamedExprselement: 110
targets: 111
107NamedExprselement: 112
targets: 113
108Literal
109NamedExprselement: 114
targets: 115
110IndexedVarvariable: 116
indices: 122
111IndexedVarvariable: 117
indices: 122
112IndexedVarvariable: 118
indices: 122
113IndexedVarvariable: 119
indices: 122
114IndexedVarvariable: 120
indices: 122
115IndexedVarvariable: 121
indices: 122
116Variable
117Variable
118Variable
119Variable
120Variable
121Variable
122ExprTuple123, 124
123Variable
124Variable