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_absorption
In [2]:
# check that the built expression is the same as the stored expression
assert scalar_mult_absorption.expr == stored_expr
assert scalar_mult_absorption.expr._style_id == stored_expr._style_id
print("Passed sanity check: scalar_mult_absorption matches stored_expr")
Passed sanity check: scalar_mult_absorption matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{\alpha \in \mathbb{C}, l \in \mathbb{N}, n \in \mathbb{N}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{l}, B, C_{1}, C_{2}, \ldots, C_{n}~|~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l} \thinspace B\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}}~\left(\begin{array}{c} \begin{array}{l} \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l} \thinspace \left(\alpha \cdot B\right)\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l} \thinspace \alpha \thinspace B\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \end{array} \end{array}\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
2Lambdaparameters: 3
body: 4
3ExprTuple46, 42, 45
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple12, 13, 14
11Lambdaparameters: 35
body: 15
12Operationoperator: 18
operands: 16
13Operationoperator: 18
operands: 17
14Operationoperator: 18
operands: 19
15Conditionalvalue: 20
condition: 21
16ExprTuple46, 22
17ExprTuple42, 23
18Literal
19ExprTuple45, 23
20Operationoperator: 24
operands: 25
21Operationoperator: 26
operands: 27
22Literal
23Literal
24Literal
25ExprTuple28, 29
26Literal
27ExprTuple30, 31
28Operationoperator: 34
operands: 32
29Operationoperator: 34
operands: 33
30Operationoperator: 34
operands: 35
31Literal
32ExprTuple37, 36, 38
33ExprTuple37, 46, 47, 38
34Literal
35ExprTuple37, 47, 38
36Operationoperator: 39
operands: 40
37ExprRangelambda_map: 41
start_index: 44
end_index: 42
38ExprRangelambda_map: 43
start_index: 44
end_index: 45
39Literal
40ExprTuple46, 47
41Lambdaparameter: 53
body: 48
42Variable
43Lambdaparameter: 53
body: 49
44Literal
45Variable
46Variable
47Variable
48IndexedVarvariable: 50
index: 53
49IndexedVarvariable: 51
index: 53
50Variable
51Variable
52ExprTuple53
53Variable