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_summation
In [2]:
# check that the built expression is the same as the stored expression
assert qmult_distribution_over_summation.expr == stored_expr
assert qmult_distribution_over_summation.expr._style_id == stored_expr._style_id
print("Passed sanity check: qmult_distribution_over_summation matches stored_expr")
Passed sanity check: qmult_distribution_over_summation 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}^+, m \in \mathbb{N}, n \in \mathbb{N}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{m}, C_{1}, C_{2}, \ldots, C_{n}, f, Q}~\left(\begin{array}{c} \begin{array}{l} \left(\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\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[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\right]\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \\  = \left[\sum_{b_{1}, b_{2}, \ldots, b_{j}~|~Q\left(b_{1}, b_{2}, \ldots, b_{j}\right)}~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{m} \thinspace f\left(b_{1}, b_{2}, \ldots, b_{j}\right)\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
3ExprTuple63, 52, 56
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
15ExprTuple47, 49, 53, 50
16Operationoperator: 21
operands: 22
17ExprTuple63, 23
18ExprTuple52, 24
19Literal
20ExprTuple56, 24
21Literal
22ExprTuple25, 26
23Literal
24Literal
25Operationoperator: 27
operands: 28
26Operationoperator: 29
operands: 30
27Literal
28ExprTuple32, 31
29Literal
30ExprTuple32, 33
31Literal
32Operationoperator: 44
operands: 34
33Operationoperator: 38
operand: 37
34ExprTuple47, 36, 49
35ExprTuple37
36Operationoperator: 38
operand: 41
37Lambdaparameters: 54
body: 40
38Literal
39ExprTuple41
40Conditionalvalue: 42
condition: 46
41Lambdaparameters: 54
body: 43
42Operationoperator: 44
operands: 45
43Conditionalvalue: 48
condition: 46
44Literal
45ExprTuple47, 48, 49
46Operationoperator: 50
operands: 54
47ExprRangelambda_map: 51
start_index: 62
end_index: 52
48Operationoperator: 53
operands: 54
49ExprRangelambda_map: 55
start_index: 62
end_index: 56
50Variable
51Lambdaparameter: 68
body: 57
52Variable
53Variable
54ExprTuple58
55Lambdaparameter: 68
body: 59
56Variable
57IndexedVarvariable: 60
index: 68
58ExprRangelambda_map: 61
start_index: 62
end_index: 63
59IndexedVarvariable: 64
index: 68
60Variable
61Lambdaparameter: 68
body: 65
62Literal
63Variable
64Variable
65IndexedVarvariable: 66
index: 68
66Variable
67ExprTuple68
68Variable