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.algebra import scalar_mult_factorization
In [2]:
# check that the built expression is the same as the stored expression
assert scalar_mult_factorization.expr == stored_expr
assert scalar_mult_factorization.expr._style_id == stored_expr._style_id
print("Passed sanity check: scalar_mult_factorization matches stored_expr")
Passed sanity check: scalar_mult_factorization matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{j \in \mathbb{N}^+}~\left[\forall_{a \in \mathbb{C}}~\left[\forall_{B_{1}, B_{2}, \ldots, B_{j}~|~\left(B_{1} \thinspace  B_{2} \thinspace  \ldots \thinspace  B_{j}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}}~\left(\begin{array}{c} \begin{array}{l} \left(a\thinspace B_{1} \thinspace  B_{2} \thinspace  \ldots \thinspace  B_{j}\right) =  \\ \left(a \cdot \left(B_{1} \thinspace  B_{2} \thinspace  \ldots \thinspace  B_{j}\right)\right) \end{array} \end{array}\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: 15
operand: 2
1ExprTuple2
2Lambdaparameter: 41
body: 4
3ExprTuple41
4Conditionalvalue: 5
condition: 6
5Operationoperator: 15
operand: 9
6Operationoperator: 17
operands: 8
7ExprTuple9
8ExprTuple41, 10
9Lambdaparameter: 34
body: 12
10Literal
11ExprTuple34
12Conditionalvalue: 13
condition: 14
13Operationoperator: 15
operand: 19
14Operationoperator: 17
operands: 18
15Literal
16ExprTuple19
17Literal
18ExprTuple34, 20
19Lambdaparameters: 37
body: 21
20Literal
21Conditionalvalue: 22
condition: 23
22Operationoperator: 24
operands: 25
23Operationoperator: 26
operands: 27
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple35, 30
28Operationoperator: 36
operands: 31
29Operationoperator: 32
operands: 33
30Literal
31ExprTuple34, 38
32Literal
33ExprTuple34, 35
34Variable
35Operationoperator: 36
operands: 37
36Literal
37ExprTuple38
38ExprRangelambda_map: 39
start_index: 40
end_index: 41
39Lambdaparameter: 45
body: 42
40Literal
41Variable
42IndexedVarvariable: 43
index: 45
43Variable
44ExprTuple45
45Variable