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, ExprTuple, Lambda, j, l
from proveit.core_expr_types import A_1_to_l, b_1_to_j
from proveit.logic import And, Equals, Forall, InClass, InSet
from proveit.numbers import Complex, Mult, Natural, NaturalPos
from proveit.physics.quantum import Qmult, QmultCodomain
In [2]:
# build up the expression from sub-expressions
expr = ExprTuple(Lambda([j, l], Conditional(Forall(instance_param_or_params = [b_1_to_j], instance_expr = Forall(instance_param_or_params = [A_1_to_l], instance_expr = Equals(Qmult(b_1_to_j, A_1_to_l), Qmult(Mult(b_1_to_j), A_1_to_l)).with_wrapping_at(2), condition = InClass(Qmult(A_1_to_l), QmultCodomain)), domain = Complex), And(InSet(j, NaturalPos), InSet(l, Natural)))))
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(j, l\right) \mapsto \left\{\forall_{b_{1}, b_{2}, \ldots, b_{j} \in \mathbb{C}}~\left[\forall_{A_{1}, A_{2}, \ldots, A_{l}~|~\left(A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\right) \underset{{\scriptscriptstyle c}}{\in} \mathcal{Q^*}}~\left(\begin{array}{c} \begin{array}{l} \left(b_{1} \thinspace  b_{2} \thinspace  \ldots \thinspace  b_{j}\thinspace A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\right) =  \\ \left(\left(b_{1} \cdot  b_{2} \cdot  \ldots \cdot  b_{j}\right)\thinspace A_{1} \thinspace  A_{2} \thinspace  \ldots \thinspace  A_{l}\right) \end{array} \end{array}\right)\right] \textrm{ if } j \in \mathbb{N}^+ ,  l \in \mathbb{N}\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
2ExprTuple54, 49
3Conditionalvalue: 4
condition: 5
4Operationoperator: 18
operand: 8
5Operationoperator: 20
operands: 7
6ExprTuple8
7ExprTuple9, 10
8Lambdaparameters: 47
body: 11
9Operationoperator: 33
operands: 12
10Operationoperator: 33
operands: 13
11Conditionalvalue: 14
condition: 15
12ExprTuple54, 16
13ExprTuple49, 17
14Operationoperator: 18
operand: 22
15Operationoperator: 20
operands: 21
16Literal
17Literal
18Literal
19ExprTuple22
20Literal
21ExprTuple23
22Lambdaparameters: 43
body: 24
23ExprRangelambda_map: 25
start_index: 53
end_index: 54
24Conditionalvalue: 26
condition: 27
25Lambdaparameter: 59
body: 28
26Operationoperator: 29
operands: 30
27Operationoperator: 31
operands: 32
28Operationoperator: 33
operands: 34
29Literal
30ExprTuple35, 36
31Literal
32ExprTuple37, 38
33Literal
34ExprTuple56, 39
35Operationoperator: 42
operands: 40
36Operationoperator: 42
operands: 41
37Operationoperator: 42
operands: 43
38Literal
39Literal
40ExprTuple50, 45
41ExprTuple44, 45
42Literal
43ExprTuple45
44Operationoperator: 46
operands: 47
45ExprRangelambda_map: 48
start_index: 53
end_index: 49
46Literal
47ExprTuple50
48Lambdaparameter: 59
body: 51
49Variable
50ExprRangelambda_map: 52
start_index: 53
end_index: 54
51IndexedVarvariable: 55
index: 59
52Lambdaparameter: 59
body: 56
53Literal
54Variable
55Variable
56IndexedVarvariable: 57
index: 59
57Variable
58ExprTuple59
59Variable