logo

Expression of type Implies

from the theory of proveit.physics.quantum.algebra

In [1]:
import proveit
# Automation is not needed when building an expression:
proveit.defaults.automation = False # This will speed things up.
proveit.defaults.inline_pngs = False # Makes files smaller.
%load_expr # Load the stored expression as 'stored_expr'
# import Expression classes needed to build the expression
from proveit.core_expr_types import A_1_to_m, C_1_to_n, Q__b_1_to_j, b_1_to_j, f__b_1_to_j
from proveit.linear_algebra import VecSum
from proveit.linear_algebra.addition import vec_summation_b1toj_fQ
from proveit.logic import Equals, Implies, InClass
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Qmult(A_1_to_m, vec_summation_b1toj_fQ, C_1_to_n)
expr = Implies(InClass(sub_expr1, QmultCodomain), Equals(sub_expr1, VecSum(index_or_indices = [b_1_to_j], summand = Qmult(A_1_to_m, f__b_1_to_j, C_1_to_n), condition = Q__b_1_to_j)).with_wrapping_at(1)).with_wrapping_at(2)
expr:
In [3]:
# check that the built expression is the same as the stored expression
assert expr == stored_expr
assert expr._style_id == stored_expr._style_id
print("Passed sanity check: expr matches stored_expr")
Passed sanity check: expr matches stored_expr
In [4]:
# Show the LaTeX representation of the expression for convenience if you need it.
print(stored_expr.latex())
\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}
In [5]:
stored_expr.style_options()
namedescriptiondefaultcurrent valuerelated methods
operation'infix' or 'function' style formattinginfixinfix
wrap_positionsposition(s) at which wrapping is to occur; '2 n - 1' is after the nth operand, '2 n' is after the nth operation.()(2)('with_wrapping_at', 'with_wrap_before_operator', 'with_wrap_after_operator', 'without_wrapping', 'wrap_positions')
justificationif any wrap positions are set, justify to the 'left', 'center', or 'right'centercenter('with_justification',)
directionDirection of the relation (normal or reversed)normalnormal('with_direction_reversed', 'is_reversed')
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0Operationoperator: 1
operands: 2
1Literal
2ExprTuple3, 4
3Operationoperator: 5
operands: 6
4Operationoperator: 7
operands: 8
5Literal
6ExprTuple10, 9
7Literal
8ExprTuple10, 11
9Literal
10Operationoperator: 22
operands: 12
11Operationoperator: 16
operand: 15
12ExprTuple25, 14, 27
13ExprTuple15
14Operationoperator: 16
operand: 19
15Lambdaparameters: 32
body: 18
16Literal
17ExprTuple19
18Conditionalvalue: 20
condition: 24
19Lambdaparameters: 32
body: 21
20Operationoperator: 22
operands: 23
21Conditionalvalue: 26
condition: 24
22Literal
23ExprTuple25, 26, 27
24Operationoperator: 28
operands: 32
25ExprRangelambda_map: 29
start_index: 40
end_index: 30
26Operationoperator: 31
operands: 32
27ExprRangelambda_map: 33
start_index: 40
end_index: 34
28Variable
29Lambdaparameter: 46
body: 35
30Variable
31Variable
32ExprTuple36
33Lambdaparameter: 46
body: 37
34Variable
35IndexedVarvariable: 38
index: 46
36ExprRangelambda_map: 39
start_index: 40
end_index: 41
37IndexedVarvariable: 42
index: 46
38Variable
39Lambdaparameter: 46
body: 43
40Literal
41Variable
42Variable
43IndexedVarvariable: 44
index: 46
44Variable
45ExprTuple46
46Variable