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 qcircuit_eq
In [2]:
# check that the built expression is the same as the stored expression
assert qcircuit_eq.expr == stored_expr
assert qcircuit_eq.expr._style_id == stored_expr._style_id
print("Passed sanity check: qcircuit_eq matches stored_expr")
Passed sanity check: qcircuit_eq 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 \in \mathbb{N}^+}~\left[\begin{array}{l}\forall_{A_{1, 1}, A_{1, 2}, \ldots, A_{1, l}, A_{2, 1}, A_{2, 2}, \ldots, A_{2, l}, \ldots\ldots, A_{k, 1}, A_{k, 2}, \ldots, A_{k, l}, B_{1, 1}, B_{1, 2}, \ldots, B_{1, l}, B_{2, 1}, B_{2, 2}, \ldots, B_{2, l}, \ldots\ldots, B_{k, 1}, B_{k, 2}, \ldots, B_{k, l}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\left(\begin{array}{cccc} 
 A_{1, 1} & A_{2, 1} & \cdots & A_{k, 1} \\
A_{1, 2} & A_{2, 2} & \cdots & A_{k, 2} \\
\vdots & \vdots & \ddots & \vdots \\
A_{1, l} & A_{2, l} & \cdots & A_{k, l} \\
\end{array}
\right) = \left(\begin{array}{cccc} 
 B_{1, 1} & B_{2, 1} & \cdots & B_{k, 1} \\
B_{1, 2} & B_{2, 2} & \cdots & B_{k, 2} \\
\vdots & \vdots & \ddots & \vdots \\
B_{1, l} & B_{2, l} & \cdots & B_{k, l} \\
\end{array}
\right)\right) \Rightarrow  \\ \left(\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{A_{1, 1}} \qwx[1] & \gate{A_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 1}} \qwx[1] & \qw \\
& \gate{A_{1, 2}} \qwx[1] & \gate{A_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{A_{k, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{A_{1, l}} & \gate{A_{2, l}} & \gate{\cdots} & \gate{A_{k, l}} & \qw
} \end{array}\right) = \left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{B_{1, 1}} \qwx[1] & \gate{B_{2, 1}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{k, 1}} \qwx[1] & \qw \\
& \gate{B_{1, 2}} \qwx[1] & \gate{B_{2, 2}} \qwx[1] & \gate{\cdots} \qwx[1] & \gate{B_{k, 2}} \qwx[1] & \qw \\
& \gate{\vdots} \qwx[1] & \gate{\vdots} \qwx[1] & \gate{\ddots} \qwx[1] & \gate{\vdots} \qwx[1] & \qw \\
& \gate{B_{1, l}} & \gate{B_{2, l}} & \gate{\cdots} & \gate{B_{k, l}} & \qw
} \end{array}\right)\right) \end{array} \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: 7
operand: 2
1ExprTuple2
2Lambdaparameters: 3
body: 4
3ExprTuple40, 49
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple12, 13
11Lambdaparameters: 14
body: 15
12Operationoperator: 17
operands: 16
13Operationoperator: 17
operands: 18
14ExprTuple19, 20
15Operationoperator: 21
operands: 22
16ExprTuple40, 23
17Literal
18ExprTuple49, 23
19ExprRangelambda_map: 24
start_index: 48
end_index: 40
20ExprRangelambda_map: 25
start_index: 48
end_index: 40
21Literal
22ExprTuple26, 27
23Literal
24Lambdaparameter: 56
body: 44
25Lambdaparameter: 56
body: 45
26Operationoperator: 29
operands: 28
27Operationoperator: 29
operands: 30
28ExprTuple33, 35
29Literal
30ExprTuple31, 32
31Operationoperator: 34
operands: 33
32Operationoperator: 34
operands: 35
33ExprTuple36
34Literal
35ExprTuple37
36ExprRangelambda_map: 38
start_index: 48
end_index: 40
37ExprRangelambda_map: 39
start_index: 48
end_index: 40
38Lambdaparameter: 56
body: 41
39Lambdaparameter: 56
body: 43
40Variable
41ExprTuple44
42ExprTuple56
43ExprTuple45
44ExprRangelambda_map: 46
start_index: 48
end_index: 49
45ExprRangelambda_map: 47
start_index: 48
end_index: 49
46Lambdaparameter: 57
body: 50
47Lambdaparameter: 57
body: 52
48Literal
49Variable
50IndexedVarvariable: 53
indices: 55
51ExprTuple57
52IndexedVarvariable: 54
indices: 55
53Variable
54Variable
55ExprTuple56, 57
56Variable
57Variable