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 qmult_distribution_over_add
In [2]:
# check that the built expression is the same as the stored expression
assert qmult_distribution_over_add.expr == stored_expr
assert qmult_distribution_over_add.expr._style_id == stored_expr._style_id
print("Passed sanity check: qmult_distribution_over_add matches stored_expr")
Passed sanity check: qmult_distribution_over_add matches stored_expr
In [3]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\forall_{i \in \mathbb{N}^+, m \in \mathbb{N}, n \in \mathbb{N}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{m}, B_{1}, B_{2}, \ldots, B_{i}, C_{1}, C_{2}, \ldots, C_{n}}~\left(\begin{array}{c} \begin{array}{l} \left(\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace \left(B_{1} +  B_{2} +  \ldots +  B_{i}\right)\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}\right) \Rightarrow  \\ \left(\begin{array}{c} \begin{array}{l} \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace \left(B_{1} +  B_{2} +  \ldots +  B_{i}\right)\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace B_{1}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) +  \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace B_{2}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) +  \ldots +  \left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace B_{i}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right)\right) \end{array} \end{array}\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
3ExprTuple44, 52, 57
4Conditionalvalue: 5
condition: 6
5Operationoperator: 7
operand: 11
6Operationoperator: 9
operands: 10
7Literal
8ExprTuple11
9Literal
10ExprTuple12, 13, 14
11Lambdaparameters: 15
body: 16
12Operationoperator: 19
operands: 17
13Operationoperator: 19
operands: 18
14Operationoperator: 19
operands: 20
15ExprTuple48, 41, 50
16Operationoperator: 21
operands: 22
17ExprTuple44, 23
18ExprTuple52, 24
19Literal
20ExprTuple57, 24
21Literal
22ExprTuple25, 26
23Literal
24Literal
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operands: 30
27Literal
28ExprTuple32, 31
29Literal
30ExprTuple32, 33
31Literal
32Operationoperator: 45
operands: 34
33Operationoperator: 38
operands: 35
34ExprTuple48, 36, 50
35ExprTuple37
36Operationoperator: 38
operands: 39
37ExprRangelambda_map: 40
start_index: 56
end_index: 44
38Literal
39ExprTuple41
40Lambdaparameter: 59
body: 42
41ExprRangelambda_map: 43
start_index: 56
end_index: 44
42Operationoperator: 45
operands: 46
43Lambdaparameter: 64
body: 47
44Variable
45Literal
46ExprTuple48, 49, 50
47IndexedVarvariable: 53
index: 64
48ExprRangelambda_map: 51
start_index: 56
end_index: 52
49IndexedVarvariable: 53
index: 59
50ExprRangelambda_map: 55
start_index: 56
end_index: 57
51Lambdaparameter: 64
body: 58
52Variable
53Variable
54ExprTuple59
55Lambdaparameter: 64
body: 60
56Literal
57Variable
58IndexedVarvariable: 61
index: 64
59Variable
60IndexedVarvariable: 62
index: 64
61Variable
62Variable
63ExprTuple64
64Variable