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 concat_ideal_expt
In [2]:
# check that the built expression is the same as the stored expression
assert concat_ideal_expt.expr == stored_expr
assert concat_ideal_expt.expr._style_id == stored_expr._style_id
print("Passed sanity check: concat_ideal_expt matches stored_expr")
Passed sanity check: concat_ideal_expt matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\begin{array}{l}\forall_{i, j, m \in \mathbb{N}^+}~\\
\left[\begin{array}{l}\forall_{\lvert \psi \rangle \in \mathbb{C}^{2^{m}}}~\\
\left[\begin{array}{l}\forall_{U_{1}, U_{2}, \ldots, U_{i}, V_{1}, V_{2}, \ldots, V_{j}}~\\
\left(\begin{array}{c} \begin{array}{l} \left(\textrm{Pr}\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
\qin{\lvert \psi \rangle} & \gate{\begin{array}{c} \uparrow \\V_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\V_{j} \\ \downarrow\end{array}} & { /^{m} } \qw
} \end{array}\right) = 1\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \textrm{Pr}\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \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_{i} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\V_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\V_{2} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\V_{j} \\ \downarrow\end{array}} & \qw
} \end{array}\right) =  \\ \textrm{Pr}\left(\begin{array}{c} \Qcircuit@C=1em @R=.7em{
& \gate{\begin{array}{c} \uparrow \\U_{1} \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\\cdots \\ \downarrow\end{array}} & \gate{\begin{array}{c} \uparrow \\U_{i} \\ \downarrow\end{array}} & \qout{\lvert \psi \rangle}
} \end{array}\right) \end{array} \end{array}\right) \end{array} \end{array}\right)\end{array}\right]\end{array}\right]\end{array}
In [4]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
with_wrappingIf 'True', wrap the Expression after the parametersNoneTrue('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
3ExprTuple66, 64, 91
4Conditionalvalue: 5
condition: 6
5Operationoperator: 22
operand: 10
6Operationoperator: 8
operands: 9
7ExprTuple10
8Literal
9ExprTuple11, 12, 13
10Lambdaparameter: 88
body: 15
11Operationoperator: 24
operands: 16
12Operationoperator: 24
operands: 17
13Operationoperator: 24
operands: 18
14ExprTuple88
15Conditionalvalue: 19
condition: 20
16ExprTuple66, 21
17ExprTuple64, 21
18ExprTuple91, 21
19Operationoperator: 22
operand: 26
20Operationoperator: 24
operands: 25
21Literal
22Literal
23ExprTuple26
24Literal
25ExprTuple88, 27
26Lambdaparameters: 28
body: 29
27Operationoperator: 30
operands: 31
28ExprTuple60, 59
29Operationoperator: 32
operands: 33
30Literal
31ExprTuple34, 35
32Literal
33ExprTuple36, 37
34Literal
35Operationoperator: 38
operands: 39
36Operationoperator: 41
operands: 40
37Operationoperator: 41
operands: 42
38Literal
39ExprTuple43, 91
40ExprTuple44, 90
41Literal
42ExprTuple45, 46
43Literal
44Operationoperator: 49
operand: 51
45Operationoperator: 49
operand: 52
46Operationoperator: 49
operand: 53
47ExprTuple51
48ExprTuple52
49Literal
50ExprTuple53
51Operationoperator: 56
operands: 54
52Operationoperator: 56
operands: 55
53Operationoperator: 56
operands: 57
54ExprTuple58, 59
55ExprTuple60, 59
56Literal
57ExprTuple60, 61
58ExprTuple62
59ExprRangelambda_map: 63
start_index: 90
end_index: 64
60ExprRangelambda_map: 65
start_index: 90
end_index: 66
61ExprTuple67
62ExprRangelambda_map: 68
start_index: 90
end_index: 91
63Lambdaparameter: 89
body: 69
64Variable
65Lambdaparameter: 89
body: 70
66Variable
67ExprRangelambda_map: 71
start_index: 90
end_index: 91
68Lambdaparameter: 89
body: 72
69IndexedVarvariable: 73
index: 89
70IndexedVarvariable: 74
index: 89
71Lambdaparameter: 89
body: 76
72Operationoperator: 78
operands: 77
73Variable
74Variable
75ExprTuple89
76Operationoperator: 78
operands: 79
77NamedExprselement: 80
targets: 82
78Literal
79NamedExprselement: 81
targets: 82
80Operationoperator: 83
operands: 85
81Operationoperator: 84
operands: 85
82Operationoperator: 86
operands: 87
83Literal
84Literal
85NamedExprsstate: 88
part: 89
86Literal
87ExprTuple90, 91
88Variable
89Variable
90Literal
91Variable