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 input_as_tensor_prod
In [2]:
# check that the built expression is the same as the stored expression
assert input_as_tensor_prod.expr == stored_expr
assert input_as_tensor_prod.expr._style_id == stored_expr._style_id
print("Passed sanity check: input_as_tensor_prod matches stored_expr")
Passed sanity check: input_as_tensor_prod matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{m \in \mathbb{N}^+}~\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)\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
2Lambdaparameter: 55
body: 4
3ExprTuple55
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple55, 12
11Lambdaparameters: 13
body: 14
12Literal
13ExprTuple53, 33
14Operationoperator: 15
operands: 16
15Literal
16ExprTuple17, 18
17Operationoperator: 19
operands: 20
18Operationoperator: 21
operands: 22
19Literal
20ExprTuple23, 24
21Literal
22ExprTuple53, 25
23Operationoperator: 27
operand: 31
24Operationoperator: 27
operand: 32
25Operationoperator: 29
operands: 30
26ExprTuple31
27Literal
28ExprTuple32
29Literal
30ExprTuple33
31ExprTuple34
32ExprTuple35
33ExprRangelambda_map: 36
start_index: 54
end_index: 55
34ExprRangelambda_map: 37
start_index: 54
end_index: 55
35ExprRangelambda_map: 38
start_index: 54
end_index: 55
36Lambdaparameter: 56
body: 46
37Lambdaparameter: 56
body: 39
38Lambdaparameter: 56
body: 40
39Operationoperator: 41
operands: 42
40Operationoperator: 47
operands: 43
41Literal
42NamedExprselement: 44
targets: 45
43NamedExprsstate: 46
44Operationoperator: 47
operands: 48
45Operationoperator: 49
operands: 50
46IndexedVarvariable: 51
index: 56
47Literal
48NamedExprsstate: 53
part: 56
49Literal
50ExprTuple54, 55
51Variable
52ExprTuple56
53Variable
54Literal
55Variable
56Variable