logo

Expression of type ExprTuple

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 import Conditional, ExprRange, ExprTuple, IndexedVar, Lambda, Variable, b, j
from proveit.core_expr_types import A_1_to_l, C_1_to_n, b_1_to_j
from proveit.logic import And, Equals, Forall, InClass, InSet
from proveit.numbers import Complex, one
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
sub_expr1 = Variable("_a", latex_format = r"{_{-}a}")
expr = ExprTuple(Lambda([b_1_to_j], Conditional(Forall(instance_param_or_params = [A_1_to_l, C_1_to_n], instance_expr = Equals(Qmult(A_1_to_l, b_1_to_j, C_1_to_n), Qmult(b_1_to_j, A_1_to_l, C_1_to_n)).with_wrapping_at(2), condition = InClass(Qmult(A_1_to_l, C_1_to_n), QmultCodomain)), And(ExprRange(sub_expr1, InSet(IndexedVar(b, sub_expr1), Complex), one, j)))))
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())
\left(\left(b_{1}, b_{2}, \ldots, b_{j}\right) \mapsto \left\{\forall_{A_{1}, A_{2}, \ldots, A_{l}, C_{1}, C_{2}, \ldots, C_{n}~|~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\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 b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) =  \\ \left(b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\thinspace C_{1} \thinspace  C_{2} \thinspace  \ldots \thinspace  C_{n}\right) \end{array} \end{array}\right) \textrm{ if } \left(b_{1} \in \mathbb{C}\right) \land  \left(b_{2} \in \mathbb{C}\right) \land  \ldots \land  \left(b_{j} \in \mathbb{C}\right)\right..\right)
In [5]:
stored_expr.style_options()
no style options
In [6]:
# display the expression information
stored_expr.expr_info()
 core typesub-expressionsexpression
0ExprTuple1
1Lambdaparameters: 2
body: 3
2ExprTuple32
3Conditionalvalue: 4
condition: 5
4Operationoperator: 6
operand: 10
5Operationoperator: 8
operands: 9
6Literal
7ExprTuple10
8Literal
9ExprTuple11
10Lambdaparameters: 31
body: 12
11ExprRangelambda_map: 13
start_index: 40
end_index: 36
12Conditionalvalue: 14
condition: 15
13Lambdaparameter: 49
body: 16
14Operationoperator: 17
operands: 18
15Operationoperator: 19
operands: 20
16Operationoperator: 21
operands: 22
17Literal
18ExprTuple23, 24
19Literal
20ExprTuple25, 26
21Literal
22ExprTuple42, 27
23Operationoperator: 30
operands: 28
24Operationoperator: 30
operands: 29
25Operationoperator: 30
operands: 31
26Literal
27Literal
28ExprTuple33, 32, 34
29ExprTuple32, 33, 34
30Literal
31ExprTuple33, 34
32ExprRangelambda_map: 35
start_index: 40
end_index: 36
33ExprRangelambda_map: 37
start_index: 40
end_index: 38
34ExprRangelambda_map: 39
start_index: 40
end_index: 41
35Lambdaparameter: 49
body: 42
36Variable
37Lambdaparameter: 49
body: 43
38Variable
39Lambdaparameter: 49
body: 44
40Literal
41Variable
42IndexedVarvariable: 45
index: 49
43IndexedVarvariable: 46
index: 49
44IndexedVarvariable: 47
index: 49
45Variable
46Variable
47Variable
48ExprTuple49
49Variable